Seven FIFOs each hide one corner bug. Write at most three sequences of eight steps that make every one of them differ from a correct FIFO.
Hardware context: A FIFO four entries deep. Tests that go one step past every limit.
A team has seven versions of a FIFO four entries deep. Each passed its happy-path test. Each hides one bug at a corner: an end of the range, two events in one step, or a pointer that wraps.
This is a Break it problem. In the task stimulus, call try_steps once per sequence. A sequence is eight steps from an empty FIFO; each step is a push, a pop, both, or nothing. The check plays your sequences on a correct FIFO and on each hidden one. It records the flags and the oldest entry after every step.
A hidden FIFO is caught when, on some sequence, its record differs from the correct FIFO's. Catch all seven with at most three sequences.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
hidden_bug | 8 | input of each check |
Full specification
| Rule of the FIFO | Detail |
|---|---|
| A push | Taken when the FIFO is not full. A push at step k writes the value 8'h10 + k. |
| A pop | Taken when the FIFO is not empty. It removes the oldest entry. |
| Both in one step | Each is decided by the count before the step: at empty only the push is taken, at full only the pop. |
| Recorded after each step | full (4 entries), empty (0 entries), and the oldest entry, or 0 when empty. |
| Bits of step k | Meaning |
|---|---|
| ops[2k+1] | push |
| ops[2k] | pop |
task automatic stimulus();
try_steps(16'h000A); // steps 0 and 1 push (10 in binary); steps 2 to 7 do nothing
endtask
Examples
Run samples checks your input rules and any explicitly public sample faults. Submit runs every hidden faulty copy on the server. The worked bug examples below describe Submit results.
Example 1
Your Sequences Follow the Rules- Input
stimulus() makes at most 3 calls
- Output
inputs_legal = yes
Any 16-bit value is a legal sequence; only the number of calls is limited.
Example 2
The FIFO Whose Full Rises Early Is Caught- Input
Your sequences, run on hidden FIFO 1
- Output
caught = yes
Four pushes in a row reach the corner: a correct FIFO is full only at the fourth.
Example 3
The FIFO That Forgets a Pop Is Caught- Input
Your sequences, run on hidden FIFO 2
- Output
caught = yes
A push and a pop together in the middle leave its count one too high, which shows later as a wrong flag.
Constraints and Contract
- Call try_steps at most 3 times inside stimulus.
- Every 16-bit value is a legal sequence.
Hints
Hint 1
Test each end and one step past it: four pushes, then a fifth; an empty FIFO, then a pop.
Hint 2
Pair the events: a push and a pop together at empty, in the middle and at full.
Hint 3
Four pops after a push move the read position past the last slot; push and pop together to keep an entry inside.
What the grader checks: Your sequences are played on the correct FIFO and on seven FIFOs with one bug each. A FIFO is caught when its record of flags and oldest entry differs from the correct one after some step. The values pushed are fixed by the step number, so data bugs outside these corners are not tested.
8 checks on Icarus · browser samples / server checks. 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 2 problems on this path