Async FIFO Verification, Part 2: Bugs That Only Show Up Across Clocks
In short: Cross-clock bugs in an async FIFO often pass a scoreboard, because RTL simulation checks logic, not timing. Catch them with flag assertions (never early, late by at most 3 cycles), a one-bit-per-clock check on what crosses, and at least four clock ratios. In our 14 VCS runs, 3 bug runs were green on the scoreboard, and one bug passed every check we had.
In this part (Part 2 of 3):
- 2 flag rules, and the 3-cycle limit counted edge by edge
- A Gray check placed on the right signal
- 4 clock ratios and 5 planted bugs
- 14 real VCS runs, and a flowchart to name the bug from the log
New here? Start with Part 1: the design, the plan and the starter UVM bench.
Why cross-clock bugs hide from a scoreboard
A scoreboard checks what came out. Cross-clock bugs are about when a flag was allowed to change, and what the other clock saw while a value was moving.
| Question | Scoreboard | Assertions | Static CDC tool |
|---|---|---|---|
| Right data, right order? | Yes | No | No |
| Flag never early, late by at most 3? | No | Yes | No |
| Only Gray values cross? | No | Yes | Yes |
| Synchronizer has 2 flops? | No | No | Yes |
Why it matters: “only about 24 percent of today’s projects can achieve first silicon success” (Harry Foster, Siemens EDA, 2022 Wilson Research Group study). Bugs that pass every test are the ones that cost a respin.
Flag assertions: write the lateness down
A flag can be wrong in two directions. They get two different rules.
| Direction | Rule | Check | Why |
|---|---|---|---|
| Early | Never, not even 1 cycle | ap_no_overflow, ap_no_underflow | Early full loses data. Early empty invents data |
| Late | Allowed, up to 3 cycles | ap_full_late, ap_empty_late | Late only costs a few cycles. But a limit stops a stuck flag passing |

Where the 3 comes from
After a write, the read side needs three rclk edges before rempty can drop:
- Edge 1:
rq1_wptrpicks up the new Gray pointer. - Edge 2:
rq2_wptrcopies it, and the empty compare sees the write. - Edge 3: the
remptyregister drops.
wfull is the same, counted in wclk edges.

Measured, not just counted: the bench prints the worst lateness it sees. On the clean design VCS printed 3 for both flags, at every clock ratio.
The assertions
They live in their own module, bound into the design with bind. From there they can read the internal binary pointers and work out the true fill level, which only simulation can do.
localparam int LATE = 3; // 2 synchronizer flops + 1 flag register
logic [ASIZE:0] level;
assign level = wbin - rbin; // true fill level, 0 to DEPTH
// Never early: strict, no window
ap_no_overflow: assert property (@(posedge wclk) disable iff (!wrst_n)
(winc && !wfull) |-> (level != DEPTH));
ap_no_underflow: assert property (@(posedge rclk) disable iff (!rrst_n)
(rinc && !rempty) |-> (level != 0));
// Late is allowed, by at most LATE cycles of the flag's own clock
ap_full_late: assert property (@(posedge wclk) disable iff (!wrst_n)
(wfull && level != DEPTH) |-> ##[1:LATE] !wfull);
ap_empty_late: assert property (@(posedge rclk) disable iff (!rrst_n)
(rempty && level != 0) |-> ##[1:LATE] !rempty);
bind tav_async_fifo tav_fifo_sva #(.ASIZE(ASIZE)) u_sva (.*);
Two tips from the runs:
- The extra pointer bit makes
wbin - rbinwrap cleanly, so the level is always 0 to 16. - Print only the first 3 failures of each check. VCS also prints its own line per failure, and a broken FIFO fails thousands of times.
The Gray check: watch what actually crosses
Only Gray pointers should cross, because a Gray count changes one bit per step. A late sample is then still a real value.

The check is one line per side:
// The value entering each synchronizer changes at most one bit per clock
ap_gray_w: assert property (@(posedge wclk) disable iff (!wrst_n)
$onehot0(w_cross ^ $past(w_cross)));
ap_gray_r: assert property (@(posedge rclk) disable iff (!rrst_n)
$onehot0(r_cross ^ $past(r_cross)));
Put it on the right signal:
w_cross= the exact wire into the first synchronizer flop.- Not
wptr. If the binary pointer is wired in by mistake,wptris still a perfect Gray count, so a check on it stays green. - Analogy: check the note in the tray, not the note on the writer’s desk.

The flag checks sit on each side, the Gray checks sit on the crossings, and the one thing no simulation check can see sits underneath all of them.
Four clock ratios, four different tests
Each ratio pushes the FIFO into a different corner. A bug that hides at one ratio shows up at another.
| Ratio | wclk / rclk (ns) | What it stresses | Max fill level (VCS) |
|---|---|---|---|
| R1 slow reader | 10 / 17 | Full is hit often | 16 |
| R2 fast reader | 23 / 10 | Empty is hit often, full never | 6 |
| R3 near-equal | 10 / 11 | Edges drift slowly past each other | 16 |
| R4 very slow reader | 10 / 40 | Full nearly all the time, empty rarely | 16 |
Clocks are made in the top module, with periods from +WCLK_NS and +RCLK_NS. rclk starts at an odd offset, so the edges drift.
The five planted bugs
Numbering carries on from Part 1’s bugs 1 and 2. Four bugs are in the design and one is in the bench, because a wrong check costs you days too.
| +BUG | Where | What’s wrong | Why it’s easy to miss |
|---|---|---|---|
| 3 | Design | The binary pointers cross instead of Gray. The compares are changed to match, so the design is consistent | Data stays correct in simulation |
| 4 | Design | The full compare inverts only the top bit: the binary rule used on Gray pointers | It’s one character away from the right line |
| 5 | Design | rempty is computed from the current read pointer instead of the next one | It looks like a harmless style choice |
| 6 | Bench | A check that demands wfull drop one wclk after space opens | It reads like a sensible spec |
| 7 | Design | One-flop synchronizers instead of two | It makes the FIFO faster |
Bug 4: one character from correct
In Gray code, “one lap ahead” means the top two bits are inverted. Inverting only the top bit is the binary rule.

Where the pointers are decides what bug 4 does: sometimes full comes early, sometimes far too late.
// Correct: Gray rule, top two bits inverted
wfull_val = (wgraynext == {~wq2_rptr[ASIZE:ASIZE-1], wq2_rptr[ASIZE-2:0]});
// Bug 4: binary rule on Gray pointers, top bit only
wfull_val = (wgraynext == {~wq2_rptr[ASIZE], wq2_rptr[ASIZE-1:0]});
Bug 5: one read late

A fast reader asks on that cycle often. A slow reader almost never does, which is why R4 was clean.
rempty_val = (rgraynext == rq2_wptr); // correct: the pointer after this read
rempty_val = (rptr == rq2_wptr); // bug 5: the pointer before this read
What VCS printed: 14 runs
VCS X-2025.06-SP1, UVM 1.2, same seed, 300 writes per run. Clean runs first, to prove the checks stay quiet on a correct design: 0 errors at every ratio.
| Run | Bug | Ratio | Scoreboard | Words stuck | Lateness w / r | Assertion failures |
|---|---|---|---|---|---|---|
| 1 to 4 | none | all 4 | 0 errors | 0 | 3 / 3 (0 / 3 at R2) | none |
| 5 | 3 binary crossing | R1 | 0 errors | 0 | 3 / 3 | Gray w 150, Gray r 150 |
| 6 | 3 binary crossing | R2 | 0 errors | 0 | 0 / 3 | Gray w 150, Gray r 150 |
| 7 | 4 wrong full compare | R1 | 201 mismatches | 96 | 15 / 3 | overflow 6, underflow 4, full late 29 |
| 8 | 4 wrong full compare | R2 | 0 errors | 0 | 6 / 3 | full late 12 |
| 9 | 4 wrong full compare | R4 | 139 mismatches | 160 | 16 / 3 | overflow 6, underflow 1, full late 64 |
| 10 | 5 empty one read late | R2 | 678 underflows, 136 mismatches | 0 | 3 / 3 | underflow 25, overflow 3 |
| 11 | 5 empty one read late | R4 | 0 errors | 0 | 3 / 3 | none |
| 12 | 6 strict bench check | R1 | 0 errors | 0 | 3 / 3 | strict full 152 |
| 13 | 6 strict bench check | R2 | 0 errors | 0 | 0 / 3 | none |
| 14 | 7 one-flop sync | R1 | 0 errors | 0 | 2 / 2 | none |
The headline: 3 of the 10 bug runs (5, 6 and 8) were green on the scoreboard. Only an assertion caught them. Run 14 was green everywhere.

What each bug teaches
| Bug | Loud at | Quiet at | The lesson |
|---|---|---|---|
| 3 binary crossing | never | every ratio (scoreboard) | Gray check fired 150 times per side: one for every step where binary flips 2+ bits |
| 4 wrong full compare | R1, R4: 139 to 201 bad reads, 96 to 160 words stuck | R2: only ap_full_late (6 cycles late) | Scoreboard saw fill levels of 120 and 174 in a 16-deep FIFO. Impossible, so it’s the full logic |
| 5 empty one read late | R2: 978 reads for 300 writes | R4: completely clean | The clock ratio decides whether you ever see it |
| 6 strict check | R1: 152 false alarms | R2: silent (no full) | The check was the bug. The design was correct |
| 7 one-flop sync | never | every check | Only lateness changed, 3 to 2. See below |
Fix the first failure first. In run 10, overflow fired too. That was a knock-on effect: once the read pointer passed the write pointer, the true level wrapped.
Name the bug from the log
Try this on your own runs before you open the waveform.

Bug 7: a green run that’s still unsafe
Run 14 by the numbers: 0 scoreboard errors, 0 assertion failures, full and empty both reached. Every dashboard says done.
On silicon it’s unsafe. With two flops, the first flop gets a whole clock cycle to settle before anything reads it. With one, a value that’s still settling goes straight into the flag compare.

Simulation can’t see it, because a simulated flop always settles at the clock edge. One flop just looks faster.
The only fingerprint: measured lateness was 2 / 2, not the 3 / 3 of every clean run. That’s why the bench prints lateness as a number. Try adding a cover on “lateness reached 3” as an exercise: it would show a hole for bug 7. (Not in the download yet, and not tested.)
What actually catches it
- A static CDC tool. It reads the structure: which signals cross, and whether each crossing has a proper synchronizer. This is the right tool, and it’s row 9 of the Part 1 plan.
- A design review. Counting flops on every crossing takes minutes, and a reviewer who knows to look will see it.
- CDC-aware simulation, where your flow has it. Some CDC flows can add random extra delay at synchronizer outputs during simulation, so timing uncertainty becomes something a bench can see.
Say it in the review: “Simulation passed, lateness matches two flops, and CDC sign-off comes from the static tool.”
Run it yourself
- Download
async_fifo_p2.sv(design, assertions, UVM bench and top in one file). - On EDA Playground pick Synopsys VCS and UVM 1.2, and paste the file.
- Put each run’s options in Run Options, like this:
vcs -full64 -sverilog -ntb_opts uvm-1.2 async_fifo_p2.sv -R +BUG=0 +WCLK_NS=10 +RCLK_NS=17
- Run the 4 clean ratios first (
+BUG=0), then each bug at R1 and R2. - Read only the
[COV]and[SVA]lines and name the bug with the flowchart above. Then check the table.
Check: every log starts with async_fifo_p2: planted bug = N, wclk = .. ns, rclk = .. ns. If N shows 0, add +define+BUG=N to the compile options. All user names use the tav_ prefix, the house style on this site.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
Gray check on wptr, not on what crosses | Bug 3 stays green | Check the synchronizer input (w_cross) |
| One window for both directions | An early flag passes for N cycles, and data is lost | Early: strict. Late: windowed |
| A guessed window | “1 cycle” fails a correct design (bug 6). “10” misses bug 4 at R2 (6 late) | Count your flops, then measure |
| One clock ratio | Bug 4 quiet at R2, bug 5 clean at R4 | Run at least 4 ratios |
| Fixing the second failure first | You chase a knock-on effect | Start from the earliest failure in time |
| Calling a green run CDC-clean | Bug 7 ships | CDC sign-off comes from structure |
How AI helps (and where it doesn’t)
| AI helps with | AI doesn’t help with |
|---|---|
Boilerplate: the bind, counters, “print first 3” action blocks | The window. AI-written checks often demand an exact cycle: that’s bug 6, 152 false alarms |
| A second read of a compare line: “Gray rule or binary rule?” (check it against Cummings) | Bug 7. Nothing that reads a passing log can see synchronizer depth |
More in AI in ASIC verification and the AI-written vs hand-written UVM testbench experiment.
What’s next in the series
Part 3 (February): reset on one side at a time, covergroups that prove every fill level and every pointer wrap, and a sign-off checklist you can take into a review.
FAQ
How late can an async FIFO’s full or empty flag be? With two-flop synchronizers and a registered flag, 3 cycles of the flag’s own clock after the other side moves its pointer. In our VCS runs the measured worst case was exactly 3 at every clock ratio.
Can a flag ever be early? Not in a correct design. An early full flag lets a write overwrite unread data, and an early empty flag lets a read take data that isn’t there. Check that direction with no window.
Why check $onehot0 on the synchronizer input and not on the Gray pointer? Because the bug is in what crosses. If the binary pointer is wired in by mistake, the Gray pointer itself is still a perfect Gray count, and a check on it stays green.
Why did the scoreboard pass bug 3? In RTL simulation a flop never samples a value halfway through a change, so a binary pointer crosses cleanly every time. The danger only exists on silicon.
How many clock ratios should I run? At least four: a slow reader, a fast reader, near-equal clocks, and a very slow reader. In our runs, bug 4 was quiet at the fast-reader ratio and bug 5 was clean at the very slow one.
Can simulation prove a FIFO is CDC-safe? No. It proves the logic. Structure and synchronizer depth come from a static CDC tool and a design review.
References
- Clifford E. Cummings, “Simulation and Synthesis Techniques for Asynchronous FIFO Design”, SNUG San Jose 2002. The design style and the Gray full compare used here.
- IEEE Std 1800-2017, SystemVerilog, clause 16 (assertions):
$onehot0,$pastand the##[m:n]cycle delay range. - Harry Foster, “Part 12: The 2022 Wilson Research Group Functional Verification Study”, Siemens Verification Horizons, 9 January 2023. Source of the first-silicon-success figure. Accessed 26 November 2026.
- Ben Cohen and Kais Chibani, “Async FIFO decomposition: from RTL and SVA to a black-box specification”. Formal checkers for the same FIFO style, including a bounded allowance for a late full flag.
Read next
- Async FIFO Verification, Part 1
- UVM scoreboard mismatch debug
- Practical verification debug guide
- Where to use formal verification
- Clock monitors in SoC verification
