Write stimulus that keeps the bench's own rules and still makes an assertion suite catch four hidden faulty FIFOs.
Hardware context: A 4-entry FIFO with no back-pressure, its assertion suite and four faulty variants. Write legal stimulus that reaches every corner where a FIFO fault can hide.
A 4-entry FIFO has no back-pressure, so the bench promises never to push while full and never to pop while empty. Two assertions check those promises: they test the testbench.
Write the module stim. It drives one FIFO and reads only its flags. The bench runs your stimulus against the correct FIFO and four faulty ones, each watched by the same assertion suite. A fault is caught when the suite fails on it while your stimulus keeps the bench rules.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
push | 1 | stimulus, the same for every design |
pop | 1 | stimulus, the same for every design |
full | 1 | stimulus, the same for every design |
empty | 1 | stimulus, the same for every design |
Full specification
module stim (
input logic clk,
input logic full, empty, // the flags of the FIFO under test
output logic push = 0, pop = 0,
output logic [7:0] wdata = 0
);
// your stimulus
endmodule
| Check | Passes when |
|---|---|
| Your inputs | the bench rules never fail, and the suite stays silent on the correct FIFO |
| Each hidden fault | the bench rules never fail, and the suite fails at least once |
The faults are in the flags, the pointers and the counting. Think about the corners a FIFO has: full, empty, wrapping pointers, and a push and a pop in the same cycle.
Examples
Example 1
Legal Inputs- Input
Your stimulus on the correct FIFO
- Output
legal = 1
No push while full, no pop while empty, and the correct FIFO passes every rule.
Example 2
One Fault Caught- Input
Your stimulus on a faulty FIFO
- Output
caught = 1
This fault needs the FIFO filled.
Example 3
Another Fault Caught- Input
Your stimulus on a faulty FIFO
- Output
caught = 1
This fault needs a push and a pop together, with one entry stored.
Constraints and Contract
- Drive push, pop and wdata from the module stim. Change them only on the falling edge of clk.
- Never push while full and never pop while empty, as the flags of your FIFO show them.
Hints
Hint 1
A fault in the full flag only shows when the FIFO is filled.
Hint 2
A pointer that fails to wrap only shows after more reads than entries.
Hint 3
Some faults need a push and a pop in the same cycle, with one entry stored.
What the grader checks: Your stimulus runs against the correct FIFO and four hidden faulty variants in one simulation. Graded: the bench rules hold on every run and the suite is silent on the correct FIFO. Each faulty variant must make it fail.
5 checks on Verilator · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 1 steps and the final capstone