You finished the last lesson knowing exactly where the danger lives — that window around a clock edge where an incoming signal has to sit still, and doesn't. So the fix seems obvious: catch the signal with a flip-flop on the receiving side, and let it settle. Problem solved, right?
Wrong — and this exact mistake has shipped in real silicon. A single synchronizing flip-flop feels like a fix. It is one of the most common, most dangerous habits in digital design. This lesson shows you precisely why it fails — and the reason is sharper and stranger than "sometimes you get the wrong bit."
Single-flop synchronization means exactly what it sounds like: you drop one flip-flop into the receiving clock domain, let it capture the incoming signal, and wire its output straight into the rest of your logic. No second stage. No buffer. Just one flop standing between chaos and your circuit.
It's an easy trap to fall into. The flop does catch the signal. Most of the time its output looks perfectly clean. It'll pass a quick simulation. It might even survive weeks on the bench. Which is exactly what makes it dangerous — it looks like it works.
Here's the assumption hiding underneath the single-flop fix: "sure, it might go metastable, but it'll settle down eventually — long before anyone needs the value." That assumption is the whole bug.
Metastability resolves at a random speed. Most of the time, yes, it settles in a tiny fraction of a clock cycle — far faster than you'd ever notice. But there's no law of physics guaranteeing that. Occasionally, rarely, it takes meaningfully longer. And a single flop gives that settling process exactly zero extra time before its output gets used. Whatever voltage is sitting on that output the instant the next stage reads it — resolved or not — is what propagates.
"Usually fine" is not the same as "guaranteed." A bug that shows up once every few million cycles is still a bug — it just waits for the worst possible moment to appear, usually in a customer's hands, not on your bench.
Here's the part most people get wrong about single-flop failures — it's not really about "getting a random bit." It's stranger than that.
A metastable flop output isn't a clean 0 or a clean 1. It's an invalid, in-between voltage — neither rail. Every gate downstream that reads it has its own individual switching threshold, its own tiny manufacturing variation, its own noise margin. Feed that same in-between voltage to two different gates, and there's no guarantee they interpret it the same way.
If a still-settling output fans out to multiple gates, one gate can read a 1 while another reads a 0 — from the exact same wire, in the exact same clock cycle. That's not a wrong value. That's two parts of your chip disagreeing about reality.
The standard fix is a two-flop synchronizer — and it's worth being precise about why it works, because it's not what most people assume.
The second flop does not stop the first flop from going metastable. Nothing can prevent that — it's physics, not a design flaw you can engineer away. What the second flop buys you is time: a full extra clock period between the moment the first flop might go metastable and the moment anything actually reads its value.
FF_SYNC's output fans out immediately. If it's still settling, every downstream gate sees whatever voltage happens to be there — right now, no time to recover.
FF_SYNC1 may go metastable — but only FF_SYNC2 reads it, one full clock period later. By then it has almost certainly resolved. Only FF_SYNC2's clean output fans out.
"Almost certainly" isn't hand-waving — it's a real, calculable probability called MTBF (Mean Time Between Failures), and it's the whole subject of the next module. For now, the concept is what matters: buy time, then let only the settled value fan out.
Time to see it happen. In the lab below, FF_SYNC fans out to two gates — watch how often they actually agree. 👇
FF_SYNC is a single synchronizer flop. Its output fans out to two separate gates, Gate X and Gate Y. Adjust the clocks and click Run — watch what Gate X and Gate Y each end up reading when FF_SYNC goes metastable.
Below is a single-flop synchronizer whose output fans out to two separate always-blocks — a rough stand-in for
two independent downstream gates. Paste both files into our
Verilog Simulator and compare
gate_x and gate_y in the waveform.
Heads up: since Icarus (and RTL simulators generally) don't model real analog metastability, gate_x and gate_y will always agree here — both are driven from the same resolved simulation value. What this code does show clearly is the structure of the mistake: one flop, output fanning out with nothing buffering it. The actual disagreement you watched in the lab above is what happens to that same structure in real silicon.
// ------------------------------------------------------------
// single_flop_sync.v
// A single synchronizer flop whose output fans out to two
// separate destinations -- the unsafe structure this lesson
// covers. (Fixed properly with a 2-flop synchronizer later.)
// ------------------------------------------------------------
module single_flop_sync (
input clk_a,
input clk_b,
input rst,
output reg data_a, // toggles inside Domain A
output reg ff_sync, // the single synchronizer flop
output reg gate_x, // one downstream destination
output reg gate_y // another downstream destination
);
// Domain A: source flip-flop
always @(posedge clk_a or posedge rst) begin
if (rst)
data_a <= 1'b0;
else
data_a <= ~data_a;
end
// Domain B: the single synchronizer flop -- no second stage!
always @(posedge clk_b or posedge rst) begin
if (rst)
ff_sync <= 1'b0;
else
ff_sync <= data_a;
end
// Two "gates" both fed directly from ff_sync's output.
// In real silicon, if ff_sync is still metastable here,
// these two paths can latch different values.
always @(posedge clk_b or posedge rst) begin
if (rst)
gate_x <= 1'b0;
else
gate_x <= ff_sync;
end
always @(posedge clk_b or posedge rst) begin
if (rst)
gate_y <= 1'b0;
else
gate_y <= ff_sync;
end
endmodule
// ------------------------------------------------------------
// tb.v -- drives two unrelated clocks and dumps waves
// ------------------------------------------------------------
module tb;
reg clk_a = 0;
reg clk_b = 0;
reg rst = 1;
wire data_a, ff_sync, gate_x, gate_y;
single_flop_sync dut (
.clk_a (clk_a),
.clk_b (clk_b),
.rst (rst),
.data_a (data_a),
.ff_sync (ff_sync),
.gate_x (gate_x),
.gate_y (gate_y)
);
// Clock A: 10ns period
always #5 clk_a = ~clk_a;
// Clock B: 13ns period -- deliberately unrelated to Clock A
always #6.5 clk_b = ~clk_b;
initial begin
$dumpfile("dump.vcd");
$dumpvars(0, tb);
rst = 1;
#20 rst = 0;
#500 $finish;
end
endmodule