When you take over a collector, ask two questions. What did it accept at this edge? Which record can I check against it? In F16A we connect the data path, counter, finite state machine (FSM) and buffer from the earlier lessons. F16B uses the same accept, save and deliver pattern for the trusted checker’s result controller.
F16A | From starting a group to delivering its report
In IDLE, collector_top.sv accepts start_valid && start_ready. It then collects four unsigned eight-bit samples. The sum advances on sampled edges with sample_valid && sample_ready. A start offered during COLLECT leaves the current job in progress. The largest sum is FF + FF + FF + FF = 3FC, so the result needs ten bits.
After the fourth sample, the FSM enters REPORT and sum_q holds the final total. Acceptance at the buffer input sends the FSM back to IDLE. The receiver takes a report only when out_valid && out_ready is true. If the buffer is still holding an old report, REPORT retains the new sum until the buffer makes room.
Replay the main case and its boundaries
The test starts the job at E1 and accepts 11, 22, 33 and 44 at E2, E4, E6 and E7. The values are hexadecimal. E3 and E5 have no valid sample. A second start at E4 leaves the current job in place. At E8, 0AA enters the buffer. The receiver stalls at E9 through E11 and accepts the result at E12. Run the same fixture with a counter that advances on every COLLECT cycle. Its first mismatch is at E6. The independent record holds just two accepted samples, but the faulty design has already stopped accepting them.
The scoreboard sums accepted samples independently in the testbench, then compares each output word with its expected result in order. The four-FF boundary case delivers 3FC at E19. E22 cancels a partially collected group. E29 cancels a queued 00A. The new epoch can begin again, and E36 delivers 01A. The suite completes four groups and delivers three. One finished report and one partial job are cancelled.
F16B | Follow one job from request to delivery
Now use the pattern for a checker-result controller. The controller accepts one job at a time and notifies an external checker when it takes a request. The trusted checker returns done, pass and the job ID. Both sides in the main example share a active-low synchronous reset that cancels their work. The checker sends no replies for cancelled jobs. The teaching checker_stub.sv uses a decision preset by the test and replies three sampled edges later.
The controller keeps two flags. A valid done sets checked=1 to record that the checker finished. Only pass=1 also sets verified=1. Job IDs are hexadecimal with a 0x prefix. Labels starting with B mark sampling edges. Job 0xA1 comes back with a failed result at B4. After that sample, checked is one and verified is zero. At B5, both delivery_valid and delivery_ready are high, so rejection retires the job. The next request starts with a fresh record.
Check accept against a separate history
The delivery event is accept = delivery_valid && delivery_ready && grant. Grant requires a current job that has finished and passed. Reset gates grant low. The matching reply for 0xC3 is sampled at B11. Its decision has yet to be stored at that sample, so this fixture delivers job 0xC3 at B12. A done event while idle or after a job is already checked leaves the result unchanged.
The testbench builds a history from the request handshakes and checker replies. It records the accepted request ID, whether the reply matches, and whether that job has completed successfully. At every sampled edge it computes the expected delivery from that history and compares it with accept. Using the DUT’s grant as the answer would repeat F15’s conditional definition and would leave the source of the decision unchecked.
How does the controller recognize replies after reset?
At B6 the controller accepts job 0xB2. B7 cancels it on reset. B8 begins a new job, 0xC3. In the shared-reset example, the checker is silent at B9. A separate-reset test fixture checks compatibility with a checker that missed the cancellation. That model reports the old ID 0xB2 at B9. The controller is waiting for 0xC3, so it discards the mismatched reply. The scoreboard records an INVALID_REPLY and checks that grant and accept are both low at that edge.
With no ID field, busy and done alone cannot establish which job a reply belongs to. This implementation compares the reply ID with the ID of the waiting job. The testbench assigns distinct IDs across functional reset. An allocator that also resets could reuse an ID and make two jobs indistinguishable. A real interface needs an agreed ID or generation lifetime. Keep jobs distinguishable while any old reply can still arrive. Reuse an ID only after confirming that the old work has drained.
At B16, reset, done, delivery valid and delivery ready coincide. Cancellation takes priority and both grant and accept stay low. The B22 test asserts reset after a passing result is already stored and also sees grant go low. The two testbenches use E and B respectively to label their independent timelines.
Point each claim back to a reproducible record
Extract the lab package on Linux or WSL and run bash run.sh. The README records the interface, synchronous reset, trusted checker, one-job limit, and ID lifetime and reuse rules. Icarus logs what was actually delivered. The Yosys generic netlist reveals adders, muxes, registers and the state machine. In this run the fsm pass recoded the collector’s two-bit state into three-bit one-hot. The checker controller has four $sdffe cells, one of which holds the job ID. The evidence lists physical timing, CDC, fault resilience and checker algorithm validation as unexecuted.
Review the run summary, collector VCD, shared-reset checker VCD, separate-reset check trace, and version hashes and evidence. If a later exercise asks whether the stored verified flag remains trustworthy, this independent history gives it a repeatable comparison point. The current checks establish functional delivery in the stated scenarios.
What if two jobs can wait at once?
Send X and Y with a checker that may return them in either order. Can one pair of checked and verified flags still represent both jobs? What happens to each job on reset?
Answer
One flag pair describes one job. Give each job a distinct ID and its own pending, checked and verified state. An ordered receiver also needs a queue of expected delivery order. An out-of-order receiver needs an ID on each delivery. On reset, apply the agreed cancellation or drain rule to all outstanding jobs. The independent scoreboard can then match each reply and delivery to its request.