A7.6.2 Vacuous Controls

MediumDebugIcarus · browser samples / server checksReview the topic

Two copies of one rule get different vacuous and fail controls. Count the action lines each prints, by the standard.

Hardware context: Two copies of a handshake rule with per-rule vacuous and fail controls. Keep real passes and drop vacuous ones, rule by rule, as the standard defines it.

Two identical rules, a1 and a2, watch the same handshake. $assertvacuousoff and $assertfailoff name one rule each; $assertpassoff and $assertnonvacuouson act on both.

Write answer(q). For questions 3 to 7, return how many lines of one kind a rule prints, by the standard.

Questions 0 to 2 are worked examples on single calls. Questions 3 to 7 are graded only by the full check.

Signals in the Timeline

SignalWidthRole
question4input of each check
Full specification
The program, questions 3 to 7
module tb;
  logic clk = 0;
  always #5 clk = ~clk;                         // rising edges at 5, 15, ..., 95
  logic req = 0, ack = 0;
  a1: assert property (@(posedge clk) req |-> ack) begin $display("a1 pass"); end else $display("a1 fail");
  a2: assert property (@(posedge clk) req |-> ack) begin $display("a2 pass"); end else $display("a2 fail");
  initial begin
    #17 $assertvacuousoff(0, tb.a1);            // t=17: a1 only
    #20 $assertpassoff;                         // t=37: both
    #20 $assertnonvacuouson;                    // t=57: both
    #20 $assertfailoff(0, tb.a2);               // t=77: a2 only
  end
  initial begin
    #12 req = 1; ack = 1;                       // edge 15: real pass
    #10 req = 0;                                // edge 25: vacuous
    #10 req = 1;                                // edge 35: real pass
    #10 ack = 0;                                // edge 45: fail
    #10 req = 0;                                // edge 55: vacuous
    #10 req = 1; ack = 1;                       // edge 65: real pass
    #10 req = 0;                                // edge 75: vacuous
    #10 req = 1; ack = 0;                       // edge 85: fail
    #10 ack = 1;                                // edge 95: real pass
    #6  $finish;                                // t=98
  end
endmodule
qReturnProgram
0after $assertpassoff alone: how many of one real pass and one vacuous pass run the pass actionworked example
1after $assertvacuousoff alone: does a real pass run the pass action (1 or 0)worked example
2after $assertvacuousoff then $assertpasson: does a vacuous pass run it (1 or 0)worked example
3"a1 pass" linesgraded
4"a1 pass" lines that come from vacuous passesgraded
5"a2 pass" linesgraded
6"a2 pass" lines from vacuous passes after t=37graded
7"a2 fail" linesgraded

Simulator note: The key follows IEEE 1800-2023 20.11. Verilator 5.052 ignores $assertvacuousoff and the scope list, and turns vacuous passes back on with $assertnonvacuouson, so it prints other counts. Your answer function is checked by a small bench on Icarus 12.

Examples

Example 1

PassOff Silences Both Kinds
Input
answer(0)
Output
answer = 0

After $assertpassoff no success runs the pass action, real or vacuous.

Example 2

VacuousOff Spares Real Passes
Input
answer(1)
Output
answer = 1

Only vacuous successes lose their pass action.

Example 3

PassOn Undoes VacuousOff
Input
answer(2)
Output
answer = 1

$assertpasson enables the pass action for both kinds of success.

Constraints and Contract

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

Hints

Hint 1

Write the result of each edge first. Vacuous: 5, 25, 55 and 75. Real passes: 15, 35, 65 and 95. Failures: 45 and 85.

Hint 2

$assertnonvacuouson brings back real passes only. Vacuous passes switched off stay off until $assertpasson.

Hint 3

A task that names tb.a1 leaves tb.a2 alone.

What the grader checks: Eight constant answers: three worked examples and five graded questions, keyed from IEEE 1800-2023 20.11 and derived by hand.

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

Report a problem with this page

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

PassOff Silences Both Kinds

Input
answer(0)
Expected output
answer = 0

After $assertpassoff no success runs the pass action, real or vacuous.

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

Icarus · browser samples / server checks