Multi-clock designs are common in digital systems, especially in applications that need high performance, low power and interoperability with different standards. They also bring their own set of problems: metastability, reset synchronization, glitches, missed signals and lost correlation between related bits. This post lists five classic problems with their solutions, the structural checks that catch them, and the general approaches that make multi-clock development and verification easier.
Five problems and their solutions
Problem 1: Metastability
Solution: use appropriate synchronizers. A flip-flop that samples a signal from another clock domain can be caught mid-transition and take an unpredictable time to settle. A synchronizer gives it time to settle before anything else uses the value. For the types of synchronizer, see the earlier posts Asynchronous in a Synchronous World, Part 1: Synchronizer Types and Metastability in Flip-Flops.
Problem 2: Reset synchronization
Solution: take proper care when deasserting resets, because the release of a reset close to a clock edge can drive sequential elements into a metastable state. Have a separate synchronizer for the reset signal as it enters each clock domain. A common form asserts reset asynchronously and releases it synchronously to the local clock.
Problem 3: Glitches across clock boundaries
Solution: signals entering synchronizers should be driven directly by a flip-flop in the source clock domain, not by combinational logic. Combinational logic can glitch while its inputs settle, and the receiving domain, with its unrelated clock, may sample the glitch as a real pulse.
Problem 4: Insufficient hold time in the receiving clock domain
Solution: a signal passing from a fast clock domain to a slow clock domain must stay stable for multiple cycles of the fast clock, so that the slower clock domain cannot miss the transition entirely. A one-cycle pulse in a fast domain can fall completely between two edges of a slow clock.
Problem 5: Loss of signal correlation
Solution: correlation between signals can be lost in several ways: the bits of a bus, several copies of a single signal, handshake signals, and signals that are synchronized separately and then reconverge. Because each synchronizer may resolve on a different cycle, bits that left the source together can arrive in different cycles. The fix depends on the case:
- Counters and pointers: use Gray code, so that only one bit changes per step and a late bit gives either the old or the new value, never a wrong one.
- General data buses: do not synchronize the bits individually. Hold the data stable and pass a single synchronized control signal (a handshake), or use an asynchronous FIFO.
- Copies of one signal: synchronize it once and fan out the synchronized version, never synchronize the same signal in two places.
Structural analysis: what to check
Do extensive structural analysis of the design in RTL form, tracing all clocks and resets. This identifies:
- all asynchronous clock domains in the design
- all control and data signals crossing between clock domains
- any domain-crossing signals that have missing or incorrect synchronizers
- any synchronizer that has the potential for glitches on its input
- any signals that fan out to multiple synchronizers
- any independently synchronized signals that reconverge in the receiving clock domain
- any clock domains whose reset signals are not properly synchronized
- any gated or derived clocks with glitch potential
These checks can be automated and run on designs of any complexity.
General approaches that ease multi-clock design
- Use a common clock source and frequency for all domains where possible, to avoid clock domain crossing (CDC) issues and simplify timing analysis.
- Use clock gating to reduce dynamic power in domains that are idle, built from proper glitch-free clock gating cells rather than plain logic gates.
- Use asynchronous (dual-clock) FIFOs to transfer data between domains with different clock frequencies or phases.
- Use CDC protocols and synchronizers to keep data intact and avoid metastability when transferring data between domains with different clock sources or asynchronous resets.
- Use formal methods and CDC tools to verify that crossings are correct and complete, and to detect potential CDC errors and hazards.
- Use static timing analysis (STA) and dynamic simulation to verify the timing constraints and the functionality of multi-clock designs.
Following these approaches reduces the complexity and risk of multi-clock designs and helps achieve better performance, power efficiency and reliability.
Deep dive: the numbers and details
This part holds the MTBF equation, worked examples and code. Skip it if the overview is all you need.
How reliable is a two-flip-flop synchronizer?
Ran Ginosar's tutorial "Metastability and Synchronizers" (IEEE Design & Test, September/October 2011) gives the mean time between failures as:
MTBF = e^(S/τ) / (T_W × F_C × F_D)
where S is the time allowed for resolution, τ the resolution time constant of the flip-flop, TW the window around the clock edge in which a data change can cause metastability, FC the clock frequency and FD the rate at which the data changes. S is one clock period minus the flip-flop's clock-to-Q delay, the second flip-flop's setup time and any wire delay, which is why the paper warns that the two flip-flops should be placed near each other.
| Case (from the paper) | τ | TW | FC | FD | MTBF |
|---|---|---|---|---|---|
| 28 nm, nominal conditions, S = one 1 ns cycle | 10 ps | 20 ps | 1 GHz | 100 MHz | about 4 × 1029 years |
| Low voltage and high temperature, S = one cycle | 100 ps | 200 ps | 1 GHz | 1 kHz | about a minute |
Check the second case: e1000/100 = e10 ≈ 22,026, and the denominator is 200 ps × 1 GHz × 1 kHz = 200 per second, so MTBF ≈ 110 seconds. The exponent makes the result extremely sensitive to τ: a tenfold slower flip-flop turns a design that never fails into one that fails every couple of minutes. The paper suggests a third flip-flop for such cases, giving a second cycle of resolution time.
Synchronizer and reset synchronizer in Verilog
// Two-flip-flop synchronizer for a level signal from another domain.
// The source must drive async_in directly from a flip-flop.
module sync2 (input wire clk, rst_n, async_in, output reg sync_out);
reg meta;
always @(posedge clk or negedge rst_n)
if (!rst_n) {sync_out, meta} <= 2'b00;
else {sync_out, meta} <= {meta, async_in};
endmodule
// Reset synchronizer: asynchronous assert, synchronous release.
module reset_sync (input wire clk, arst_n, output reg rst_n);
reg r1;
always @(posedge clk or negedge arst_n)
if (!arst_n) {rst_n, r1} <= 2'b00;
else {rst_n, r1} <= {r1, 1'b1};
endmodule
Use one reset_sync per clock domain, as Problem 2 requires.
Fast to slow: how long must a pulse last?
Take a 200 MHz source (5 ns period) and a 50 MHz destination (20 ns period). A one-cycle pulse lasts 5 ns and can fall entirely between two destination edges. To be sure the destination sees it, the pulse must cover at least one full destination period plus the destination flip-flop's setup and hold window: in practice at least 20 ns plus margin, so 5 or more source cycles. Another option is to convert the pulse into a toggle that stays at its new level until the next event, and detect the change on the destination side.
Why Gray code fixes pointers but not buses
A binary counter going from 0111 to 1000 changes all four bits. If one synchronizer resolves a cycle late, the receiver can see 1111 or 0000, values the counter never held. In Gray code the same step changes one bit, so the receiver sees either the old value or the new one. Ginosar's paper notes that the read and write pointers of a two-clock FIFO are usually kept in Gray code for exactly this reason. Arbitrary data does not change one bit at a time, so Gray code cannot help there; the FIFO or a handshake is the answer.
Reconvergence and multiple synchronizers
Synchronizing the same asynchronous input in two parallel synchronizers is forbidden: one may resolve to 1 while the other resolves to 0, leaving the logic in an inconsistent state. Ginosar's paper describes exactly this as the cause of a failure in its opening example. The structural checks for fan-out to multiple synchronizers and for reconvergence (items 5 and 6 in the list above) exist to catch this.
Related posts on this blog
- Asynchronous in a Synchronous World: Clock Domain Synchronizers
- Diagnosing Clock Domain Crossing Errors in FPGAs
- Reset Domain Crossing: The Cousin of CDC Everyone Forgets


Found the literature very informative and author has made thought provoking statements
ReplyDelete