Metastability and Synchronizers in VLSI: MTBF, CDC and STA

Metastability and Synchronizers in VLSI: MTBF, CDC and STA

Metastability in VLSI explained for STA and physical design engineers: how two-flop synchronizers work, the MTBF equation with real ASAP7 OpenSTA slacks, why STA slack on asynchronous crossings is meaningless, set_clock_groups vs set_max_delay for Gray buses, protecting synchronizers in placement and CTS, a debug flowchart and interview Q&As.

Every chip with more than one unrelated clock has signals that cross from one clock domain to another. Each of those crossings can make a flip-flop metastable: its output hangs between 0 and 1 for an unpredictable time before it settles. You cannot remove metastability; you can only make failures so rare that they never matter in the product’s lifetime. That is the job of a synchronizer.

This post looks at metastability the way a physical design or STA engineer has to: what it is, how the MTBF equation works, why STA slack on an asynchronous crossing is meaningless, which constraints to write, what goes wrong in placement and CTS, and how to debug it. The STA numbers come from a small hand-written netlist on the open ASAP7 predictive 7 nm library, timed with OpenSTA 2.3.1 (pre-layout, ideal clocks, no wire parasitics). Any number that does not come from those runs is labelled illustrative.

What metastability is

A flip-flop is a pair of cross-coupled storage loops with two stable states. Its library timing assumes the D input is stable for the setup time before the clock edge and the hold time after it (setup and hold explained). If D changes inside that window, the internal node can land close to the balance point between the two states. From there it drifts away exponentially, at a rate set by the gain and capacitance of the loop. The deeper inside the window the input changed, the longer the output takes to settle.

Three properties matter in practice:

  • It is random, not a timing bug you can fix. If the two clocks are asynchronous, data will eventually change inside the window, however good the layout is.
  • The settling time has no upper bound. The probability that the flop is still unresolved after time t falls as e^(-t/τ), where τ (tau) is the resolution time constant of the flop. It never reaches zero.
  • The danger is downstream. A half-level output can be read as 0 by one gate and 1 by another. That is how a state machine ends up in an illegal state, or how a FIFO pointer jumps.

If you need a refresher on why storage elements behave this way, see latch vs flip-flop and combinational vs sequential circuits.

The two-flop synchronizer

The standard fix for a single-bit signal is to sample it with two flip-flops in the receiving domain, connected directly Q to D. The first flop (sync1) is allowed to go metastable. The second flop (sync2) samples it one full destination clock period later, by which time sync1 has almost certainly resolved. Only sync2‘s output is used by the rest of the design.

Schematic of a source flop in clock domain A driving a two-flop synchronizer in clock domain B, with a waveform showing the asynchronous input changing inside the setup and hold window, the first synchronizer output hanging at an intermediate level before settling, and the second flop output switching cleanly one clock later
A two-flop synchronizer: the first stage may go metastable, the second samples it one destination clock later (conceptual).

Two rules follow directly from the picture:

  1. Nothing between sync1 and sync2. Every picosecond of logic or wire between the stages is taken from the time sync1 has to resolve.
  2. Register the signal in the source domain before it crosses. If combinational logic drives the crossing, its glitches can be sampled as real pulses.

The synchronizer only guarantees that the receiver sees a clean 0 or 1. It does not guarantee which destination cycle the change appears in: a change can show up one cycle earlier or later depending on how the first flop resolved. Any design that crosses domains has to tolerate that one-cycle uncertainty.

MTBF: how rare is “rare enough”?

Reliability of a synchronizer is expressed as mean time between failures (MTBF). The commonly used model, as presented in Ginosar’s tutorial (see References), is:

MTBF = e^(t_r / τ) / (T_w × f_c × f_d)

  • t_r: resolution time, the time the first flop has to settle before the next stage samples it. For a two-flop synchronizer this is roughly the destination period minus the clock-to-Q of sync1, the wire delay and the setup time of sync2. In other words, it is the setup slack of the sync1 → sync2 path.
  • τ: the resolution time constant of the flop. It depends on the cell, the supply voltage and the temperature, and gets worse at low voltage.
  • T_w: the effective window of vulnerability around the clock edge.
  • f_c: the sampling (destination) clock frequency.
  • f_d: the rate at which the input data changes.

τ and T_w are not in normal Liberty files. They come from dedicated characterisation by the library vendor or the design team, so the values below are only illustrative.

Worked example: real slack, illustrative τ

Our test netlist has a src_a flop on clka (1000 ps) driving a two-flop synchronizer on clkb (625 ps, 1.6 GHz), all DFFHQNx1_ASAP7_75t_R cells. A second “bad” synchronizer has three inverters between its stages. OpenSTA reported:

Path Arrival Required Setup slack (≈ t_r)
sync1 → sync2 (direct) 31.72 ps 610.14 ps 578.42 ps
bsync1 → bsync2 (3 inverters) 48.05 ps 610.01 ps 561.96 ps

The three inverters cost only 16.46 ps. Now put illustrative values into the formula: T_w = 20 ps, f_c = 1.6 GHz, f_d = 50 MHz, so the denominator is 1.6 × 10^6 per second.

τ (illustrative) MTBF, direct (578.42 ps) MTBF, with inverters (561.96 ps) MTBF, 3 stages (≈ 2 × 578.42 ps)
10 ps 8.3 × 10^18 s (≈ 2.6 × 10^11 years) 1.6 × 10^18 s far beyond any lifetime
20 ps 2.3 × 10^6 s (≈ 26 days) 1.0 × 10^6 s (≈ 12 days) 8.3 × 10^18 s
40 ps 1.2 s 0.79 s 2.3 × 10^6 s (≈ 26 days)

Three lessons:

  • MTBF is exponential in slack. The 16.46 ps lost to three small inverters cut MTBF by e^(16.46/τ): 5.2× at τ = 10 ps, 2.3× at τ = 20 ps. Losing a long wire or a buffer chain in placement costs much more.
  • τ dominates. The same layout swings from “never fails” to “fails every second” depending on τ. That is why MTBF must be checked at the worst corner for τ (usually low voltage), not at the corner you happen to be closing timing in.
  • A third stage roughly doubles t_r, and that adds a lot of margin when τ is large. Remember that MTBF is per synchronizer: a chip with 1,000 synchronizers and a fleet of a million chips needs a much larger per-synchronizer MTBF than a single test board does.
Line chart of log10 MTBF in seconds against resolution time from 0 to 650 ps for tau of 10, 20 and 40 ps with illustrative T_w 20 ps, f_c 1.6 GHz and f_d 50 MHz, with horizontal lines at one year and one million years and vertical lines at the real synchronizer slacks of 561.96 and 578.42 ps
MTBF grows exponentially with resolution time; tau and window values are illustrative, the slacks are real OpenSTA results.

Why STA cannot “time” an asynchronous crossing

Static timing analysis assumes it knows the phase relationship between the launch and capture clocks (STA overview). For two clocks defined with create_clock on different ports, the tool assumes they both start at time 0 and looks for the tightest pair of edges over the common period. With 1000 ps and 625 ps, the closest pair in a 5000 ps window is a launch at 3000 ps and a capture at 3125 ps. OpenSTA reported exactly that for src_a → sync1:

3000.00 3000.00   clock clka (rise edge)
  34.63 3034.63 ^ src_a/QN (DFFHQNx1_ASAP7_75t_R)
        3034.63   data arrival time
3125.00 3125.00   clock clkb (rise edge)
 -13.65 3111.35   library setup time
          76.72   slack (MET)

The number is real, but the check is fiction. On silicon the two clocks drift against each other, so sooner or later the edges are 0 ps apart and the first flop goes metastable whatever the slack says. If the logic were deeper, the same check would show a “violation” that synthesis and placement would then try to fix by upsizing and buffering, which wastes area and power on a path that cannot be fixed by timing.

Edge diagram of a 1000 ps clock and a 625 ps clock over 5000 ps, showing the tool picking the launch edge at 3000 ps and capture edge at 3125 ps, with real OpenSTA results: slack +76.72 ps with no CDC constraint, and no paths found after set_clock_groups -asynchronous while the sync1 to sync2 path keeps +578.42 ps slack
Real OpenSTA run: on unrelated clocks STA times an arbitrary 3000 to 3125 ps edge pair, so the slack means nothing.

So the crossing paths are cut from normal timing, and the synchronizer is responsible for correctness. After set_clock_groups -asynchronous -group clka -group clkb, OpenSTA returned No paths found for src_a → sync1, and report_checks -unconstrained showed the path with only an arrival time (34.63 ps). The sync1 → sync2 path inside clkb was still timed with its 578.42 ps slack, which is what we want.

Constraining CDC paths in SDC

There are three tools, and they are not interchangeable (SDC constraints, false and multicycle paths):

  • set_clock_groups -asynchronous cuts every path in both directions between the groups. It is clean and easy to review, but it also cuts paths you might want to bound.
  • set_false_path -from [get_clocks clka] -to ... cuts paths in one direction or to specific endpoints.
  • set_max_delay with the clock latency ignored (-datapath_only in some tools, -ignore_clock_latency in OpenSTA) puts an upper limit on the raw data path delay. AMD’s Vivado constraints guide describes this use: it times the data path while ignoring clock skew. You use it for Gray-coded pointers and handshake data where the bits must arrive within about one destination period of each other.

On our 2-bit Gray pointer, set_max_delay 600 -ignore_clock_latency from the gray_a* clock pins to the gray_b* D pins gave a max_delay check in OpenSTA: required 585.14 ps (600 minus 14.86 ps setup), arrival 31.72 ps, slack 553.42 ps for both bits.

Precedence trap: clock groups silently win

We then added set_clock_groups -asynchronous between clka and clkb and kept the same set_max_delay. OpenSTA reported No paths found for the Gray endpoints, and the unconstrained report showed required time INF. The clock group (like a false path) overrode the max delay, and the bus skew was no longer checked at all. The tool gave no error.

The usual way to avoid this is to keep set_clock_groups for clock pairs with no bounded crossings, and for pairs that have Gray or handshake buses, use set_max_delay on those buses plus targeted set_false_path to the single-bit synchronizer inputs. After any constraint change, check that each bus endpoint still reports a real required time, not INF or “unconstrained”.

# illustrative constraint set for clka -> clkb
set_max_delay 600 -ignore_clock_latency \
    -from [get_pins {gray_a*/CLK}] -to [get_pins {gray_b*/D}]
set_false_path -from [get_clocks clka] -to [get_pins {sync1/D bsync1/D}]

Pick the max delay value from the design: usually no more than one destination period, often less, so that all bits of a Gray word settle before the receiver samples them.

Choosing a crossing scheme

A two-flop synchronizer is right for only one kind of signal. The scheme depends on what crosses.

Decision tree that maps five kinds of crossing signal to a scheme: single-bit level to a two- or three-flop synchronizer, single-cycle pulse to a toggle synchronizer or handshake, counter or pointer to Gray code with per-bit synchronizers, multi-bit data to a handshake, MCP formulation or asynchronous FIFO, and asynchronous reset to a reset synchronizer
Picking the crossing scheme from what crosses the boundary.
  • Single-bit level: a 2-flop synchronizer, or 3 flops at high frequency or poor τ. Cummings’ CDC paper (see References), citing Mark Litterick, gives a “three edge” guideline: keep the input stable for three destination clock edges so it cannot be missed. This matters most when a fast domain sends to a slow one.
  • Pulses: a one-cycle pulse from a fast domain can fall between two slow edges. Convert it to a toggle, synchronize the toggle, and detect the edge on the receiving side, or use a request/acknowledge handshake.
  • Counters and pointers: convert to Gray code first, so only one bit changes per step. Then a per-bit synchronizer can only ever produce the old value or the new one. This is the basis of the asynchronous FIFO.
  • Multi-bit data: never synchronize the bits of a binary bus separately. Hold the data stable, synchronize a single qualifier (valid/enable) and sample the data when the qualifier arrives. For streaming data, use an asynchronous FIFO.
  • Asynchronous reset: assert asynchronously, deassert synchronously through a reset synchronizer, and close the recovery and removal checks on its output (recovery and removal in STA).

Physical design: protecting the synchronizer

Synthesis and place-and-route tools will happily “optimise” a synchronizer unless you stop them. What usually goes wrong:

  • Stages placed far apart. The sync1 → sync2 path has huge slack, so the placer has no reason to keep the flops close, and the router may add buffers. Every picosecond lost is resolution time lost. Group the synchronizer flops with a relative placement constraint, a region, or a library synchronizer cell, and mark them don’t-touch so no buffer is inserted between stages.
  • Clock skew between stages. If sync2‘s clock arrives early relative to sync1, t_r shrinks by the skew. Do not let useful skew or CTS skew balancing target these flops; keep them on the same clock branch (clock tree synthesis).
  • Multi-bit flop banking. Banking a synchronizer flop into a multi-bit flip-flop with unrelated flops can pull it away from its partner stage and change its clock timing. It is common to exclude synchronizers from banking unless the library provides a dedicated multi-stage synchronizer cell.
  • Retiming and duplication. Retiming can move logic between the stages, and fanout duplication can split sync2 into two copies that resolve differently. Exclude synchronizer flops from both.
  • Scan. Synchronizers are usually still scan flops. Scan reordering and scan stitching must not insert anything between the stages functionally (scan chain reordering).
  • Multi-voltage crossings. If the crossing also crosses a voltage domain, the level shifter goes before sync1, never between the stages (level shifters).

After routing, report the sync1 → sync2 slacks with real parasitics and the final clock tree, at the worst τ corner in your MMMC set-up, and use those numbers for the MTBF sign-off.

Debugging CDC problems

A practical order of checks, from constraints down to layout:

Flowchart for debugging a clock domain crossing problem: confirm the clocks are really asynchronous, confirm every endpoint has a synchronizer, check for logic or binary buses before or inside the synchronizer, check that bus skew limits exist and are not overridden by clock groups, check the slack between synchronizer stages after placement, and check MTBF at the worst corner before sign-off
Debug flowchart for CDC and synchronizer problems.
  1. Are the clocks really asynchronous? Clocks derived from the same source through dividers are synchronous and should be timed normally, with generated clocks defined. Cutting them with clock groups hides real violations.
  2. Is every crossing synchronized? STA does not check this; structural CDC tools do. An exception on an unsynchronized path is not a fix.
  3. Logic or binary buses in the crossing? Look for gates between the source flop and sync1, gates between stages, and buses with per-bit synchronizers.
  4. Are bus constraints still active? Look for INF required time or “unconstrained” on Gray and handshake endpoints, especially after someone adds a clock group.
  5. Did placement eat the resolution time? Compare sync1 → sync2 slack post-route with the pre-layout value.
  6. Is MTBF documented at the worst corner? Use characterised τ and T_w and the real slack, and multiply by the number of synchronizers.

Interview questions and answers

Q1. What is metastability?
A state where a flip-flop output stays between valid logic levels for an unbounded time because its input changed inside the setup/hold window. The probability of still being unresolved decays exponentially with time but never reaches zero.

Q2. Why does a two-flop synchronizer work?
It gives the first flop almost a full destination clock period to resolve before the second flop samples it. MTBF grows exponentially with that time, so one period is usually enough to push failures beyond the product’s life.

Q3. Why should there be no logic between the two synchronizer flops?
Logic delay subtracts from resolution time. In our ASAP7 run, three inverters reduced slack from 578.42 ps to 561.96 ps, which divides MTBF by e^(16.46/τ). Logic between stages can also glitch.

Q4. Why can’t you synchronize a binary counter bit by bit?
Several bits change at once, and each bit can resolve on a different edge, so the receiver can see a value that never existed. Gray code changes one bit per step, so the result is always the old or the new value.

Q5. Can STA fix a CDC path?
No. STA picks an arbitrary edge pair for unrelated clocks. The path is cut with clock groups or false paths, or bounded with a datapath-only max delay for buses; correctness comes from the synchronizer design.

Q6. What happens if you use set_clock_groups -asynchronous and set_max_delay on the same crossing?
The clock group takes precedence and the max delay is ignored. We saw this in OpenSTA: the Gray endpoints went from 553.42 ps slack to unconstrained. Use targeted false paths instead.

Q7. When would you use three synchronizer stages?
When the destination frequency is high, τ is poor (low-voltage corners), the number of synchronizers is large, or the reliability target is strict. Each extra stage adds roughly one period of resolution time.

FAQ

Is metastability only an issue for clock domain crossings?
No. Any asynchronous input can cause it: external pins, asynchronous reset release, and signals from analog blocks. The same synchronizer rules apply.

Does metastability show up in gate-level simulation?
Not in a normal way. Simulators usually produce X on a setup/hold violation, or nothing with timing checks off. That is why structural CDC checks and MTBF analysis are needed.

Where do τ and T_w come from?
From dedicated characterisation of the flop or synchronizer cell, which the library provider or the design team does. They are not part of standard Liberty timing tables.

Should I time the reset synchronizer output?
Yes. The released reset is synchronous to the destination clock, so recovery and removal checks apply to the flops it drives.

Summary

  • Metastability is unavoidable when asynchronous signals are sampled; synchronizers make it rare enough.
  • MTBF = e^(t_r/τ) / (T_w × f_c × f_d). It is exponential in resolution time and very sensitive to τ.
  • In our ASAP7 OpenSTA run, the direct synchronizer had 578.42 ps of resolution slack and three inverters between stages cut it to 561.96 ps.
  • STA slack on asynchronous crossings is meaningless (76.72 ps here, from an arbitrary 3000 → 3125 ps edge pair). Cut those paths, and bound bus skew with a datapath-only max delay.
  • set_clock_groups -asynchronous overrides set_max_delay, so check that bus constraints are still active.
  • In layout, keep synchronizer stages adjacent, unbuffered and on the same clock branch, and sign off MTBF with post-route slack at the worst τ corner.

References

  • R. Ginosar, “Metastability and Synchronizers: A Tutorial,” IEEE Design & Test of Computers, vol. 28, no. 5, pp. 23–35, 2011. DOI: 10.1109/MDT.2011.113
  • C. E. Cummings, “Clock Domain Crossing (CDC) Design & Verification Techniques Using SystemVerilog,” SNUG Boston, 2008 (Sunburst Design).
  • AMD, Vivado Design Suite User Guide: Using Constraints (UG903), section “Asynchronous Clock Domain Crossings”: UG903 v2023.1 PDF
  • OpenSTA static timing analyzer, Parallax Software: github.com/parallaxsw/OpenSTA
  • L. T. Clark et al., “ASAP7: A 7-nm finFET predictive process design kit,” Microelectronics Journal, vol. 53, pp. 105–115, 2016. DOI: 10.1016/j.mejo.2016.04.006
Admin
Admin

Leave a Reply