How Computers Work Lecture 8 Page 1
How Computers Work
Lecture 8
Asynchronous State Machinesand Metastability
How Computers Work Lecture 8 Page 2
Review:Edge-Triggered Timing
Constraints Edge Triggered Flip-Flop
in outC.L.
Q D
clk
nextstate
currentstate
1
3
5
4
6
clk
next state
current state
TcdC-Q < t____TpdC-Q > t____
TcdC.L. < t____TpdC.L. > t____
_________________ < TcdC-Q + TcdC.L.
1 31 3
1 41 4
3 53 5
4 64 6
TholdThold
How Computers Work Lecture 8 Page 3
Maximum Frequency
in outC.L.
nextstate
currentstate
clk
next state
current state
Clock Period > ___________
Q D
clk Tpd c-q + Tpd cl + TsetupTpd c-q + Tpd cl + Tsetup
How Computers Work Lecture 8 Page 4
Skew
QD
clk1
QD
clk2
C.L.
_______________________< _______________________________
Clock Period > _______________________________
Thold + TskewThold + TskewTcd c-q + tcd clTcd c-q + tcd cl
Tpd c-q + Tpd cl + Tsetup + TskewTpd c-q + Tpd cl + Tsetup + Tskew
How Computers Work Lecture 8 Page 5
What we will cover today:The Trouble with Asynchronous
Inputs
in
nextstate
currentstate Q D
clk
QD
clk
out
QD
clk
How Computers Work Lecture 8 Page 6
A Synchronizer as Arbiter
D Q
clock
DQ
DQ
clock
How Computers Work Lecture 8 Page 7
What Happens Now?
Ts ThCLOCK
D
Flip-Flop Specification Says:______________________NothingNothing
How Computers Work Lecture 8 Page 8
Buridan’s Ass
Buridan, Jean Buridan, Jean (1300-58), French Scholastic philosopher, who held a theory of determinism, contending that the will must choose the greater good. Born in Bethune, he was educated at the University of Paris, where he studied with the English Scholastic philosopher William of Ockham. After his studies were completed, he was appointed professor of philosophy, and later rector, at the same university. Buridan is traditionally but probably incorrectly associated with a philosophical dilemma of moral choice called "Buridan's ass." In the problem an ass starves to death between two alluring bundles of hay because it does not have the will to decide which one to eat.
How Computers Work Lecture 8 Page 9
The Game Show Arbiter
Arbiter
A wins B Wins
A B
How Computers Work Lecture 8 Page 10
A Simpler Arbiter
AA
BBB winsB wins
A winsA wins
How Computers Work Lecture 8 Page 11
With Both Inputs High
H
H
How Computers Work Lecture 8 Page 12
Static Metastability
AR
Ci
VoutVin
Vin Vout
Vin
Vout
Vout = Vin
Vout < Vin
Vout > Vin
How Computers Work Lecture 8 Page 13
Static Metastability:Inverted Pendulum Analogy
h
m(mgh)
Potential Energy
angle
upleft right
How Computers Work Lecture 8 Page 14
What does Heisenberg Say ?
hpx
How Computers Work Lecture 8 Page 15
What if we relax accuracy?
0 Ta - Tb
Arbiter output perfectly correct if | Ta - Tb | > Tmarginif | Ta - Tb | <= Tmargin, output can be RANDOM
Who Won
How Computers Work Lecture 8 Page 16
The Remarkable Fact
The perfect arbiter:
Tmargin and Tpd finite and constantCorrect Ouput if | Ta - Tb | > Tmargin
Any Output if | Ta - Tb | <= Tmargin
Answer valid and stable after Tpd
IT IS IMPOSSIBLE TO BUILD ! ! ! !
How Computers Work Lecture 8 Page 17
Dynamic Metastability(More Stupid Classroom
Tricks)
How Computers Work Lecture 8 Page 18
Lecture Demonstration Circuit
delay
delay
D Q
To Scope
How Computers Work Lecture 8 Page 19
Is It Possible to Build This?
A B
Winner Done
TheAsynchronousArbiter:
Answer:
__________YesYes
How Computers Work Lecture 8 Page 20
Practical Metastability
FSM
Clock
Async.Inputs
How Computers Work Lecture 8 Page 21
A Simple Model of Static Metstability
A
R
Ci
VoutVin
Assume Vout = A Vin (i.e. not saturated)
i =
Vin(t) =1
-1
Vout
Vin
(A - 1) Vin / R(A - 1) Vin / R
E t (A - 1) / ( R C )E t (A - 1) / ( R C )
How Computers Work Lecture 8 Page 22
Evolution of Vout
time
Vout
-1
1
How Computers Work Lecture 8 Page 23
How Small must Vin(0) beto make time to saturation take longer
than time t?
V t V eA
V
in int
in
( ) ( )
( )
/
01
0
1/(A e t/tau) = e -t/tau / A1/(A e t/tau) = e -t/tau / A
How Computers Work Lecture 8 Page 24
If Vin(0) is uniformly distributed:
Vin
But if Vin is in linear rise/fall a certain fraction(p transition) of the time:
p metastable (t) = __________________________
p metastable (t) = __________________________
Vin
1/(A e t/tau) = e -t/tau / A1/(A e t/tau) = e -t/tau / A
p transition /(A e t/tau) = (p transition / A) e -t/taup transition /(A e t/tau) = (p transition / A) e -t/tau
How Computers Work Lecture 8 Page 25
How much time do we needto achieve a certain pmetastable?
))(
ln(
)(
)(
/
/
tPA
Pt
tPA
Pe
eA
PtP
metstable
transition
metstable
transitiont
ttransitionmetstable
How Computers Work Lecture 8 Page 26
Example:How Long for 1 failure / year?
100 MHz Clock (t = 10 ns)ptransition = 0.1A = 10 = 1 nsPmetstable = 1 / (100MHz . 1 year) = 1 / (108 x x 10 7 ) = x 10 -16
t = 10 -9 ln( 0.1 / (10 x x 10 -16 ) ) = about 31 ns
How about 10 years instead of 1?
PP
Ae
tP
A P
metstabletransition t
transition
metstable
/
ln( )
t = (10^-9)ln(pi x 10^(-15)) = 33nst = (10^-9)ln(pi x 10^(-15)) = 33ns
How Computers Work Lecture 8 Page 27
How often will failuresoccur if we wait 100 ns?
4.45
)10ln(
100
2100
/
10
101010
1.0
)(
e
eA
PtP ttransition
metstable
At 100 MHz, this is about 1 failure every 1030 YEARS!Age of Hominids:Age of Earth:Age of Universe:
10 710 7
10 910 9
10 1010 10
How Computers Work Lecture 8 Page 28
Is this a Good ExcuseFor Cruising a Light?
You get 10 30 Years!You get 10 30 Years!
How Computers Work Lecture 8 Page 29
What did we Learn Today?• If we violate setup or hold times, a flip-flop can give a random
digital output.• If we violate setup or hold times, we can’t bound the
propagation delay of a flip-flop.• Metastability usually causes strange outputs, but flip-flops are
sold that have valid, stable, outputs while internal nodes are metastable. They can still change their minds when coming out of metastability.
• In practice, we can choose a propagation time that will have a forever stable output “most” of the time.
• If we wait long enough (typ. 10-100 ns) “most of the time” is almost all of the time.
• We can easily detect when settling happens, but we can’t say how long it will take.