Electronics · Digital logic and timing
Cross a clock boundary and account for metastability
A state machine can have a complete truth table and still receive a request at an awkward instant. Its input may come from an unrelated clock or the outside world. Crossing that boundary requires both a physical sampling argument and a contract for what information must arrive.
Lesson preparation and course links
Use the logic/timing introduction and the complete event-sequence lesson. Setup/hold budgets, old-value sampling, statistical means, binary/Gray examples and the handshake contract are explained here. No HDL tool or hardware is required.
Back to the Electronics chapterAfter reading, you can
Check a stated timing budget, identify what changes across an asynchronous boundary, and choose a transfer contract for a persistent bit, an event or a coherent word. Calculate conditional metastability-risk ratios without treating them as a delivery deadline.
First check the timing relationship you actually have
A clock domain is a set of stored values governed by a specified clock relationship. Setup time requires data to be stable before capture; hold time requires it to remain stable afterward. For this exercise, use a separate 100 MHz same-clock path with period T=10 ns and explicitly zero clock skew. These are invented delay values, not a device timing report.
The maximum data arrival is clock-to-output plus logic plus route: 0.8+5.0+0.7=6.5 ns. The latest permitted arrival is 10−0.5−0.2=9.3 ns after the launch edge, allowing setup time and setup uncertainty. Setup slack is 9.3−6.5=+2.8 ns.
The minimum data arrival is 0.15+0.10+0.05=0.30 ns. Hold plus hold uncertainty requires 0.10+0.05=0.15 ns. Hold slack is 0.30−0.15=+0.15 ns. Positive slack means this declared budget meets its stated requirements; it is not a completed implementation check.
An unrelated source clock has no guaranteed edge phase in that budget. Its data can change inside the destination aperture even though the same-clock arithmetic passed. Do not reuse a positive synchronous slack number as proof that an asynchronous crossing is safe.
| Contribution | Maximum/setup path | Minimum/hold path |
|---|---|---|
| Clock-to-output | 0.80 | 0.15 |
| Combinational logic | 5.00 | 0.10 |
| Routing | 0.70 | 0.05 |
| Data arrival total | 6.50 | 0.30 |
| Requirement | Arrive by 9.30 | Remain unchanged through 0.15 |
| Slack | +2.80 | +0.15 |
Treat metastability as a timing risk with a statistical tail
A flip-flop sampling an asynchronous transition can enter a metastable condition: its output may take an unpredictable time to resolve to a valid state. The problem is not merely choosing the old or new Boolean value. Different consumers can observe inconsistent results if an unresolved or late transition reaches them.
A synchronizer provides time for resolution before functional use. More usable settling time reduces the residual probability under the applicable device model. It does not guarantee that every event resolves before a universal finite deadline. A digital simulation with clean 0/1 waveforms cannot establish that analog probability tail.
Keep three questions separate: how likely is residual metastability to disturb use; can the transfer mechanism miss or merge an event; and does the receiver obtain one coherent value? A strong answer to one does not answer the others. This lesson uses paper schedules and checked arithmetic; no analog, HDL, timing-tool or hardware run is asserted.
Use a persistent single-bit level with the right topology
The conceptual chain is a source register when available, then FF1 and FF2 clocked by the destination. FF1 is the potentially metastable stage; FF2 receives its value after an interstage settling interval. Use FF2 as the functional synchronized level, with no functional fanout from FF1 and no combinational logic between stages.
Physical implementation matters: recognized synchronizer structure/attributes and controlled interstage timing preserve usable settling time. Two stages are an illustration, not an automatic reliability qualification for every device, clock and operating condition.
The input must satisfy a persistence/protocol contract. For a concrete vendor example, AMD XPM_CDC_SINGLE requires the input to be sampled at least twice by the destination clock. Its configurable stage count and optional source register must be chosen from that macro’s documentation; our generic drawing is not its default configuration or a substitute for those requirements.
A synchronizer is not a contact debouncer. If a raw button produces many transitions, a chain can transfer many transitions. Conditioning, event meaning and electrical pin requirements remain separate design decisions.
Distinguish output propagation from consumer capture
For the following ideal schedule, the destination period is 20 ns with edges at 0, 20, 40, 60 ns; FF1, FF2 and a consumer register start at 0. A persistent input becomes 1 at 5 ns, away from the relevant aperture. Assume correct sampling, no unresolved metastability and satisfied path timing. Propagation delays are omitted only for this schedule.
At 20 ns FF1 captures 1, while FF2 captures the old FF1=0. At 40 ns FF2 captures 1, but a consumer register at that same edge still captures old FF2=0. FF2 changes after 40 ns; the consumer can ordinarily capture it at 60 ns. The nominal input-to-FF2 delay is 35 ns and input-to-consumer delay 55 ns, plus the omitted propagation effects.
If the input instead changes at 15 ns under the same assumptions, FF2 still changes after 40 ns and the consumer captures at 60 ns: nominal 25 ns and 45 ns latency. An ordinary captured change away from the aperture reaches FF2 roughly one to two destination periods later. That conditional range is not a worst-case metastability-resolution bound.
Near a sampling aperture, capture may select the old or new value, and metastability can cause further delay with no absolute finite guarantee. Record the actual endpoint and assumptions whenever describing “two cycles”; the synchronized output and a downstream registered action are different endpoints.
| Edge ns | FF1 after edge | FF2 after edge | Consumer after edge |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 20 | 1 | 0 | 0 |
| 40 | 1 | 1 | 0 |
| 60 | 1 | 1 | 1 |
A short event can vanish without metastability
Now replace the persistent level with a pulse high from 5 ns until 13 ns. Destination edges at 0, 20, 40 and 60 ns all see 0. FF1 never samples the high state, so later stages have no event to propagate. Adding another synchronizer register cannot recover information the first stage never captured.
Event transfer needs an explicit mechanism and rate contract: for example a qualified pulse-transfer circuit, a toggle with bounded event spacing, an acknowledged handshake, or an asynchronous FIFO when buffering is required. A FIFO is an ordered storage queue with its own qualified crossing design.
A toggle is not an unlimited event queue. If two unseen events toggle 0→1 and then 1→0 before the receiver samples, the receiver can see the original 0 and lose both. Define event spacing, acknowledgement/backpressure, reset and whether every event must be preserved before selecting the mechanism.
Calculate a conditional risk ratio and keep its units
Use the illustrative statistical form MTBF=exp(Tsettle/τmeta)/(W·fCLK·fDATA). MTBF is mean time between failures in that model. Tsettle is usable settling time, τmeta a characterized resolution time constant, and W a capture-window coefficient; all three use seconds. fCLK is destination cycles/second and fDATA asynchronous transitions/second. The result has units of seconds. The applicable inverse-rate form assumes the relevant asynchronous statistical relationship, not arbitrary correlated/adversarial edge alignment.
Do not assign invented coefficients to a real part. For a ratio exercise only, suppose τmeta=50 ps and usable settling time increases by 200 ps. With coefficients and both rates fixed, the MTBF multiplier is exp(200/50)=exp(4)≈54.598. No absolute device MTBF is calculated.
If the clock frequency also doubles while usable settling time really remains fixed, the combined multiplier is 54.598/2≈27.299. In a real faster design, the shorter period can reduce settling time as well, so holding it fixed needs evidence. A tenfold increase in data-transition rate divides MTBF by 10 with everything else fixed. A pulse can contribute two transitions; event count is not automatically the fDATA value.
MTBF is a statistical mean, not an expiry date, a maximum resolution time or a guarantee of no failure. The historical XAPP094 supports the model’s conditional exponential/inverse-rate structure; its old device measurements and frequency assurances are not contemporary product guarantees.
| Change from the same reference case | MTBF multiplier |
|---|---|
| +200 ps settling; all else fixed | exp(4)≈54.598 |
| Same settling improvement and doubled clock rate | exp(4)/2≈27.299 |
| Tenfold data-transition rate only | 0.1 |
Include all chains and the real implementation conditions
For an additional supplied statistical example, suppose 100 independent stationary chain failure processes each have MTBF 10^9 hours, and no other failure mechanism is counted. Each rate is 1/10^9 per hour; the sum is 100/10^9, so the aggregate MTBF is 10^7 hours. The assumed individual figure is not a measurement or vendor report.
Additionally assume Poisson failure events: independent occurrences at a constant average rate. Under that conditional model, the probability of at least one counted failure during 8760 hours is 1−exp(−8760/10^7)≈0.000875616, or 0.08756%. Multiplying “good” individual chains does not keep the same system-level MTBF. This calculation also leaves protocol loss, reset defects and other product failures outside the model.
For a real estimate, record device/family, implementation, voltage/temperature and characterization validity; recognized chain topology; actual settling slack; clock and transition rates; every relevant chain/endpoint; and mission/reliability criteria. An undefined or missing report is not infinite reliability.
AMD’s report_synchronizer_mtbf documentation illustrates those implementation inputs and its own device-family scope. The cited command supports UltraScale devices and excludes 7 series; it was not run here. Attributes or a report name alone do not qualify a crossing.
A coherent word needs more than independent bit chains
Suppose a binary counter changes from 0111 (7) to 1000 (8). Several bits change. If independent bit chains capture different source epochs, the received word can be 0000 (0), even though each received bit is a valid settled Boolean level. That word is neither source value; bit-level settling does not ensure word coherence.
For an adjacent-count example, Gray(7)=0100 and Gray(8)=1100 differ in one bit. Such a progression can support a properly constrained count/pointer crossing. It does not transfer arbitrary payloads or ensure that every intermediate count/event is observed.
Use the selected Gray mechanism’s source registration, allowed progression and sampling rules. Physical skew and maximum-delay constraints still matter: logical one-bit changes at the source do not authorize arbitrary wire delays that mix different successive updates at the receiver. For a general payload, use a coherent transfer protocol or qualified asynchronous FIFO.
Make payload stability, consumption and reset explicit
The following conceptual return-to-zero handshake permits one outstanding payload. Register and settle source data before asserting request; hold that payload through the complete acknowledged cycle. Synchronize request into the receiver and acknowledgement back into the source with qualified control crossings.
The receiver captures exactly once after accepting synchronized request and satisfying the bundled-data timing conditions, then acknowledges. It does not capture a new word on every cycle that request remains high. The source waits for synchronized acknowledgement, drops request, and conservatively holds payload until synchronized acknowledgement returns low.
Data wires must meet bounded arrival/skew/setup/hold requirements at the chosen capture. Eventually holding data stable cannot fix an arbitrarily slow wire. Clock progress and receiver acknowledgement are required for completion, so latency is variable. Do not start another transfer before the full cycle completes.
Both domains must agree on an idle request/acknowledgement state before new traffic. Reset aborts an in-flight transfer only under an explicit recovery contract; one endpoint independently resetting can create a lost or phantom event. Specify abort/restart or epoch handling, reset release and clock availability for the chosen implementation.
| Phase | Request | Acknowledgement | Source obligation | Receiver obligation |
|---|---|---|---|---|
| 0 | 0 | 0 | idle; prior full transfer complete | not valid |
| 1 | 1 | 0 | payload registered/stable before request; hold it | wait for synchronized request and bundled-data timing |
| 2 | 1 | 1 | continue holding payload until synchronized acknowledgement | capture once and acknowledge; do not recapture each high cycle |
| 3 | 0 | 1 | drop request after acknowledgement; keep payload stable for this conservative contract | wait for synchronized request low |
| 4 | 0 | 0 | wait for synchronized acknowledgement low, then release/change payload and begin next transfer | ready after full return-to-zero handshake |
Repair a request interface without confusing three problems
A designer proposes four independent two-register chains for a four-bit event payload and quotes the +2.8 ns synchronous setup slack. First reject the timing inference: an unrelated source clock has no guaranteed phase relationship in that same-clock budget.
Second test event delivery. The 5–13 ns pulse is never high at the 20 ns destination sampling edges. More downstream stages do not make it visible. Require a valid persistence/event protocol and rate/reset contract.
Third test coherence. During 0111→1000, independently captured bits can form 0000. Use an appropriate Gray count/pointer contract or a coherent handshake/FIFO for a general word. For the conservative handshake, hold registered data through the full cycle and qualify its arrival at the one receiver capture.
Finally evaluate residual metastability separately using characterized implementation data and realistic rates. The invented 200 ps / 50 ps ratio shows exponential sensitivity, not zero risk, a device qualification or an exact cross-domain delivery deadline.
Try the reasoning
Calculate setup and hold slack for the declared same-clock budget.
Show the answer and reasoning
Maximum arrival=0.8+5.0+0.7=6.5 ns; required latest arrival=10−0.5−0.2=9.3 ns; setup slack=+2.8 ns. Minimum arrival=0.15+0.10+0.05=0.30 ns; hold requirement=0.10+0.05=0.15 ns; hold slack=+0.15 ns. These results assume zero skew and the stated same-clock relationship.
Does that positive setup slack qualify an unrelated source clock?
Show the answer and reasoning
No. An asynchronous transition has no guaranteed phase relative to the destination aperture. The same-clock budget does not apply across that boundary; a qualified crossing mechanism and its contract are needed.
For a persistent input change at 5 ns, why does FF2 change after 40 ns but the consumer register capture at 60 ns?
Show the answer and reasoning
FF1 samples 1 at 20 ns. FF2 samples old FF1 and changes after 40 ns; the consumer at 40 ns still samples old FF2=0. Its next ordinary capture is 60 ns. The 35/55 ns nominal delays omit propagation and assume no aperture problem or unresolved metastability.
Can a third synchronizer stage guarantee capture of the pulse high only from 5 to 13 ns?
Show the answer and reasoning
No. Destination edges 0, 20, 40 ns never sample it high at FF1. Later stages cannot recover a missed input event. Event delivery needs its own persistence/spacing/handshake or buffered-transfer contract.
With the invented 50 ps time constant, what does 200 ps additional settling do to MTBF if everything else is fixed? What if clock rate also doubles?
Show the answer and reasoning
The conditional multiplier is exp(200/50)=exp(4)≈54.598. With doubled clock frequency and genuinely unchanged settling, divide by 2: ≈27.299. Real faster timing may change settling as well. Neither result gives zero failure probability or an absolute device MTBF.
For 100 supplied independent chains each with MTBF 10^9 hours, compute aggregate MTBF and the conditional 8760-hour failure probability.
Show the answer and reasoning
Summed rate=100/10^9 per hour, so MTBF=10^7 hours. Under the stated stationary Poisson model, 1−exp(−8760/10^7)≈0.000875616, or 0.08756%. The individual reliability is an assumption, and uncounted mechanisms are outside this calculation.
Why can 0111→1000 arrive as 0000 with independent bit synchronizers?
Show the answer and reasoning
Different bits can represent different source epochs. Every received bit may be electrically valid while the assembled word is neither 7 nor 8. Word coherence requires an appropriate Gray progression or a coherent transfer protocol with physical timing conditions.
Do Gray(7)=0100 and Gray(8)=1100 make an arbitrary payload transfer lossless?
Show the answer and reasoning
No. They illustrate a one-bit-changing adjacent progression. Allowed source changes, registration, sampling and physical skew/delay conditions still apply. Arbitrary payloads and guaranteed delivery of every event need another appropriate contract.
When may the source change data in the conservative handshake here?
Show the answer and reasoning
After the receiver has captured once and acknowledged, the source has dropped request, and synchronized acknowledgement has returned low to complete the cycle. Until then it holds data stable. The bundled data must also meet the chosen receiver capture timing.
Is an undefined MTBF report, a clean digital simulation or one endpoint’s reset proof that the crossing is reliable?
Show the answer and reasoning
No. An undefined report lacks a valid estimate, digital 0/1 simulation cannot measure the analog metastability tail, and independent reset can create lost/phantom transfers. Use real implementation/rate evidence plus separate protocol, coherent-word and reset-recovery verification.
What to carry forward
Qualify the timing relationship, information contract and residual-risk model separately. A synchronizer reduces a statistical sampling risk; persistent levels, events and coherent words impose different requirements, and registered consumption adds its own latency.
References
Sources supporting this lesson’s explanations and examples.