Read four versions of one failing check and say, for each severity task, whether the run goes on.
Hardware context: One failing immediate check with four different severity tasks in its else action. Say for each severity task whether the run goes on after the failure.
The program below runs four times on Icarus 12. Each time, the else action of the failing check calls a different severity task. The final block then prints n.
If the run goes on after the failure, n reaches 2. If the run ends there, the final block prints 1. Write answer(q) so it returns the printed value for each version.
Questions 0 to 2 are worked examples with other else actions. Questions 3 to 6 are the four severity tasks, graded only by the full check.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 4 | input of each check |
Full specification
module tb;
logic ok = <ok>;
int n = 0;
initial begin
n = 1;
assert (ok) else <action>;
n = 2;
end
final $display("n=%0d", n);
endmodule
| q | <ok> | <action> | Kind |
|---|---|---|---|
| 0 | 1 | $fatal(0, "ok is low") | worked example |
| 1 | 0 | $display("ok is low") | worked example |
| 2 | 0 | $finish | worked example |
| 3 | 0 | $info("ok is low") | graded |
| 4 | 0 | $warning("ok is low") | graded |
| 5 | 0 | $error("ok is low") | graded |
| 6 | 0 | $fatal(0, "ok is low") | graded |
A final block runs when the simulation ends, including an end caused by $finish.
Examples
Example 1
A Check That Passes- Input
answer(0)
- Output
n = 2
Here ok is 1, so the check passes and its else action never runs. No severity task is called, and n reaches 2.
Example 2
A Failure That Only Prints- Input
answer(1)
- Output
n = 2
$display is not a severity task. It prints its text, the next statement runs, and n reaches 2.
Example 3
A Failure That Ends the Run Itself- Input
answer(2)
- Output
n = 1
$finish ends the run before n = 2. The final block still runs at the end, so it prints n=1.
Constraints and Contract
- Return one value per question from answer(q).
- Keep the function header.
Hints
Hint 1
Which of the four tasks is meant to end a run in the standard?
Hint 2
Some tools stop at $error by default. Does the standard require that?
Hint 3
The number in $fatal(0, ...) chooses how much is printed. Does 0 change whether the run ends?
What the grader checks: Seven constant answers: three worked examples and one per severity task. They are graded against values measured on Icarus 12, which follows the standard here.
7 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