3.4.14 · D2Sequential Circuits

Visual walkthrough — Clock domain crossing

1,825 words8 min readBack to topic

We only need one idea you may not have met: a flip-flop can get "stuck on a hilltop." We build everything else from that. Prerequisites worth a peek: Metastability, Flip-flops and setup-hold time.


Step 1 — The hilltop: why a flip-flop can get stuck

WHAT. A flip-flop stores one bit. Physically it is two "amplifiers" wired in a loop, each shoving the other harder toward whichever side it leans. Think of a landscape with two valleys — one is logic 0, the other logic 1 — and a hilltop in between.

WHY. A normal write drops the "ball" firmly into one valley. But if the input changes right during the capture window (which is unavoidable when two clocks are unrelated — see Synchronous vs asynchronous circuits), the ball can land exactly on the peak. That balanced-on-the-peak state is metastability: an output voltage that is neither 0 nor 1.

PICTURE. The red ball sits on the peak. It will roll off — but we cannot predict when or which way.

Figure — Clock domain crossing

Step 2 — The push grows in proportion to itself

WHAT. Ask: how fast does the ball roll? Call its speed (the rate that the imbalance changes each second — that is all means: "change per unit time").

WHY this tool. On a hilltop, the steeper you already are, the harder gravity pulls — the further off-center the ball is, the harder the two amplifiers push it further off. So the speed of leaving is proportional to how far you have already left. Written down:

  • — the ball's outward speed right now.
  • — how far it has already drifted (big ⇒ big push).
  • (tau) — the regeneration time constant: a fixed number set by the transistors. Small = strong feedback = ball escapes fast. We divide by so the units work out (per second).

WHY not a plain constant speed? A constant push would give a straight-line escape. But feedback feeds on itself, so the push accelerates. That "growth feeds on itself" is exactly what produces an exponential — the next step.

PICTURE. Two arrows on the hill: a tiny arrow near the top (slow escape), a long arrow further down (fast escape). The push scales with distance.

Figure — Clock domain crossing

Step 3 — Solving it: the exponential appears

WHAT. We solve "speed proportional to position" to get the actual path over time.

WHY. The one function whose rate of change equals itself (up to the constant ) is the exponential . So the solution is:

  • — the imbalance at the moment metastability began (). Small = ball almost perfectly balanced = long wait.
  • — after each chunk of time , multiplies by . It explodes away from the peak.

Check it makes sense: at , , so ✓. As grows, races toward a valley ✓.

PICTURE. A curve of vs time: flat and lazy near the top, then whipping upward — the runaway of positive feedback.

Figure — Clock domain crossing

Step 4 — "Am I done yet?" turns time into probability

WHAT. The output counts as resolved when reaches a full logic level . We wait a fixed settling time and ask: is the ball still on the peak? It is still unresolved if, after , has not yet reached :

WHY probability? We do not know — it depends on the exact microscopic instant the clock edge landed, which is essentially random. Rearranging, "unresolved" means the starting imbalance was tiny:

If we treat as spread out roughly uniformly over a small window, then the chance falls below that shrinking threshold is proportional to the threshold itself:

  • The minus sign flipped in: waiting longer ( up) makes the survival threshold smaller, so being stuck gets exponentially rarer.
  • — settling time measured in units of the flop's own time constant. This dimensionless ratio is the whole ballgame.

PICTURE. A flat band of possible values; a red threshold line at . As grows the red line slides down and the "still stuck" sliver shrinks.

Figure — Clock domain crossing

Step 5 — How often do we even step on the peak?

WHAT. A failure needs two things: (1) we enter metastability, and (2) we fail to escape in time . Step 4 gave part (2). Now part (1): how many dangerous edges happen per second?

WHY. You can only get stuck when a source-data change lands inside the tiny capture window. That happens more often when:

  • the sampling clock ticks faster → more edges → factor ,
  • the data toggles faster → more chances to land badly → factor .

So the rate of entering metastability is:

  • — how many times per second the destination flop samples.
  • — how many times per second the async input actually changes.

PICTURE. Two tick-tracks (clock vs data) at different tempos; red marks flag the moments a data change collides with a clock edge — more ticks ⇒ more collisions.

Figure — Clock domain crossing

Step 6 — Multiply, invert, and the formula is born

WHAT. Failure rate = (how often we step on the peak) × (chance we're still stuck after ):

Here is the measured constant that soaks up all the messy prefactors from Step 4 (the metastability "aperture," in picoseconds).

WHY invert? "Mean time between failures" is just one divided by "failures per second." Flip it:

  • on top — the hero. Every extra unit of settling multiplies safety.
  • on the bottom — faster/looser designs fail more often.

This is precisely the parent's boxed result — now every symbol is earned.

PICTURE. MTBF vs on a log axis: a straight rising line (log of an exponential is a line). One extra clock period of jumps you many decades up.

Figure — Clock domain crossing

Step 7 — Cashing it in: why one extra flop is enough

WHAT. The two-flop synchronizer (parent's Fix #1) simply buys settling time: FF1 may go metastable, and we hand it (almost) one full clock period before FF2 samples. So .

WHY it's astonishing. Plug the parent's Example 1 numbers: , , so .

That is vastly longer than the age of the universe ( s). A single flop's worth of waiting, and failure is effectively impossible — because the exponential is that violent.

Recall Edge cases — what if the exponent is small?

If were small (fast clock, big , or zero extra flops), and MTBF collapses to — failures in seconds. That degenerate case is the "no synchronizer" world, and it's exactly why we add the second flop. ::: The exponential must have a real, positive to work; buying that is the entire design move.

PICTURE. Same rising line as Step 6 with two dots: "no sync" ( small, MTBF ≈ seconds) and "two-flop" (, MTBF ≈ s) — a chasm between them.

Figure — Clock domain crossing

The one-picture summary

Figure — Clock domain crossing

From left to right: hilltop (get stuck) → runaway curve (escape) → shrinking sliver (survival chance) → rising MTBF line. One story, four pictures.

Recall Feynman: retell the whole walkthrough in plain words

A flip-flop is a ball that likes to sit in one of two valleys. Sample two unrelated clocks and sometimes you balance the ball on the peak between them — that's metastability. On a peak the ball rolls away faster the further it's already gone, and "faster the further you are" always produces runaway growth, an exponential: . So if we wait a fixed time , the chance the ball is still balanced shrinks exponentially, . We also step onto peaks more often when clocks and data run fast — that's the on the bottom. Failure rate is those two multiplied; flip it over and you get the average time between disasters, MTBF . Because it's exponential, buying just one clock period of waiting (a second flip-flop) pushes failures past the lifetime of the universe. For many bits at once, one ball per bit lands at random times — so use Gray code or Handshake protocols / an Asynchronous FIFO design instead.

Recall Quick self-test

Why is the answer exponential and not linear? ::: Because the escape speed is proportional to the current imbalance () — self-feeding growth is always exponential. Where does come from? ::: They set how often a data change collides with a clock edge, i.e. how often you enter metastability. Why does one extra flop help so much? ::: It buys ~one period of ; the exponential turns that into many orders of magnitude of MTBF.