Four logs from four runs. Say for each one whether the design, the reset, the assertion clock or a vacuous rule is to blame.
Hardware context: Four failing regression logs from a stall rule, a handshake, a mis-clocked check and an idle rule. Blame the design, the reset, the assertion clock or the rule itself, from the log and the code.
Each log below is a complete program and its rule. Read what the rule checks, when it fires, and why.
Write answer(q). For questions 3 to 6, return the cause code of Log A to Log D. The codes: 1 a design bug, 2 a reset mid-transfer, 3 the wrong assertion edge, 4 a rule that never triggered. Question 7: the edge where Log A's failing attempt began.
Questions 0 to 2 are worked examples on another program. Questions 3 to 7 are graded only by the full check.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 4 | input of each check |
Full specification
module tb;
logic clk = 0; always #5 clk = ~clk; // edges at 5, 15, 25, ...
logic valid = 0, ready = 0; logic [7:0] data = 8'h00;
stall_hold: assert property (@(posedge clk) valid && !ready |=> $stable(data))
else $display("t=%0t stall_hold fails", $time);
initial begin
#12 valid = 1; data = 8'h3c; // edge 15: valid, not ready
#10 data = 8'h3d; // edge 25: the data moved during the stall
#10 ready = 1; // edge 35
#10 valid = 0; ready = 0;
#10 $finish;
end
endmodule
module tb;
logic clk = 0; always #5 clk = ~clk;
logic rst = 0, req = 0;
// The responder: ack three edges after req, through a shift register that the reset clears.
logic [2:0] sr = 0;
always @(posedge clk) sr <= rst ? 3'b000 : {sr[1:0], req};
wire ack = sr[2];
hs: assert property (@(posedge clk) req |-> ##3 ack) else $display("t=%0t hs fails", $time);
initial begin
#12 req = 1; // edge 15: due at 45
#10 req = 0; rst = 1; // t=22: reset over the edges at 25 and 35
#20 rst = 0; // t=42
#20 $finish;
end
endmodule
module tb;
logic clk = 0; always #5 clk = ~clk; // rising at 5, 15, ...; falling at 10, 20, ...
logic valid = 0, ready = 0; logic [7:0] data = 8'h00;
// The design moves data at each rising edge after a handshake.
always @(posedge clk) if (valid && ready) data <= data + 8'd1;
hold_n: assert property (@(negedge clk) valid && !ready |=> $stable(data))
else $display("t=%0t hold_n fails", $time);
initial begin
#12 valid = 1; // stalled from 12
#10 ready = 1; // t=22: handshake at 25, data moves at 25
#10 valid = 0; ready = 0;
#10 $finish;
end
endmodule
module tb;
logic clk = 0; always #5 clk = ~clk;
logic req = 0, ack = 0; logic [1:0] mode = 2'd0;
int fails = 0;
m3: assert property (@(posedge clk) req && mode == 2'd3 |=> ack) else fails++;
initial begin
#12 req = 1; mode = 2'd2; // mode 3 never comes
#30 req = 0;
#10 $display("m3 fails=%0d", fails);
$finish;
end
endmodule
module tb;
logic clk = 0; always #4 clk = ~clk; // edges at 4, 12, 20, 28, 36
logic go = 0, busy = 0;
start: assert property (@(posedge clk) go |-> ##2 busy) else $display("t=%0t start fails", $time);
initial begin
#6 go = 1; // edge 12: due at 28
#8 go = 0; // t=14: busy never rises: a design bug
#26 $finish;
end
endmodule
| q | Return |
|---|---|
| 0 | the time printed by the example |
| 1 | the edge where its failing attempt began |
| 2 | its cause code |
| 3, 4, 5, 6 | the cause code of Log A, B, C, D |
| 7 | the edge where Log A's failing attempt began |
Simulator note: Every log was run on Verilator 5.052 (measured by tools/probes/sva-w1b/measure-keys.mjs). Your answer function is checked by a small bench on Icarus 12.
Examples
Example 1
When It Reports- Input
answer(0)
- Output
answer = 28
The attempt needs busy two edges later; it is still low at 28.
Example 2
Walk Back- Input
answer(1)
- Output
answer = 12
Two edges of 8 before 28 is 12, where go was sampled high.
Example 3
Blame- Input
answer(2)
- Output
answer = 1
Nothing interrupted the design; it simply never raised busy: a design bug.
Constraints and Contract
- Return one value per question from answer(q).
- Keep the function header.
Hints
Hint 1
Find the failing attempt first: the failure time minus the delays of the rule.
Hint 2
Is the clock of the assertion the clock the design uses?
Hint 3
Zero failures can mean the rule never triggered.
What the grader checks: Eight constant answers: three worked examples and five graded questions. Failure times were measured on Verilator 5.052.
8 checks on Icarus · browser samples / server checks. 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 2 steps and the final capstone