P2.5.2 A Full Register Slice

HardImplementIcarus · browser samples / server checksReview the topic

Build the register stage interconnects put on long AXI wires. Every output comes from a flop, one transfer crosses per cycle, and nothing drops when the receiver stalls.

Hardware context: A manager keeping several single-beat writes in flight. Implement a full register slice that registers VALID, the payload and READY and still moves one transfer per cycle.

Lesson P2.5 measured register slices from the outside: one cycle of latency per stage, and the same beat rate. Inside, the hard part is READY. A stage that only registers VALID and the payload still leaves a long path. It runs from the receiver's READY back to the sender.

Write module vr_skid, a full register slice for one valid/ready channel. in_ready, out_valid and out_data must each come straight from a flop. When the receiver is always ready, one word must cross every cycle.

The catch comes when the receiver stalls. in_ready was registered on the edge before, so the sender may already have offered a word you must accept. A second register, the skid register, parks it until the output frees up.

A fixture sends up to 48 words under patterned stalls on both sides. It checks every word arrives once and in order, and that the output holds while it waits. Between edges it wiggles your inputs to prove no path crosses the slice.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
in_valid1stimulus, the same for every design
in_ready1stimulus, the same for every design
in_data32stimulus, the same for every design
out_valid1stimulus, the same for every design
out_ready1stimulus, the same for every design
out_data32stimulus, the same for every design
Full specification
The module you write (keep these ports)
module vr_skid #(parameter int W = 32) (
  input  logic         clk,
  input  logic         rst_n,      // active low, asynchronous assert
  // upstream: the sender offers, you accept
  input  logic         in_valid,
  output logic         in_ready,
  input  logic [W-1:0] in_data,
  // downstream: you offer, the receiver accepts
  output logic         out_valid,
  input  logic         out_ready,
  output logic [W-1:0] out_data
);
  // your register slice
endmodule
RequirementHow the fixture checks it
Every word arrives once, in orderEach output transfer is compared with the next word the sender gave.
The offer holdsWhile out_valid is 1 and out_ready is 0, out_valid and out_data must not change at the next edge.
No path from out_ready to in_readyBetween edges out_ready is flipped and flipped back; in_ready must not move.
No path from the input to the outputBetween edges in_valid and in_data are flipped and flipped back; out_valid and out_data must not move.
Full rate, one stageWith both sides always ready, n words take n edges from the first input transfer to the last output transfer.

The result is {words_out[15:0], stream_edges[15:0], bad[7:0], hold[7:0], paths[7:0]}. stream_edges is measured only in the two always-ready cases and is 0 elsewhere. bad counts wrong, extra or out-of-order words. paths counts the edges where a flip moved an output.

Examples

Example 1

Full Rate
Input
32 words; sender offers on 16'hffff, receiver ready on 16'hffff (bit = edge mod 16); edges from the first input transfer to the last output transfer are measured
Output
words_out = 32, stream_edges = 32, bad = 0, hold = 0, paths = 0

32 words cross in 32 edges, from the first input transfer to the last output transfer. A slice that stalls the sender whenever the output is full would need about 64.

Example 2

A Receiver That Stalls Every Other Edge
Input
24 words; sender offers on 16'hffff, receiver ready on 16'h5555 (bit = edge mod 16)
Output
words_out = 24, stream_edges = 0, bad = 0, hold = 0, paths = 0

Half the edges have out_ready low. Each word must wait on the output, unchanged, and the word that arrived meanwhile must wait in the skid register.

Example 3

One Stall in a Full Stream
Input
40 words; sender offers on 16'hffff, receiver ready on 16'hfeff (bit = edge mod 16)
Output
words_out = 40, stream_edges = 0, bad = 0, hold = 0, paths = 0

A single low out_ready catches one word in flight. Without a skid register it is lost or overwritten.

Constraints and Contract

  • Keep the module name, the parameter and the ports. The fixture uses W = 32.
  • The fixture drives its inputs after each edge and samples your outputs just before the next one. After reset in_ready may be 1.
  • Do not reach outside your ports.

Hints

Hint 1

Keep in_ready as a register that means "the skid register is empty".

Hint 2

When the skid register is empty, a word arrives, and the output is stalled, park the word and drop in_ready. When the output drains, raise in_ready again.

Hint 3

The output register loads whenever it is empty or being emptied this edge. It loads from the skid register if a word is parked there, otherwise from the input.

What the grader checks: Your slice moves up to 48 words in seven cases with patterned stalls on both sides. Every word, every held offer and every edge-free input flip is checked. Passing shows a correct full-rate slice on these patterns, not under every pattern.

7 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 steps and the final capstone

Report a problem with this page

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

Full Rate

Input
32 words; sender offers on 16'hffff, receiver ready on 16'hffff (bit = edge mod 16); edges from the first input transfer to the last output transfer are measured
Expected output
words_out = 32, stream_edges = 32, bad = 0, hold = 0, paths = 0

32 words cross in 32 edges, from the first input transfer to the last output transfer. A slice that stalls the sender whenever the output is full would need about 64.

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

Icarus · browser samples / server checks