Turn three sentences of a write-response spec into three concurrent assertions, one per sentence.
Hardware context: An AXI-style write response channel: write end, valid, ready and response code. Turn each spec sentence into one concurrent assertion.
A write slave ends each write with wdone, then offers a response with bvalid and bresp. The master takes it with bready.
Write one concurrent assertion per spec sentence, clocked on the rising edge of clk. Count each failure of each rule in its own counter.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
wdone | 1 | stimulus, the same for every design |
bvalid | 1 | stimulus, the same for every design |
bready | 1 | stimulus, the same for every design |
bresp | 2 | stimulus, the same for every design |
your resp_errors | 32 | stimulus, the same for every design |
your code_errors | 32 | stimulus, the same for every design |
your gap_errors | 32 | stimulus, the same for every design |
Full specification
module bresp_spec (
input logic clk,
input logic wdone, // 1 at the edge where the last write beat is taken
input logic bvalid, bready,
input logic [1:0] bresp,
output int resp_errors, // sentence 1
output int code_errors, // sentence 2
output int gap_errors // sentence 3
);
// 1. The write response is offered one edge after the write ends.
// 2. This slave has no exclusive access: an offered response never carries EXOKAY (bresp = 1).
// 3. Once a response is taken, bvalid is low at the next edge.
endmodule
The program shown here gives the sampled value of each signal at each rising edge:
| Edge | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wdone | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
| bvalid | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| bready | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| bresp | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 0 |
Between offers, bresp may hold any value: only an offered response is checked. The full check also runs a second program that this page does not show, with another clock and other bugs.
Examples
Example 1
A Missing Response- Input
Program: 3 writes, 3 bugs
- Output
resp_errors = 1
Writes end at edges 2, 6 and 9. Only the one at 9 has nothing offered at the next edge.
Example 2
A Forbidden Response Code- Input
Program: 3 writes, 3 bugs
- Output
code_errors = 1
bresp is 1 at edges 5 and 7. Only edge 7 offers a response.
Example 3
A Response Offered Twice- Input
Program: 3 writes, 3 bugs
- Output
gap_errors = 1
Responses are taken at edges 4, 7 and 11. Only one of them is still offered at the next edge.
Constraints and Contract
- One concurrent assertion per sentence, each counting its own failures.
- Do not change the ports.
Hints
Hint 1
For each sentence, ask: which edge starts a check, and is the result due at that edge or at the next one?
Hint 2
Sentence 2 is only about offered responses. What should an attempt do at an edge where nothing is offered?
Hint 3
A response is taken at an edge where bvalid and bready are both 1.
What the grader checks: Two copies of your rules each watch a fixed program. One is shown here; the other is hidden, with another clock. Graded on each: the three failure counts.
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 1 steps and the final capstone