I am composing this article to explore various aspects of clock and data synchronization.
The first part of the series covers level synchronizers, edge synchronizers and pulse synchronizers. The second part deals with synthesis and scripting techniques for designs with multiple asynchronous clocks. This introduction explains the problem they solve.
Why crossing clock domains is a problem
Applications including disk-drive controllers, CD-ROM and DVD controllers, modems, network interfaces and network processors all have to move data across multiple clock domains. When a signal travels from one clock domain to another, it appears to be asynchronous in the new clock domain.
Today's design flows give us many software programs to help create million-gate circuits, but these programs do not solve the problem of signal synchronization. It is up to the designer to know reliable design techniques that reduce the risk of failure for circuits communicating across clock domains.
Signal stability and the first flip-flop
The first step in managing multi-clock designs is to understand the problem of signal stability. When a signal crosses a clock domain, it appears to the circuitry in the new clock domain as an asynchronous signal. The circuit that receives this signal needs to synchronize it. Synchronization prevents the metastable state of the first storage element (flip-flop) in the new clock domain from propagating through the circuit.
What metastability is
Metastability is the inability of a flip-flop to arrive at a known state in a specific amount of time. When a flip-flop enters a metastable state, you can predict neither the element's output voltage level nor when the output will settle to a correct voltage level. During this settling time, the flip-flop's output may sit at an intermediate voltage level or may oscillate, and it can cascade the invalid output level to flip-flops farther down the signal path.
The input must be stable during a small window of time around the active edge of the clock for any flip-flop. This window is a function of the design of the flip-flop, the implementation technology, the operating conditions, and the load on the output for outputs that are not buffered. Sharp edge rates on the input signal minimize the window. More windows of vulnerability arise as the clock frequency increases, and the probability of hitting the window increases as the data frequency increases.
The standard fix in one picture
The usual cure is simple: do not use the first flip-flop's output directly. Pass the asynchronous signal through two flip-flops in series, both clocked by the receiving clock. The first flip-flop may go metastable; it then has almost a whole clock period to settle before the second flip-flop samples it. The chance that it is still undecided by then is very small, and it shrinks exponentially with the time allowed.
- Level synchronizer: the two-flop chain itself, for signals that stay high or low for several receiving-clock cycles.
- Edge synchronizer: a level synchronizer plus one more flip-flop and a gate, to produce a one-cycle pulse when the synchronized level changes.
- Pulse synchronizer: converts a short pulse in the source domain into a toggle, synchronizes the toggle, and turns it back into a pulse, so that a pulse shorter than the receiving clock period is not missed.
Synchronizers handle single control bits. A multi-bit bus must not be synchronized bit by bit, because the bits can resolve in different cycles. Buses cross domains with a handshake, a Gray-coded pointer, or an asynchronous FIFO.
Deep dive: the numbers and details
This part holds the failure-rate equation, a worked example and the common mistakes. Skip it if the overview is all you need.
The MTBF equation
The standard model, as set out in Ran Ginosar's tutorial "Metastability and Synchronizers: A Tutorial" (IEEE Design & Test of Computers, 2011), gives the mean time between synchronization failures as:
MTBF = e^(S / tau) / (TW * FC * FD)
| Symbol | Meaning |
|---|---|
| S | Settling time allowed before the next flip-flop samples (roughly one clock period minus clock-to-Q, setup and wire delay) |
| tau | Resolution time constant of the flip-flop |
| TW | Width of the vulnerable window around the clock edge |
| FC | Receiving clock frequency |
| FD | Rate at which the asynchronous data changes |
The tutorial notes that tau and TW are both close to the typical gate delay of the process. The key point is the exponent: every extra tau of settling time multiplies MTBF by e, about 2.7.
Worked example (illustrative numbers)
Take tau = 20 ps, TW = 40 ps, a 500 MHz receiving clock (FC = 5 x 10^8) and data that changes at 50 MHz (FD = 5 x 10^7). Then TW x FC x FD = 40 x 10^-12 x 5 x 10^8 x 5 x 10^7 = 10^6 per second.
- One flip-flop, output used almost at once. Suppose only 0.2 ns of slack remains for settling. S/tau = 10, e^10 is about 22,000, and MTBF is about 22,000 / 10^6 = 0.022 seconds. The design fails many times a second.
- Two-flop synchronizer. The period is 2 ns. If clock-to-Q, setup and wiring take 0.2 ns, S = 1.8 ns, so S/tau = 90. e^90 is about 1.2 x 10^39, and MTBF is about 1.2 x 10^33 seconds, far longer than the age of the universe.
The numbers are illustrative, but the shape is real: one extra flip-flop turns a failure every few milliseconds into one that will never be seen. It also shows why a synchronizer must have no logic between its two flip-flops; every gate delay there comes straight out of S.
What makes MTBF worse
| Change | Effect on MTBF |
|---|---|
| Higher receiving clock frequency | Less settling time (exponential loss) and more samples per second (linear loss) |
| Faster-changing data | Linear loss |
| Low supply voltage, high or very low temperature | Larger tau, which hurts through the exponent |
| Logic between synchronizer stages | Directly reduces S |
| Many synchronizers on a chip | Chip-level failure rate is the sum of all of them |
Common mistakes
- Synchronizing each bit of a multi-bit bus separately, so that the receiver sees a mix of old and new bits.
- Synchronizing the same asynchronous signal in two places, so that two parts of the design see it change in different cycles.
- Feeding a combinational output (which can glitch) into a synchronizer instead of a registered signal.
- Sending a pulse that is shorter than the receiving clock period through a plain level synchronizer, so it is missed.
- Leaving the synchronizer flip-flops free for synthesis to merge, duplicate or move logic between them.
Interview angle
A common question is "Why two flip-flops and not one, and when would you use three?" The answer is the exponential term: two flip-flops give a full clock period of settling time. A third stage adds another period, which some teams use for very fast clocks, low voltages or safety-critical parts where the MTBF target is extreme.
Further reading
- Asynchronous in a Synchronous World, Part 1: Synchronizer Types (this blog)
- Asynchronous in a Synchronous World, Part 2: Timing and Synthesis (this blog)
- Metastability in flip-flops: causes, MTBF and synchronizers (this blog)
- Clifford E. Cummings, "Clock Domain Crossing (CDC) Design and Verification Techniques Using SystemVerilog," SNUG Boston 2008 (Internet Archive copy)
- Ran Ginosar, "Metastability and Synchronizers: A Tutorial," IEEE Design & Test of Computers, 2011 (PDF)


Your comments will be moderated before it appears here.