6.004 Computation Structures: Mit Opencourseware
6.004 Computation Structures: Mit Opencourseware
6.004 Computation Structures: Mit Opencourseware
edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Digital Values:
Problem: Distinguishing voltages representing 1 from 0 Solution: Forbidden Zone: avoid using similar voltages for 1 and 0
VOUT VOH VIH
Digital Time:
Problem: Which transition happened rst? questions Solution: Dynamic Discipline: avoid asking such questions in close races
tS D Clk
VIN VOL VIL VIH VOH
tH
VIL VOL
Q tCD tPD
L07 - Synchronization 1
2/26/09
L07 - Synchronization 2
DQ
In
Combinational logic
DQ
Combinational logic
DQ
Out
Combinational logic
DQ
Out
0 1
Clk
Combinational logic
DQ
Combinational logic
DQ
Combinational logic
DQ
Out
To build a system with asynchronous inputs, we have to break the rules: we cannot guarantee that setup and hold time requirements are met at the inputs! So, lets use a synchronizer at each input:
Valid except for brief periods following active clock edges
With careful design we can make sure that the dynamic discipline is obeyed everywhere*...
* well, almost everywhere...
0 1
S(t) (Synchronized)
2/26/09
L07 - Synchronization 3
For NO nite value of tE and tD is this spec realizable, even with reliable components!
Arbiter Output
Issue: Mapping the continuous variable (tB tC) onto the discrete variable S in bounded time.
With no forbidden zone, all inputs have to be mapped to a valid output. As the input approaches discontinuities in the mapping, it takes longer to determine the answer. Given a particular time bound, you can nd an input that wont be mapped to a valid output within the allotted time.
Arbiter specications: nite tD (decision time) nite tE (allowable error) value of S at time tC+tD: 1 if tB < tC tE 0 if tB > tC + tE 0, 1 otherwise
B: C: S:
>tE tD
>tE tD tD
The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the le again. If the red x still appears, you may have to delete the image and then insert it again.
o
CASE 1 CASE 2 CASE 3
B Earlier
6.004 Spring 2009
(tB=tC )
C Earlier
tB-tC
2/26/09
L07 - Synchronization 5
2/26/09
L07 - Synchronization 6
Unsolvable?
that cant be true... Lets just use a D Flip Flop:
B: C: at tB at tC D Q
DECISION TIME is TPD of op. ALLOWABLE ERROR is max(tSETUP, tHOLD) Our logic: TPD after TC, well have Q=0 i tB + tSETUP < tC Q=1 i tC + tHOLD < tB Q=0 or 1 otherwise.
Vout
Q Y
Vout
Were lured by the digital abstraction into assuming that Q must be either 1 or 0. But lets look at the input latch in the ip op when B and C change at about the same time...
6.004 Spring 2009 2/26/09
Recall that the latch output is the solution to two simultaneous constraints:
D G Q
D G
Latched in a 0 state
master
slave
Vin
In addition to our expected stable solutions, we nd an unstable equilibrium in the forbidden zone called the Metastable State
L07 - Synchronization 7 6.004 Spring 2009 2/26/09 L07 - Synchronization 8
Observed Behavior:
typical metastable symptoms
Following a clock edge on an asynchronous input:
CLK D
We may see exponentially-distributed metastable intervals:
Q
Or periods of high-frequency oscillation (if the feedback path is long):
2/26/09
2/26/09
L07 - Synchronization 10
Mechanical Metastability
If we launch a ball up a hill we expect one of 3 possible outcomes:
State A State B
Vout
Metastable State
a) Goes over b) Rolls back c) Stalls at the apex That last outcome is not stable. - a gust of wind - Brownian motion - it doesnt take much
2/26/09 L07 - Synchronization 11 6.004 Spring 2009
Vout Vin
State A
State B
Vin
2/26/09
Sketch of analysis I.
Assume asynchronous 0->1 at TA, clock period CP: Whats the FF output voltage, V0, immediately after TA?
0 1 A Synchronizer C Clock S(t) (Synchronized)
1. Whats the probability that the voltage, V0, immediately after TA is within of VM? tA-tC
< tS+tH CP
P[ V 0 VM
2/26/09
(tS + tH ) 2 CP (VH VL )
L07 - Synchronization 14
2/26/09
L07 - Synchronization 13
Vin
0
A
1
C
Vout
We can model our combinational cycle as an amplier with gain A and saturation at VH, VL
VH
Making conservative assumptions about the distribution of V0 and system time constants, and assuming a 100 MHz clock frequency, we get results like the following: Average time Delay P(Metastable) between failures 31 ns 33.2 ns 3x10-16 3x10-17 10-45 1 year 10 years 1030 years!
2. For Vout near VM, Vout(t) is an exponential whose time constant reects RC/A: 3. Given interval T, we can compute a minimum value of = |V0-VM| that will guarantee validity after T: 4. Probability of metastability after T is computed by probability of a V0 yielding (T)
6.004 Spring 2009 2/26/09
Vout(t)- VM
100 ns
[For comparision: Age of oldest hominid fossil: 5x106 years Age of earth: 5x109 years]
K e -T/
L07 - Synchronization 15
Lesson: Allowing a bit of settling time is an easy way to avoid metastable states in practice!
6.004 Spring 2009 2/26/09 L07 - Synchronization 16
Ancient Metastability
Metastability is the occurrence of a persistent invalid output an unstable equilibria.
Buridens Ass, and other fables The idea of Metastability is not new:
Widespread disbelief. Early analyses documenting inevitability of problem rejected by skeptical journal editors.
The Paradox of Buridans Ass 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 (whom you might recall from his razor business). 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.
Popular pastime: Concoct a Cure for the problem of synchronization failure. Commercial synchronizer products. Acceptance of the reality: synchronization takes time. Interesting special case solutions.
2/26/09 L07 - Synchronization 17 6.004 Spring 2009
Reconciliation: 80s-90s
2/26/09
L07 - Synchronization 18
Folk Cures
the perpetual motion machine of digital logic Bad Idea # 1: Detect metastable state & Fix
Async Input "Clean" Output
"Metastable States":
Bug: detecting metastability is itself subject to metastable states, i.e., the xer will fail to resolve the problem in bounded time.
FF
"FIXER"
Inescapable consequence of bistable systems Eventually a metastable state will resolve itself to valid binary level. However, the recovery time is UNBOUNDED ... but inuenced by parameters (gain, noise, etc) Probability of a metastable state falls o EXPONENTIALLY with time -- modest delay after state change can make it very unlikely. Our STRATEGY; since we cant eliminate metastability, we will do the best we can to keep it from contaminating our designs
delay
Bad Idea #2: Dene the problem away by making metastable point a valid output
valid "0"
The ima ge can not
valid "1"
Bug: the memory element will ip some valid 0 inputs to 1 after a while. Many other bad ideas involving noise injection, strange analog circuitry, have been proposed.
2/26/09 L07 - Synchronization 19
2/26/09
L07 - Synchronization 20
Modern Reconciliation:
delay buys reliability
A metastable state here will probably resolve itself to a valid level before it gets into my circuit.
Synchronizers, extra ip ops between the asynchronous input and your logic, are the best insurance against metastable states. The higher the clock rate, the more synchronizers should be considered.
Arbiter
In
DQ
DQ
Combinational logic
DQ
Out
2. Bounded-time Synchronizer:
Asynchronous Input
D Q
Clk
SETTLING TIME
Cures Metastability!
In
DQ
Out
Clk
Continuous Variable
> 3.14159 ?
0 or 1, nite tpd
2/26/09
L07 - Synchronization 21
2/26/09
L07 - Synchronization 22
Arbiter Done
> 3.14159 ?
Done
0 or 1
After arbitrary interval, decides whether input at time of last active clock edge was above/below threshold.
Mesochronous communication:
Data1 CLK2 Data2 delay
CLK1 CLK2
Constraints on clock timing periodicity, etc can often be used to hide time overhead associated with synchronization.
2/26/09 L07 - Synchronization 24
2/26/09
L07 - Synchronization 23
Every-day Metastability - I
GIVEN:
The image cannot be displayed. Your computer may not have enough memory to open the image,
Every-day Metastability - II
Normal trac light: GREEN, YELLOW, RED sequence 55 MPH Speed Limit Suciently long YELLOW, GREEN periods Analog POSITION input digital RED, YELLOW, GREEN inputs digital GO output
Ben Bitdiddle tries the famous 6.004 defense: Ben leaves the Bit Bucket Caf and approaches fork in the road. He hits the barrier in the middle of the fork, later explaining I cant be expected to decide which fork to take in bounded time!. Is the accident Bens fault?
Yes; he should have stopped until his decision was made. Judge R. B. Trator, MIT 86
LAW #1: DONT CROSS LINE while light is RED. GO = GREEN LAW #2: DONT BE IN INTERSECTION while light is RED.
PLAUSIBLE STRATEGIES:
A. Move at 55. At calculated distance D from light, sample color (using an unbounded-time synchronizer). GO ONLY WHEN stable GREEN. B. Stop 1 foot before intersection. On positive GREEN transition, gun it.
6.004 Spring 2009 2/26/09 L07 - Synchronization 26
2/26/09
L07 - Synchronization 25
Summary
The most dicult decisions are those that matter the least.
As a system designer Avoid the problem altogether, where possible
Use single clock, obey dynamic discipline Avoid state. Combinational logic has no metastable states!