A3.5.3 One disable iff Only

EasyDebugVerilator · serverReview the topic

For fourteen small programs, say which reset disables the assertion chk, or that the code is illegal.

Hardware context: Small checker modules with default and explicit reset guards. Say which reset switches each assertion off, or that the code is illegal.

Each question is the body of a small module, tb. It may hold a default disable iff, a clause on the assertion, a named sequence or property, or a generate block. Two resets are in play, rst_a and rst_b.

Question 13 also declares a second module, child, before tb. The assertion chk sits in child, and tb instantiates it under its own default.

Write answer(q): 0 if nothing disables chk, 1 for rst_a, 2 for rst_b, and 3 if the code is illegal. Questions 0 to 2 are worked examples; questions 3 to 13 are graded only by the full check.

Signals in the Timeline

SignalWidthRole
question4input of each check
Full specification
qCode (inside module tb unless marked)Kind
0chk: assert property (@(posedge clk) disable iff (rst_a) a |=> b);worked example
1default disable iff (rst_a); chk: assert property (@(posedge clk) a |=> b);worked example
2property p; disable iff (rst_b) a |=> b; endproperty chk: assert property (@(posedge clk) p);worked example
3default disable iff (rst_a); chk: assert property (@(posedge clk) disable iff (rst_b) a |=> b);graded
4default disable iff (rst_a); chk: assert property (@(posedge clk) disable iff (1'b0) a |=> b);graded
5property p; disable iff (rst_a) a |=> b; endproperty chk: assert property (@(posedge clk) disable iff (rst_b) p);graded
6sequence s; disable iff (rst_a) a ##1 b; endsequence chk: assert property (@(posedge clk) s);graded
7default disable iff (rst_a); if (1) begin : g default disable iff (rst_b); chk: assert property (@(posedge clk) a |=> b); endgraded
8default disable iff (rst_a); property p; disable iff (rst_b) a |=> b; endproperty chk: assert property (@(posedge clk) p);graded
9chk: assert property (@(posedge clk) a |=> b); default disable iff (rst_a);graded
10default disable iff (rst_a); default disable iff (rst_b); chk: assert property (@(posedge clk) a |=> b);graded
11default disable iff (rst_a); if (1) begin : g default disable iff (rst_b); chk: assert property (@(posedge clk) disable iff (1'b0) a |=> b); endgraded
12property p; disable iff (rst_a) a |=> b; endproperty if (1) begin : g default disable iff (rst_b); chk: assert property (@(posedge clk) p); endgraded
13Before module tb: module child (input logic clk, a, b); chk: assert property (@(posedge clk) a |=> b); endmodule. Inside tb: default disable iff (rst_a); child u_child (.clk(clk), .a(a), .b(b));graded

Use IEEE 1800-2023 16.12 and 16.15. The keys of the legal questions are measured too. Each module runs with rst_a and rst_b high on different edges; the failure count of chk shows which one disabled it.

Examples

Example 1

A Clause of Its Own
Input
answer(0)
Output
answer = 1

No default in the module: the clause is the guard. Answer 1.

Example 2

A Default and No Clause
Input
answer(1)
Output
answer = 1

The assertion has no clause, so it takes the default. Answer 1.

Example 3

A Clause Inside a Named Property
Input
answer(2)
Output
answer = 2

The clause in the property body is the assertion's clause. Answer 2.

Constraints and Contract

  • Return one value from 0 to 3 per question from answer(q).
  • Keep the function header.

Hints

Hint 1

An assertion with its own disable iff ignores the default, and a clause in a named property counts as its own.

Hint 2

How many disable iff clauses may one assertion have, counting those inside the properties it uses?

Hint 3

Is disable iff part of a sequence, or of a property? And where does a default reach?

What the grader checks: Fourteen constant answers, graded against IEEE 1800-2023 16.12 and 16.15. Verilator 5.052 agrees on every one: the legal keys are measured failure counts, the illegal ones are compile errors.

14 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 4 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

A Clause of Its Own

Input
answer(0)
Expected output
answer = 1

No default in the module: the clause is the guard. Answer 1.

Run samples executes all 3 public checks. Check all tests runs 14 checks on the server.

Verilator · server