Fix a grant rule that never fails because its antecedent can never match.
Hardware context: An arbiter that grants each new request at the next edge. Make the antecedent match the event the rule is about, so the rule really checks.
Rule: a new request (req rising) is granted at the next edge. busy rises one edge after a request, so it is never 1 at the edge where req rises.
The rule below has never failed in any regression, even on traces with missing grants. Fix it so it checks every new request.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
req | 1 | stimulus, the same for every design |
busy | 1 | stimulus, the same for every design |
gnt | 1 | stimulus, the same for every design |
your errors | 32 | your checker's error count |
Full specification
module grant_rule (
input logic clk,
input logic req, // a request is held high until it is served
input logic busy, // the arbiter's busy flag: it rises one edge after a request
input logic gnt,
output int errors
);
// Never fails, in any regression. Make it check the rule.
granted: assert property (@(posedge clk) $rose(req) && busy |=> gnt) else errors++;
endmodule
The program shown here gives the sampled value of each signal at each rising edge (at 5, 15, 25, ...):
| Edge | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| req | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| busy | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
| gnt | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
The full check also runs a second program that this page does not show, with another clock and other requests.
Examples
Example 1
One Request Without a Grant- Input
Program: 3 requests
- Output
errors = 1
Requests rise at edges 2, 6 and 9. Only the one at 6 has no grant at the next edge.
Example 2
The Failure Comes Early- Input
Program: 3 requests
- Output
errors = 1
It is reported at edge 7, at t=65.
Example 3
A Held Request Is Not a New One- Input
Program: 3 requests
- Output
errors = 0
req stays high at edge 10, but it did not rise there, so no grant is due at 11.
Constraints and Contract
- Keep one concurrent assertion that counts failures in errors.
- Do not change the ports.
Hints
Hint 1
At which edges can $rose(req) && busy be true?
Hint 2
An antecedent that never matches makes every attempt a vacuous success.
Hint 3
A request held for two edges is still one request: which function sees only its first edge?
What the grader checks: Two copies of your rule 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.
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 5 steps and the final capstone