Clock-Domain Crossing Metastability and Synchronizer Chains
Metastability is a temporary analog condition in a flip-flop when an input changes too close to the flip-flop’s sampling edge. At a clock-domain crossing (CDC), a synchronizer chain gives that uncertain result time to settle before downstream logic uses it.
The problem: unrelated clocks
A clock domain is the collection of logic driven by one clock. Two domains are asynchronous when their clocks have no guaranteed phase or frequency relationship. A signal produced in one domain can therefore arrive at a receiving flip-flop at any point in the receiver’s clock cycle.
Flip-flops have two timing requirements:
- Setup time: the input must be stable for a short period before the clock edge.
- Hold time: the input must remain stable for a short period after the edge.
If an asynchronous signal changes during this small setup-and-hold window, the receiving flip-flop is being asked to decide between its two output states at almost exactly the wrong time. Its internal electrical nodes can enter an unstable balance. The output may take an unusually long time to settle, and its eventual value is not reliably predictable.
That condition is metastability. It is not the same as a clean logic 0 or 1, and it is not a software exception that the processor can catch. It is an analog behavior inside a circuit that normally presents digital values.
Without a CDC strategy, the receiving domain can use the flip-flop’s output while it is still resolving. One piece of logic might interpret it as 0 while another interprets it as 1, or the uncertain voltage might violate the input requirements of a later flip-flop. The resulting symptoms can include an occasional incorrect enable, a corrupted state-machine transition, or failures that disappear when probing or changing the clock frequency.
Why one flip-flop cannot eliminate it
A flip-flop is where the sampling decision happens, so adding a flip-flop does not make the underlying timing uncertainty impossible. Every ordinary flip-flop has a finite setup-and-hold window and can become metastable when that window is violated.
The first flip-flop in a CDC path is therefore allowed to become metastable. Its job is not to guarantee an immediate, correct answer. Its job is to begin resolving the analog uncertainty toward a legal logic level.
Resolution usually happens quickly, but there is no fixed maximum resolution time that applies in every case. A flip-flop that has not settled by the next clock edge can pass an uncertain or late-changing value to the next piece of logic. In a single-flip-flop design, that next logic is often the actual application logic, so it has no extra time or isolation.
This is why “put the signal through a flip-flop” is not, by itself, a complete synchronizer. It still leaves the receiving system exposed to the first flip-flop’s unresolved output.
How a synchronizer chain helps
For a single-bit level signal, the usual solution is a chain of flip-flops clocked by the destination clock—the clock in the domain that will consume the signal. The first stage samples the asynchronous input. The second stage samples the first stage, and downstream logic uses the second stage rather than the first.
always_ff @(posedge destination_clk) begin
sync_ff1 <= signal_from_other_domain;
sync_ff2 <= sync_ff1;
end
assign signal_in_destination_domain = sync_ff2;
The first stage remains the most likely place for metastability. The important change is that it is no longer connected directly to ordinary functional logic. It has almost one full destination-clock period to resolve before the second stage samples it.
A third stage can provide another clock period of resolution time. More stages are used when the required reliability is especially high or the clocks are particularly fast, although each stage also adds latency.
The reduction in risk is approximately exponential with the available resolution time. A common reliability model expresses this through a mean time between failures (MTBF) that increases roughly as
MTBF ∝ exp(available resolution time / device-specific time constant)
The device-specific constants come from the flip-flop’s physical design and are normally supplied by the chip or FPGA manufacturer. The failure rate also rises with the destination clock frequency and with how often the asynchronous input changes. A faster clock gives the second stage less time to wait; a signal that toggles more often creates more opportunities to land in the setup-and-hold window.
This does not make metastability impossible. It makes the probability that metastability remains long enough to affect the second stage—and therefore downstream logic—small enough to meet a design’s reliability target.
Practical limits
The synchronizer stages must be treated as a special physical path, not merely as two lines of HDL. They should be placed close together so routing does not consume the resolution interval, and implementation tools should be told that the registers form a synchronizer when the target technology supports such annotations. The first stage should not feed combinational logic, status flags, or multiple unrelated consumers.
This basic chain is for a slowly changing, single-bit level. It does not safely transfer a multi-bit bus: different bits can be sampled on different cycles. It also does not guarantee that a narrow pulse will be seen at all if the destination clock never samples it. Those cases need a protocol that preserves the event or data, such as a handshake or an appropriate asynchronous storage structure.
When a log or design review mentions a “two-flop synchronizer,” “CDC violation,” or an ASYNC_REG implementation attribute, it is usually referring to this trade: accept a small amount of latency, isolate the first uncertain sample, and give the circuit additional time so that an extraordinarily rare analog failure is unlikely to reach functional logic.