The receiver stays ready while the testbench offers A (31) followed by B (52) to the one-entry F11 buffer. At E2 the receiver takes A, and the input accepts B. At E3 there is no valid B at the output. The drain deadline at E4 passes without it. A waveform can show where B disappeared. To make the test catch the error on every run, we need to say what counts as a transfer and when a result is overdue.
B was accepted. How can we tell that it went missing?
Look at the recorded VCD. Before E2, the output presents A and the input offers B. Both sides have valid and ready high, so the receiver takes A and the buffer accepts B. The faulty RTL writes B into the data register, then clears the validity flag. The data pins may still show 52, but no second output transfer occurs. All payload values in this lesson are hexadecimal.
A full signal printout still has to be read row by row. A PASS message at the end of a run tells us about B only if the test had a rule to check it. In this test the receiver stays ready, with several edges available to drain the buffer. At E4 the expected queue still contains B, so the test reports a missing transfer. A test that allows an indefinite stall needs a defined drain condition or deadline before it can make that judgment.
Who drives the interface, and who decides whether it passed?
tb_collector.sv uses the one-entry F11 buffer as its design under test (DUT) to check delivery on the collector’s report path. The driver sets data, reset and ready. The monitor observes the interface at each rising edge and records the inputs and outputs that were accepted. The scoreboard builds its expectations from input events and checks each output event against them. These separate jobs reuse the same stimulus across RTL versions.
The buffer stores and delivers a word unchanged, so an accepted input word is also the expected output word. To check the collector’s sum later, compute that sum separately from the accepted samples. Give the reference value to the scoreboard. If both the design and the test use the same internal result, the same bug can affect the answer and the check.
The two observation times from F08 still apply. The driver changes signals on the falling edge. The monitor reads the interface at the rising edge, before the DUT’s scheduled nonblocking updates take effect. A separate log prints the updated output 1 ns later. That delay belongs to the testbench and keeps the new register value distinct from the transfer record. A step task collects the repeated drive and wait operations. Its @(...) and #2ns control simulated test time. The synthesizable DUT updates on the clock edge.
Which word do we compare when input and output fire together?
The scoreboard maintains its own first-in, first-out queue of expected results. It appends a word only when in_fire occurs. On out_fire it compares the observed word with the oldest pending entry, then removes that entry. This registered buffer has no empty-slot bypass. When both interfaces fire at once, compare the output with the old queue head before appending the new input. An output fire with an empty old queue is an extra transfer.
Reset has its own queue rule. The directed case accepts 73 at E7. At E8, the receiver is ready and the source offers A5. Reset disables both transfers and clears the waiting 73. The monitor tells the scoreboard to clear the pending entries from that epoch. In the new epoch, E9 accepts 94 and E10 checks and delivers it. The test records four accepted words, three delivered words and one cancellation. Leaving the cancelled word in the queue would make the first correct delivery in the new epoch look wrong.
The monitor also checks for X or Z in controls and valid payloads. For example, if out_ready is X, a plain if (out_valid && out_ready) can silently skip the transfer branch. The monitor checks for unknowns first. When it compares the actual output with the expected word, it uses the four-state comparison !==. If both data values contain the same unknown bits, the earlier valid-payload check still fails the test.
Can two accepted words and two delivered words still hide an error?
Start with two different words. The first three negative cases use an always-ready receiver. The overwrite case uses the three-cycle stall from F11. Each version changes the real RTL. The missing-word version clears the slot’s valid flag after a simultaneous send and receive. The duplicate version forgets to clear that flag after the last send. The wrong-order version bypasses the new word on a simultaneous transfer and keeps the old word in the register. The overwrite version lets an unaccepted input replace the held value.
| Version | Actual output sequence | First failure |
|---|---|---|
| Main | 31, 52 | Pass |
| Missing | 31 | E4 MISSING. The deadline passes with 52 pending. |
| Duplicate | 31, 52, 52 | E4 EXTRA. The queue is empty. |
| Wrong order | 52, 31 | E2 DATA. The first word was 52. |
| Stall overwrite | 52, 52 | E3 HOLD. The held 31 changed to 52. |
In the missing-word version, the condition in_fire && !out_fire sets full_q only for an input-only edge. At E2 both interfaces fire, so the following branch clears full_q. Restore the in_fire condition and replay the same pair. B now reaches the receiver at E3. The lab runs both versions, requires the faulty one to fail, then checks that the main version passes under that stimulus. It also saves the shortest prefix of each targeted trace ending at the first reported error.
Vary ready after the directed tests pass
Extract the lab package on Linux or WSL and run bash run.sh. The directed tests cover an empty slot, simultaneous send and receive, a three-cycle stall and reset cancellation. The seed 305419896 (0x12345678) in seed.conf then gives xorshift32 a repeatable 64-cycle ready pattern. If the final offer is still blocked, the driver sets ready high to accept it and drain the buffer. This run accepts and delivers 30 words, observes 34 stalled output edges, and sees both interfaces fire together 29 times. A fixed seed lets you replay those events. You could add a reset during longer stalls to test a different combination.
The package contains the main design, four separate faulty RTL files, the seed configuration, six first-error traces including the two X probes, and a VCD for each run. See the run summary, missing-transfer VCD and replay evidence.
How do we check the order of equal values?
Suppose A and B are both 31, and the receiver sees two copies of 31. Could the scoreboard tell that they were swapped? What extra information would make the test able to tell them apart?
Answer
The two observed values alone cannot reveal the swap. For a test you can choose distinct values such as 31 and 52. If identical payloads are legal and their source or order is part of the interface contract, assign a tag such as a source ID or transaction sequence number at the input. Carry it with the payload so it stays visible at the output, and queue and check both fields. Numbering entries only inside the scoreboard gives it no way to distinguish the two identical output words.