Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Synchronizers: A Tutorial
Ran Ginosar
TechnionIsrael Institute of Technology
CLK2 CLK1
D A B Q
CLK2 CLK1
CLK1
CLK2
CLK2 CLK1
CLK2
CLK2
CLK1
CLK2 CLK1
(b)
Figure 2. Flip-flops, with four (a) and two (b) gate delays from D to Q.
Inputs
We can simulate the effect by playing with the relative
timing of clock and data until we obtain the desired
Voltage
Clock
result, as Figure 3 demonstrates. Incidentally, other
Outputs
badly timed inputs to the flip-flop (asynchronous
reset, clear, and even too short a pulse of the clock
due to bad clock gating) could also result in (a) Time
metastability.
When the coincidence of clock and data is un-
known, we use probability to assess how likely the
latch is to enter metastability (we focus on the master
latch for now and discuss the entire flip-flop later).
The simplest model for asynchronous input assumes
that data is likely to change at any time with uniform
(b)
distribution. We can define a short window TW
around the clocks sampling edge (sort of setup-
and-hold time) such that if data changes during
that window, the latch could become metastable
(namely, the flip-flop output might change later than
tpCQ). If it is known that data has indeed changed
sometime during a certain clock cycleand since
(c)
the occurrence of that change is uniformly distrib-
uted over clock cycle TCthe probability of entering
metastability, which is the probability of Ds having Figure 3. Empirical circuit simulations of entering
changed within the TW window, is TW/TC TWFC metastability in the master latch of Figure 2a.
(FC is the clock frequency). Charts show multiple inputs D, internal clock
But D may not change every cycle; if it changes at (CLK2) and multiple corresponding outputs Q
a rate FD, then the rate of entering metastability (voltage vs. time). The input edge is moved in
becomes Rate FDFCTW. For instance, if FC steps of 100 ps, 1 ps, and 0.1 fs in the top,
1 GHz, FD 100 MHz, and TW 20 ps, then Rate middle, and bottom charts respectively.
2,000,000 times/sec. Indeed, the poor latch enters
metastability often, twice per microsecond or once
every 500 clock cycles. (Note that we traded proba-
bility for ratewe need that in the following A R
discussion.)
C
Exiting metastability
Now that we know how often a latch has entered
metastability, how fast does the latch exit from it? VA VB
In metastability, the two inverters operate at their
linear-transfer-function region and can be modeled,
using small-signal analysis, as negative amplifiers
(see Figure 4). Each inverter drives, through its output R A
resistance R, a capacitive load C comprising the other
inverters input capacitance as well as any other exter- C
nal load connected to the node. Typically, the master
latch becomes metastable and resolves before the
second phase of the clock cycle. In rare cases,
when the master latch resolves precisely half a Figure 4. Analog model of a metastable latch; the
cycle after the onset of metastability, the slave latch inverters are modeled as negative amplifiers.
September/October 2011 25
Asynchronous Design
0
1 x indicating that the explosion actually happens at
2
3
the microscopic level. As the voltage difference
4 y approaches the transistor threshold voltage, the latch
5 changes its mode of operation from two intercon-
6
7 nected small-signal linear amplifiers (as in Figure 4)
to a typical, slower digital circuit. We say that meta-
stability has resolved as soon as the growth rate of V
Figure 6. Log of the voltage difference of the two nodes of a
is no longer exponential (the log curve in Figure 6
resolving latch in Figure 5.
flattens off).
The log chart facilitates a simple estimate of t.
could enter metastability as a result (its input is
Take the ratio of two arbitrary voltage values
changing exactly when its clock disconnects its
V x (t x ), V y (t y ) along the straight line and solve
input, and so on, thereby repeating the aforemen-
for t:
tioned master-latch scenario).
The simple model results in two first-order differen-
Vx Ketx =t ; Vy Kety =t
tial equations that can be combined into one, as
follows: Vx tx ty
etx ty =t ) t
Vy ln Vx
AVB VA dVA AVA V B dVB Vy
C ; C
R dt R dt
Actually, several factors affect t. First, in some circuits
VB VA VA VB dVA VB
C it may change during resolution, and the line of
R dt
Figure 6 is not exactly straight. Process variations
RC might result in t several times larger than predicted
define VA V B V and t
A1 by simulations. Low supply voltage, especially when
dV the metastability voltage is close to the threshold volt-
then V t and the solution is V Ket=t
dt age (and gm decreases substantially), as well as very
0.8
Voltage
0.6
0.4
0.2
0.0
Time (ns)
0 2 4 6 8 10 12 14 16
0 2 4 6 8 10 12 14 16
0
Log (voltage difference)
10
12
Figure 7. Simulations of metastability resolution with the starting voltage difference varying from
100 mV (left) to 10 pV (right); the lower the starting voltage, the longer resolution takes. The top
chart shows voltage of the two latch nodes (the chart for V0 1 mV is the same as in Figure 5);
the bottom chart shows the log of their difference (the line starting at 26 is the same as in Figure 6).
high or extremely low temperatures, could increase t edge blocked the input and closed the latch (specifi-
by several orders of magnitude. These issues make cally, what the actual value of V was at that moment),
the research of synchronization an interesting chal- and how noise might have changed that value. Ob-
lenge with practical implications. serve that thermal noise is anywhere from 1 mV to
Clearly, if metastability starts with V V 0 and 1 mV, much higher than V in the extreme cases on
ends when V V1, then the time to exit metastabil- the right-hand side of Figure 7. Since we dont know
ity is tm: V0 deterministically, we dont know how long the
latch will stay metastablebut we can provide a sta-
V1 tistical estimate. Probabilistic analysis shows that if a
V1 V0 etm =t ) tm t ln
V0 latch is metastable at time zero, the probability it will
Thus, the time to exit metastability depends loga- remain metastable at time t > 0 is e--t/t, which dimin-
rithmically on the starting voltage V0 (and not on ishes exponentially fast. In other words, even if a latch
the fixed exit voltage V1), as Figure 7 clearly became metastable, it would resolve pretty fast.
demonstrates.
Had we started with V0 V1, then the time in Synchronization reliability
metastability would be zero (the leftmost curve in All the foregoing leads us to computing reliability.
Figure 7). On the other hand, if V0 0, we would If a latch receives asynchronous inputs, we cant guar-
have waited forever, but this possibility is unlikely. In antee that it will never become metastablein fact,
fact, the claim that in metastability, the two nodes we already know that it will definitely become meta-
of the latch get stuck in the middle and would even- stable at the high rate of FDFCTW (2 million times/s in
tually get out of there by some random process, the preceding example). Instead, we can compute
which some researchers and designers often make, the reliability that it will fail as a result of entering
should be taken lightly. Two factors affect the actual metastability. The synchronizers whole purpose is to
initial voltage: when exactly the clocks sampling minimize that failure probability. Now we can finally
September/October 2011 27
Asynchronous Design
clock 1 2 3 1 2 3 1 2 3 1 2 3
D1
Q1
Q2
September/October 2011 29
Asynchronous Design
September/October 2011 31
Asynchronous Design
unsafe
xclk D Q D Q D Q FSM: output 1(0)
only after k
consecutive 1(0) inputs
rclk
Late
D Q rclk
rclk
Early
September/October 2011 33
Asynchronous Design
cross from one domain to another. Using a variety of this an attractive, intriguing field. The folklore, the
structural design rules, they are helpful in assuring myths, the rumors, and the horror stories have
that no such crossing remains unchecked. Some as- added a fun aspect to a problem that has been
sess overall SoC reliability in terms of MTBF. At least blamed for the demise of several products and the
one tool also suggests solutions for problematic cross- large financial losses that resulted. Fortunately, with
ings in terms of synchronizer IP cores. a clear understanding of the risks, respect for the dan-
gers, and a strict engineering discipline, we can avoid
THIS SHORT TUTORIAL has been an attempt to present the pitfalls and create safe, reliable, and profitable
both the beauty and the criticality of the subject of digital systems and products.
metastability and synchronizers. For more than
65 years, many researchers and practitioners have
shared the excitement of trying to crack this tough Acknowledgments
nut. The elusive physical phenomena, the mysterious Chuck Seitz wrote the seminal chapter 7 of the
mathematical treatment, and the challenging engi- VLSI bible (Introduction to VLSI Systems) and
neering solutions have all contributed to making got me started on this. The late Charlie Molnar
pointed at the science of metastability, and Peter and VLSI architecture for parallel computing. He has
Alfke stressed the engineering of it. The comments a PhD in electrical engineering and computer science
of Charles Dike, Cliff Cummings, Shalom Bres- from Princeton University. He is a senior member
ticker, Shlomi Beer, Reuven Dobkin, and Richard of IEEE.
Katz helped to significantly improve this writing.
The cumulative experience and know-how of
hundreds of engineers, students, and colleagues
Direct questions and comments about this article to
Ran Ginosar, VLSI Systems Research Center, Elec-
taught me the good and the bad of metastability
trical Engineering and Computer Science Depart-
and convinced me that this is a delightful
ments, TechnionIsrael Institute of Technology,
subject.
Haifa 32000, Israel; ran@ee.technion.ac.il.
Ran Ginosar is an associate professor of elec-
trical engineering and computer science at the
TechnionIsrael Institute of Technology. His research
interests include synchronization, asynchronous VLSI,
September/October 2011 35