A7.7.1 One Task for All Controls

MediumFixVerilator · serverReview the topic

Fix an assertion plan written with $assertcontrol: lock the safety check, kill the design rule during reset, keep the bench assumption on.

Hardware context: A bench with a safety check, a design rule and a bench assumption, and a library that switches checks. Write one assertion plan that locks, kills and filters by assertion and directive type.

A bench has three checks. crit, an immediate assertion, is a safety rule: nothing may switch it off, and a library does try. hs, a concurrent assertion, is a design rule: it sleeps through each reset. env, a concurrent assume, is the bench's promise not to request during reset: it must keep checking then.

The module assert_plan holds the plan, written with $assertcontrol only. It has three bugs. Fix it, and add one more line: the log must carry no pass messages from concurrent assertions, from time 0 on.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
rst1stimulus, the same for every design
req1stimulus, the same for every design
ack1stimulus, the same for every design
Full specification
The port (keep it)
module assert_plan (
  input logic rst      // the design reset
);
  // your plan, with $assertcontrol
endmodule
TimeWhat the program shown here doesExpected
15 to 35an hs attempt; a reset from 22 to 32 stops ackno hs failure
25the bench requests during the resetenv fails once
20a library calls $assertcontrol(4, 2)crit stays on
55a and b both highcrit fails once
75 to 95a request with no ackhs fails once
every edgehs passes (vacuously or not)no pass action runs

The full check also runs a second program, after this one, with two resets and another clock. This page does not show it.

Examples

Example 1

The Safety Bug Is Caught
Input
Program: a and b high at 55
Output
crit = 1

crit must still be on at 55, after the library's call at 20.

Example 2

Only the Real Hs Bug
Input
Program: a reset at 22, a missing ack at 95
Output
hs = 1

The attempt interrupted by the reset reports nothing; the missing ack at 95 does.

Example 3

The Bench Bug Is Caught
Input
Program: a request during the reset
Output
env = 1

env checks during the reset and fails at 25.

Constraints and Contract

  • Use $assertcontrol only. Filter by assertion type and directive type.
  • The safety check can never be switched off. The design rule is quiet during each reset, with no failure from an interrupted attempt. The assumption checks all the time.
  • Pass actions of concurrent assertions are off from time 0; failures still report.
  • Do not change the port.

Hints

Hint 1

A lock freezes the state the assertion has at that moment. When must it run?

Hint 2

Directive type: 1 assert, 2 cover, 4 assume. Assertion type: 1 concurrent, 2 simple immediate.

Hint 3

Off lets a running attempt finish. Which control type cancels it?

Hint 4

Control types 6 to 11 switch action blocks only: 7 is PassOff, 9 is FailOff.

What the grader checks: Your module watches two fixed programs, one after the other: the one shown here and a hidden one with two resets. Graded on each: the failure counts of crit, hs and env, and the pass actions of hs.

8 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 1 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

The Safety Bug Is Caught

Input
Program: a and b high at 55
Expected output
crit = 1

crit must still be on at 55, after the library's call at 20.

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

Verilator · server