Write the latency rule of a pipelined responder, so it stays silent on the correct design and catches three buggy ones.
Hardware context: A pipelined responder that answers each request one to three cycles later. Check every request, back to back too, against its own response window.
A responder answers every request with one rsp pulse, 1 to 3 edges after the edge of the request. Requests may come on consecutive edges, so several can be waiting at once.
Write the checker. A copy of it is attached to the correct responder and to three buggy ones. The same three scenarios drive them all.
You pass when your error count stays at 0 on the correct responder and goes up on every buggy one.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
req | 1 | stimulus, the same for every design |
lat (stimulus) | 2 | stimulus, the same for every design |
rsp | 1 | output of the design under test |
your errors | 32 | your checker's error count |
Full specification
module rsp_rules (
input logic clk,
input logic req, // one request per edge where req is 1
input logic rsp, // one response pulse per request
output int errors
);
// your rules
endmodule
| Spec rule | Edges |
|---|---|
| A request is made at an edge where req is 1; back-to-back requests are allowed | every edge with req |
| Each request gets its rsp pulse 1 to 3 edges after its own edge | not on the request edge, not 4 or more edges later |
Scenarios: 1. One request at a time, latency 1, 2 and 3; 2. Two pairs of back-to-back requests; 3. Three requests in a row. Inputs change at falling edges and hold across the next rising edge. Each scenario ends with idle edges, so every window closes.
Count each failure in errors from the else action (errors++). For each responder you get alarm = yes or no. For the correct one, you also get the scenario and cycle of your first alarm.
Simulator note: The grading simulator runs a measured subset of SVA. Goto [->n], [=n], sequence and/or, first_match, intersect, within, cover, ##[0:$], ranged delays followed by more sequence and $error/$fatal/$stop are refused before simulation. Every assertion needs an else action.
Examples
Example 1
The Correct Responder Must Not Raise an Alarm- Input
Responder: the correct design Scenarios: 3
- Output
alarm = no
In scenario 2 a request answered at +1 is followed at once by one answered at +3. Both windows hold their own rsp.
Example 2
Answered One Edge Too Late- Input
Responder: Latency 3 answered at +4 Scenarios: 3
- Output
alarm = yes
In scenario 1 the third request waits four edges. Its window has closed one edge earlier.
Example 3
Answered on the Request Edge- Input
Responder: Latency 1 answered on the request edge Scenarios: 3
- Output
alarm = yes
In scenario 1 the first request is answered on its own edge, and nothing comes in the three edges after it.
Constraints and Contract
- Use only your ports.
- Every assertion has an else action that counts the failure in errors.
- Stay inside the supported SVA subset described in the specification.
Hints
Hint 1
Every edge with req is a request, also the second of two back-to-back ones. Which antecedent sees each of them?
Hint 2
The window starts one edge after the request. Which range says 1 to 3 edges?
Hint 3
Several attempts can be open at once. Each one only needs one rsp inside its own window.
What the grader checks: Your rules run against the correct responder and three variants with one planted bug each, over three fixed scenarios. Passing shows they catch these bugs on this stimulus.
4 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 6 steps and the final capstone