Five formal runs of one opcode decoder with different assumptions. Say which pass, which fail, and which covers are reached.
Hardware context: An opcode decoder proved with different environment assumptions. Tell an honest assumption from one that hides a bug or removes real behaviour.
An opcode decoder flags opcode 3 as an error and raises busy for opcode 1. The bench never sends opcode 3. One version has a bug: two op-2 in a row also flag an error. Five formal runs check it with different assumptions.
Write answer(q). For questions 3 to 7, return 1 if the run passes or its cover is reached. Return 0 if it fails or its cover is unreached.
Questions 0 to 2 are worked examples on the requester design. 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 top(input clk, input [1:0] op, output reg err = 0, output reg busy = 0);
reg [1:0] last = 0; // the previous opcode
always @(posedge clk) begin
err <= (op == 2'd3) || (op == 2'd2 && last == 2'd2); // a bug: two op-2 in a row also flag an error
busy <= (op == 2'd1);
last <= op;
end
endmodule
legal_op: assume property (@(posedge clk) op != 2'd3);
no_err: assert property (@(posedge clk) !err);
legal_op: assume property (@(posedge clk) op != 2'd3);
no_err: assert property (@(posedge clk) !err);
out_rule: assume property (@(posedge clk) !err);
no_err: assert property (@(posedge clk) !err);
only_nop: assume property (@(posedge clk) op == 2'd0);
c_busy: cover property (@(posedge clk) busy);
no_err: assert property (@(posedge clk) !err);
module top(input clk, input want, output reg tok = 0, output req0, output req1);
always @(posedge clk) if (want) tok <= !tok;
assign req0 = want && !tok;
assign req1 = want && tok;
endmodule
one_req: assert property (@(posedge clk) !(req0 && req1));
no_want: assume property (@(posedge clk) !want);
c_req1: cover property (@(posedge clk) req1);
all_want: assume property (@(posedge clk) want);
c_req1: cover property (@(posedge clk) req1);
Simulator note: Every key was measured with the formal engine v1 (SymbiYosys, smtbmc yices). Your answer function is checked by a small bench on Icarus 12.
Examples
Example 1
Requester, Its Guarantee- Input
answer(0)
- Output
answer = 1
Proved: the token never lets both requests rise.
Example 2
Requester, Assume !want, Cover req1- Input
answer(1)
- Output
answer = 0
No want, no request: the cover is unreached.
Example 3
Requester, Assume Want, Cover req1- Input
answer(2)
- Output
answer = 1
With want held high the token alternates, so req1 rises: reached.
Constraints and Contract
- Return one value per question from answer(q).
- Keep the function header.
Hints
Hint 1
An assumption removes input sequences. It cannot remove a bug that legal inputs reach.
Hint 2
An assumption on an output removes the design's own behaviour, bugs included.
Hint 3
A cover on a normal event tells you whether an assumption left that event possible.
What the grader checks: Eight constant answers: three worked examples and five graded questions, each the result of one real formal run.
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 3 steps and the final capstone