Write the release rule of a request/grant pair with $fell: req goes from 1 to 0 right after its grant.
Hardware context: A request/grant pair where the requester must release after its grant. Tell a release (a fall) from a level that was already low.
A requester holds req until it gets gnt. At the next edge it must release the request: req goes from 1 to 0 there.
A request that was already gone before its grant is a bug too: it was withdrawn. Write the rule with $fell and count its failures.
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 |
your errors | 32 | your checker's error count |
Full specification
module release_rule (
input logic clk,
input logic req, // held until the grant
input logic gnt, // a one-edge grant pulse
output int errors
);
// released: after gnt, req falls (goes from 1 to 0) at the next edge.
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 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
| gnt | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
The full check also runs a second program that this page does not show, with another clock and other grants.
Examples
Example 1
Two Bad Releases- Input
Program: 3 grants
- Output
errors = 2
Grants come at edges 2, 6 and 9. Only the first is followed by a fall of req.
Example 2
A Request Withdrawn Before Its Grant- Input
Program: 3 grants
- Output
errors = 1
req fell at edge 6, together with the grant, so nothing falls at edge 7: the first failure, at t=65.
Example 3
A Request Held Too Long- Input
Program: 3 grants
- Output
errors = 1
The grant at edge 9 sees req still high at edge 10.
Constraints and Contract
- Use $fell(req) in one concurrent assertion.
- Count failures in errors.
- Do not change the ports.
Hints
Hint 1
!req is true whenever req is low. Is that the same as "req went low here"?
Hint 2
The release is due at the edge after the grant.
Hint 3
If req was already low at the grant, there is nothing to release at the next 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. The rule must use $fell(req).
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