Fix a module's default disable iff, and let the one rule that checks reset opt out of it.
Hardware context: A valid/ready channel whose rules share one module-wide reset guard. Fix the default guard, and let the reset check opt out of it.
Two rules watch a valid/ready channel. While a beat waits, valid and data hold. When reset is asserted, valid is low at the next edge.
The module gives every rule one default reset guard. The hold rule never fires, and the reset rule never catches a valid that survives reset. Fix the guard so the hold rule is off only during reset, and the reset rule runs during reset.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
rst_n | 1 | stimulus, the same for every design |
valid | 1 | stimulus, the same for every design |
ready | 1 | stimulus, the same for every design |
data | 8 | stimulus, the same for every design |
your errors | 32 | your checker's error count |
Full specification
module xfer_rules (
input logic clk,
input logic rst_n, // active-low reset, held across at least one edge
input logic valid, ready,
input logic [7:0] data,
output int errors
);
default disable iff (rst_n);
// While a beat waits, valid and data hold.
hold: assert property (@(posedge clk) valid && !ready |=> valid && $stable(data)) else errors++;
// Reset clears valid at the next edge.
clears: assert property (@(posedge clk) !rst_n |=> !valid) else errors++;
endmodule
The program shown here gives the sampled value of each signal at each rising edge, with data in hex:
| Edge | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| rst_n | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 |
| valid | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| ready | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| data | 00 | 00 | a1 | a1 | b2 | 00 | c3 | c3 | c4 | c4 | 00 | 00 | 00 | 00 | 00 | 00 |
Reset is held across whole edges in both programs. The full check also runs a second program that this page does not show, with another clock, other resets and other beats.
Examples
Example 1
Two Real Bugs- Input
Program: 3 beats, 2 resets
- Output
errors = 2
One is a valid that survives a reset; the other is a data change during a stall.
Example 2
A Reset During a Stall Is No Failure- Input
Program: 3 beats, 2 resets
- Output
errors = 1
The stall from edge 5 is cut by the reset at edge 6. That attempt is disabled.
Example 3
The Second Reset Is Clean- Input
Program: 3 beats, 2 resets
- Output
errors = 1
Reset at edges 12 and 13 with valid low after both: nothing to report.
Constraints and Contract
- Keep one default disable iff for the module.
- Keep the two rules and their names; count failures in errors.
- Do not change the ports.
Hints
Hint 1
A guard disables a rule while its condition is true. When is rst_n true?
Hint 2
Which disable condition does the reset rule get from the default? Can that rule ever check anything?
Hint 3
A rule may name its own disable iff, and the standard gives one way to switch the default off for one rule.
What the grader checks: Two copies of your rules each watch a fixed program. One is shown here; the other is hidden, with another clock. Graded on each: failures early, later and in total. The hold rule must take its guard from the default.
6 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 4 steps and the final capstone