B3.3.2 Break the FIFO

MediumBreak It25 minIcarus · browser samples / server checks7 hidden designsReview the topic

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

SignalWidthRole
hidden_bug8input of each check
Full specification
Rule of the FIFODetail
A pushTaken when the FIFO is not full. A push at step k writes the value 8'h10 + k.
A popTaken when the FIFO is not empty. It removes the oldest entry.
Both in one stepEach is decided by the count before the step: at empty only the push is taken, at full only the pop.
Recorded after each stepfull (4 entries), empty (0 entries), and the oldest entry, or 0 when empty.
Bits of step kMeaning
ops[2k+1]push
ops[2k]pop
What you write: step 0 is the lowest two bits
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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Your Sequences Follow the Rules

Input
stimulus() makes at most 3 calls
Expected output
inputs_legal = yes

Any 16-bit value is a legal sequence; only the number of calls is limited.

Run samples executes all 1 public checks. Check all tests runs 8 checks on the server.

Icarus · browser samples / server checks