Fix an acknowledge rule that fires on every edge of a held request instead of once per request.
Hardware context: A requester that holds req for several edges and gets one ack pulse per request. Check each request once, at the edge where it starts.
A requester raises req and holds it for one or more edges. Each request gets one ack pulse, at the edge after req rises.
The rule below raises false alarms on every request held longer than one edge. Fix it so it checks each request once.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
req | 1 | stimulus, the same for every design |
ack | 1 | stimulus, the same for every design |
your errors | 32 | your checker's error count |
Full specification
module ack_rule (
input logic clk,
input logic req, // held high by the requester for one or more edges
input logic ack, // one pulse per request
output int errors
);
// False alarms on every request held for more than one edge.
acked: assert property (@(posedge clk) req |=> ack) 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 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| ack | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 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 Its Ack- Input
Program: 3 requests, 2 held
- Output
errors = 1
Requests start at edges 2, 6 and 9. Only the one at 9 gets no ack at the next edge.
Example 2
No False Alarms on Held Requests- Input
Program: 3 requests, 2 held
- Output
errors = 0
The request held from edge 2 to 4 is acknowledged once, at 3. Edges 3 and 4 are not new requests.
Example 3
The Real Failure- Input
Program: 3 requests, 2 held
- Output
errors = 1
It is reported at edge 10, after t=75.
Constraints and Contract
- Keep one concurrent assertion that counts failures in errors.
- Start it from the rising edge of req.
- Do not change the ports.
Hints
Hint 1
At which edges is req 1 while a request is held? At which edge did it start?
Hint 2
Which sampled-value function is true only at the edge where a signal goes from 0 to 1?
Hint 3
A request that starts at the very first edge also counts as a rise from the declared 0.
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 $rose(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