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
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
req | 1 | stimulus, the same for every design |
gnt | 1 | stimulus, the same for every design |
dv | 1 | stimulus, the same for every design |
done | 1 | stimulus, the same for every design |
Full specification
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
| Transfer | What the program shown here does | Expected |
|---|---|---|
| T1, req at 15 | legal: gnt 25, dv 35, done 55 | no failure |
| T2, req at 75 | no gnt at 85 | gnt_f fails once |
| T3, req at 105 | gnt and dv on time, no done at 145 | done_f fails once |
| 165 | a stray dv with no request | no 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