S4.7.2 A Slice That Drops a Beat

MediumFix25 minIcarus Verilog · serverReview the topic

A full slice passes its single-beat tests. In a burst, one beat in a while never arrives. Find the edge where it is lost and repair the slice.

Hardware context: One valid and ready channel with a register slice in the middle, and a path of two interconnect hops. Timing closure of an interconnect

A register slice sits in one channel of an interconnect. It is built as a queue of two places. So it can take a beat and give a beat in every cycle.

With one beat at a time it works. In a burst, some beats vanish. No beat is ever given twice. Repair the slice.

Signals in the Timeline

SignalWidthRole
cycle12input of each check
Full specification
SignalContract
up_ready1 while fewer than two beats are stored. It comes from flip-flops alone.
dn_valid1 while at least one beat is stored. It comes from flip-flops alone.
dn_dataThe oldest stored beat, while dn_valid is 1.
A beat entersAt a rising edge with up_valid and up_ready at 1.
A beat leavesAt a rising edge with dn_valid and dn_ready at 1.
rstAt a rising edge with rst at 1 the queue becomes empty.

Every beat that enters must leave once, in the order of entry. A beat may enter and another may leave at the same edge.

Examples

Example 1

Reset
Input
rst=1, up_valid=0, up_data=0x00, dn_ready=0
Output
up_ready = 1, dn_valid = 0, dn_data = 0x0

The bench gives one clock edge with rst at 1 before this row. The queue is empty, so ready is 1 and valid is 0.

Example 2

Empty After Reset
Input
rst=0, up_valid=1, up_data=0x11, dn_ready=1
Output
up_ready = 1, dn_valid = 0, dn_data = 0x0

The queue is empty: ready is 1 and valid is 0. The beat 11 enters at the edge that ends this cycle.

Example 3

One Beat Stored
Input
rst=0, up_valid=1, up_data=0x22, dn_ready=1
Output
up_ready = 1, dn_valid = 1, dn_data = 0x11

The beat 11 is shown. The receiver takes it at this edge, and 22 enters at the same edge.

Constraints and Contract

  • Keep module queue_slice and its ports. Keep the two places: the slice must hold two beats.
  • up_ready, dn_valid and dn_data may depend on flip-flops only, not on an input of the same cycle.

Hints

Hint 1

Send a burst while the receiver is always ready. Count the beats on each side.

Hint 2

Look for an edge at which two things should happen.

Hint 3

When a beat enters and a beat leaves at one edge, the number of stored beats does not change.

What the grader checks: The cycles check ready, valid and the shown beat before every edge. They cover single beats, a full and an empty queue, resets and a mixed run. Two bursts run with a receiver that is always ready, or ready every second cycle. They do not check timing or area.

209 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. 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

Reset

Input
rst=1, up_valid=0, up_data=0x00, dn_ready=0
Expected output
up_ready = 1, dn_valid = 0, dn_data = 0x0

The bench gives one clock edge with rst at 1 before this row. The queue is empty, so ready is 1 and valid is 0.

Run samples executes all 3 public checks. Check all tests runs 209 checks on the server.

Icarus Verilog · server