Fix a hold rule written with throughout over a fixed delay, so it holds the request until the accept, whenever it comes.
Hardware context: A read request whose address must hold until it is accepted. Hold a request until its accept edge, whatever the wait.
A read request raises arvalid with an address on araddr. If it is not accepted at once, arvalid stays high and araddr stays the same up to and including the edge where arready is 1.
The rule below assumes the accept always comes one edge after the request. Fix it so that it holds until the accept, at any distance.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
arvalid | 1 | stimulus, the same for every design |
arready | 1 | stimulus, the same for every design |
araddr | 8 | stimulus, the same for every design |
your errors | 32 | your checker's error count |
Full specification
module addr_hold (
input logic clk,
input logic arvalid, arready,
input logic [7:0] araddr,
output int errors
);
// False alarms when the accept comes early, and missed bugs when it comes late.
held: assert property (@(posedge clk) $rose(arvalid) && !arready |=> (arvalid && $stable(araddr)) throughout ##1 arready) else errors++;
endmodule
The program shown here gives the sampled value of each signal at each rising edge, with araddr in hex:
| Edge | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| arvalid | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 |
| arready | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| araddr | 00 | 40 | 40 | 00 | 00 | 50 | 50 | 50 | 50 | 00 | 60 | 60 | 00 | 00 |
The full check also runs a second program that this page does not show, with another clock and other requests.
Examples
Example 1
One Bad Request- Input
Program: 3 requests
- Output
errors = 1
The requests at edges 2 and 6 wait 1 and 3 edges and hold. The one at 11 drops before any accept.
Example 2
A Quick Accept Is Fine- Input
Program: 3 requests
- Output
errors = 0
The request at edge 2 is accepted at 3 with the address held.
Example 3
A Slow Accept Is Fine Too- Input
Program: 3 requests
- Output
errors = 1
The request at edge 6 holds its address through 7 and 8 and is accepted at 9. Only the drop at 13 fails.
Constraints and Contract
- Keep one concurrent assertion that counts failures in errors.
- Hold up to and including the accept edge.
- Do not change the ports.
Hints
Hint 1
How long after the request can the accept come?
Hint 2
until stops checking at the accept edge; until_with checks that edge too.
Hint 3
The hold starts at the edge after the request: at the request edge, $stable compares with the old idle address.
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 3 steps and the final capstone