A10.2.2 Split to Find It

MediumFixVerilator · serverReview the topic

A long transfer rule fails without saying where. Fix three broken pieces so each one names its step.

Hardware context: A request-grant-data-done transfer rule that fails without saying which step broke. Split the rule into anchored pieces that each name one step.

The rule req |=> gnt ##1 dv ##2 done covers a whole transfer. When it fails, nobody can tell which step broke.

Keep whole. Fix the three pieces so that each one checks one step of the same rule, in its own counter. A piece must not fire on traffic the whole rule ignores.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
req1stimulus, the same for every design
gnt1stimulus, the same for every design
dv1stimulus, the same for every design
done1stimulus, the same for every design
Full specification
The ports (keep them)
module xfer_rules (
  input  logic clk,       // the transfer clock
  input  logic dbg_clk,   // a debug clock, faster, unrelated to the transfer
  input  logic req, gnt, dv, done,
  output int   whole_f,   // failures of the whole rule
  output int   gnt_f,     // failures at the gnt step
  output int   dv_f,      // failures at the dv step
  output int   done_f     // failures at the done step
);
  // whole and three pieces
endmodule
TransferWhat the program shown here doesExpected
T1, req at 15legal: gnt 25, dv 35, done 55no failure
T2, req at 75no gnt at 85gnt_f fails once
T3, req at 105gnt and dv on time, no done at 145done_f fails once
165a stray dv with no requestno failure

The full check also runs a second program, with another clock and the bugs in another order. This page does not show it.

Examples

Example 1

Two Broken Transfers
Input
Program: T1 legal, T2 no gnt, T3 no done, a stray dv
Output
whole_f = 2

T2 and T3 break; T1 and the stray dv do not.

Example 2

The Gnt Step
Input
Program: T2 has no gnt
Output
gnt_f = 1

Only T2 misses its grant.

Example 3

The Dv Step
Input
Program: dv always on time
Output
dv_f = 0

Every granted transfer brings dv on time.

Example 4

The Done Step
Input
Program: T3 has no done; a stray dv
Output
done_f = 1

Only T3 misses done; the stray dv is not a transfer.

Constraints and Contract

  • Keep whole unchanged. Each piece is a concurrent assertion on clk that checks one step, anchored on the steps before it.
  • Count each piece in its own counter. Do not change the ports.

Hints

Hint 1

A piece needs the earlier steps as its antecedent, or it fires on unrelated traffic.

Hint 2

Every piece uses the clock of the rule it was cut from.

Hint 3

Check which counter each else action increments.

What the grader checks: Two copies of your checker each watch a fixed program: the one shown here and a hidden one. Graded on each: the four failure counts. Source rules check that whole is kept and the pieces are anchored.

8 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 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

Two Broken Transfers

Input
Program: T1 legal, T2 no gnt, T3 no done, a stray dv
Expected output
whole_f = 2

T2 and T3 break; T1 and the stray dv do not.

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

Verilator · server