Pass, Fail and Vacuous Controls

Silence pass or fail actions without stopping the checks, with $assertpassoff, $assertpasson, $assertfailoff, $assertfailon, $assertnonvacuouson and $assertvacuousoff.

You Will Be Able To

  • Predict which action blocks run after each action control task.
  • Tell a task that silences actions from one that stops checking.
  • Keep real passes and drop vacuous ones, by the standard and on Verilator 5.052.
  • Name where Verilator 5.052 departs from the standard.
Lesson
A7.6
Time
25 min
Runs on
Verilator
Check
5 questions

A regression log has 40,000 lines. 39,000 of them are "pass" messages from a handshake rule that is mostly idle. The team wants the failures and the real passes, not the vacuous ones. Six tasks switch the action blocks without touching the checks.

Three Kinds of Result, Three SwitchesEach attempt ends as a real pass, a vacuous pass or a failure. The tasks switch the action block of each kind; the check itself runs on.
  • Step
  • Result
  • Control / FSM
  • Control
call: who calls whomdata: where the transaction goes
Three kinds of result, three switchesEach attempt ends as a real pass, a vacuous pass or a failure. The tasks switch the action block of each kind; the check itself runs on. step attempt req |-> ack result real pass pass action result vacuous pass pass action result failure else action control $assertpassoff /passon both kinds of pass control $assertvacuousoff/ nonvacuouson one kind of pass control $assertfailoff /failon the else action ack highreq lowack lowswitchesswitchesswitches
  1. step attemptreq |-> ack
    • ack high → real pass
    • req low → vacuous pass
    • ack low → failure
  2. result real passpass action
  3. result vacuous passpass action
  4. result failureelse action
  5. control $assertpassoff / passonboth kinds of pass
    • switches → real pass
  6. control $assertvacuousoff / nonvacuousonone kind of pass
    • switches → vacuous pass
  7. control $assertfailoff / failonthe else action
    • switches → failure
  1. Three results

    An attempt of req |-> ack ends as a real pass, a vacuous pass or a failure.

  2. Pass actions

    $assertpassoff silences both kinds of pass. $assertvacuousoff silences only the vacuous ones.

  3. Fail actions

    $assertfailoff silences the else action, including the default $error. The failure still happens.

Read the diagram as text
  • attempt: req |-> ack
  • real pass: pass action
  • vacuous pass: pass action
  • failure: else action
  • $assertpassoff / passon: both kinds of pass
  • $assertvacuousoff / nonvacuouson: one kind of pass
  • $assertfailoff / failon: the else action
  • attempt → real pass: ack high
  • attempt → vacuous pass: req low
  • attempt → failure: ack low
  • $assertpassoff / passon → real pass: switches
  • $assertvacuousoff / nonvacuouson → vacuous pass: switches
  • $assertfailoff / failon → failure: switches

IEEE 1800-2023 20.11. None of these tasks stops a check; $assertoff does that.

$assertpassoff: No Pass Actions

$assertpassoff stops the pass action for every success, real or vacuous. The checks go on, and failures still run their else action.

Every program in this lesson uses the rule req |-> ack and the same stimulus. Real passes come at 15, 35 and 65, vacuous passes at 5, 25 and 55, and failures at 45 and 75.

$assertpasson: Pass Actions Again

$assertpasson turns the pass action back on for both kinds of success.

$assertfailoff: No Fail Actions

$assertfailoff stops the else action, and the default $error when there is no else. The failure still happens; only its report is gone.

$assertfailon: Fail Actions Again

$assertfailon turns the else action back on. Failures inside the silent window stay unreported.

$assertnonvacuouson: Real Passes Only

After $assertpassoff, $assertnonvacuouson turns the pass action back on for real passes only. Vacuous passes stay silent.

Standard behaviour: $assertpassoff at 27, $assertnonvacuouson at 50
01234567edge (ns)515253545556575resultvacrealvacrealfailvacrealfailaction, standardpass-else-passelseaction, Verilator 5.052pass-elsepasselsethe vacuous pass at 55
Scroll horizontally ↔

Standard behaviour, derived from IEEE 1800-2023 20.11 (docs/sva-standard-traces/A7.md, sva-187). The last row was measured: Verilator 5.052 turns both kinds of pass back on.

On Verilator 5.052, let the pass action tell the two kinds apart itself. A real pass of req |-> ack has req high in its sampled value.

$assertvacuousoff: No Vacuous Pass Actions

$assertvacuousoff stops the pass action on vacuous successes only. Real passes and failures still run their actions.

Standard behaviour: $assertvacuousoff at 27
01234567edge (ns)515253545556575resultvacrealvacrealfailvacrealfailaction, standardpasselse-passelseaction, Verilator 5.052passelsepasselsethe vacuous pass at 55
Scroll horizontally ↔

Standard behaviour, IEEE 1800-2023 20.11; the rule is derived in docs/sva-standard-traces/A7.md, sva-188, on another stimulus. Verilator 5.052 accepts the task and ignores it (measured).

Where the Tool and the Standard Part

CodeStandardVerilator 5.052 (measured)
$assertvacuousoff;vacuous passes run no pass actionignored
$assertpassoff; then $assertnonvacuouson;real passes print again, vacuous ones stay silentboth kinds print again
a bare if statement as the pass action, then $assertpassoff;the pass action stopsignored; inside begin-end it works

IEEE 1800-2023 20.11. Measured by tools/probes/sva-w1b/departures.mjs.

Try It

The log keeps every failure and every real pass from 50 on. The window from 27 to 50 is fully silent for passes, and the vacuous pass at 55 never prints.

Move vac_on = 0 to 27 and remove both tasks. Predict which lines change: that is the effect of $assertvacuousoff.

RUNVerilator · simulator service
Edit the code, then run it
Expected: t=5 vacuous pass t=15 real pass t=25 vacuous pass t=45 fail t=65 real pass t=75 fail

Check Yourself

Predict the outputThe rule passes, then fails, then passes again. Predict the output.
module tb;
  logic clk = 0;
  always #5 clk = ~clk;                        // rising edges at 5, 15, 25, ...
  logic ok = 1;
  int passes = 0, fails = 0;
  chk: assert property (@(posedge clk) ok) passes++; else fails++;
  initial begin
    #12 $assertfailoff;                        // t=12
    #10 ok = 0;                                // t=22: fails from 25
    #10 $assertpassoff; $assertfailon;         // t=32
    #10 ok = 1;                                // t=42: passes from 45
    #16 $display("passes=%0d fails=%0d", passes, fails);   // t=58
    $finish;
  end
endmodule
Spot the bugThe goal at 27: silence every pass action, and keep the failure at 45 visible. Which call fails that goal?
ConceptAfter $assertfailoff, a rule fails. What happens?
ConceptWhich call, after $assertpassoff, brings back the pass action for real passes only?
ConceptOn Verilator 5.052, what does $assertvacuousoff do?

Common Mistakes

Wrong Use $assertfailoff to quiet a noisy log.

It hides real failures; the regression then reports a clean run.

Fix Silence passes with $assertpassoff or $assertvacuousoff, and leave failures on.

Wrong Expect $assertpassoff to stop the checks.

It only skips pass actions; the attempts still run and still fail.

Fix Use $assertoff or $assertkill to stop checking.

Wrong Rely on $assertvacuousoff on Verilator 5.052.

The tool ignores it, so vacuous passes still print.

Fix Test $sampled of the antecedent in the pass action, inside begin-end.

Before
hs: assert property (req |-> ack)
  passes++;
After
hs: assert property (req |-> ack)
  begin if ($sampled(req)) passes++; end

Remember

  • Action control tasks switch action blocks; the checks and their verdicts go on.
  • $assertpassoff and $assertpasson switch both kinds of pass; $assertfailoff and $assertfailon switch the else action.
  • $assertvacuousoff silences vacuous passes only; $assertnonvacuouson brings back real passes only.
  • Verilator 5.052 ignores $assertvacuousoff and makes $assertnonvacuouson act like $assertpasson.

Practice

Report a problem with this page