A2.1.3 Read It the Way the Tool Does

MediumDebugVerilator · serverReview the topic

Group nine unparenthesised sequences the way the precedence table, and so the simulator, groups them.

Hardware context: Unparenthesised assertion code read by a simulator. Group sequence operators the way the precedence table does.

Each question is an expression with no parentheses, and two ways to group it. Write answer(q) so it returns the option the standard uses: 0 or 1.

A simulator reads the code by the same table, so a wrong reading checks a different rule from the one you meant. Questions 0 to 2 are worked examples; questions 3 to 8 are graded only by the full check.

Signals in the Timeline

SignalWidthRole
question4input of each check
Full specification
qExpressionOption 0Option 1Kind
0req ##1 ack[*2]req ##1 (ack[*2])(req ##1 ack)[*2]worked example
1a intersect b and ca intersect (b and c)(a intersect b) and cworked example
2a ##2 b ##1 c(a ##2 b) ##1 ca ##2 (b ##1 c)worked example
3req ##1 gnt and ready |-> done(req ##1 (gnt and ready)) |-> done((req ##1 gnt) and ready) |-> donegraded
4v throughout a ##1 b ##1 cv throughout (a ##1 b ##1 c)(v throughout a) ##1 b ##1 cgraded
5v throughout a or b(v throughout a) or bv throughout (a or b)graded
6s ##1 a |-> b ##1 c(s ##1 a) |-> (b ##1 c)s ##1 (a |-> b ##1 c)graded
7a and b or c and da and (b or c) and d(a and b) or (c and d)graded
8p within q ##1 r(p within q) ##1 rp within (q ##1 r)graded

Use IEEE 1800-2023 Table 16-1 for the sequence operators and Table 16-3 for the implications. Operators higher in a table bind tighter; within one row, the associativity decides. Operators on plain values, such as &&, || and !, bind tighter than every sequence operator.

Examples

Example 1

Repetition Before Delay
Input
answer(0)
Output
option = 0

Repetition binds tightest, so [*2] applies to ack alone: option 0.

Example 2

Intersect Before And
Input
answer(1)
Output
option = 1

intersect is higher in the table than and: option 1.

Example 3

## Groups to the Left
Input
answer(2)
Output
option = 0

## is left-associative: option 0. Both groupings match the same traces, so here the rule changes nothing.

Constraints and Contract

  • Return 0 or 1 for each question from answer(q).
  • Keep the function header.

Hints

Hint 1

Find the row of each operator in Table 16-3. Which of the two sits higher?

Hint 2

## binds tighter than throughout, within, and and or.

Hint 3

Where do the implications sit in the table, compared with every sequence operator?

What the grader checks: Nine constant answers, graded against IEEE 1800-2023 Table 16-3. Five graded forms are also measured on Verilator 5.052 (tools/probes/sva-w1a/delays-precedence.mjs): each counts like the grouping the table gives.

9 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 6 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

Repetition Before Delay

Input
answer(0)
Expected output
option = 0

Repetition binds tightest, so [*2] applies to ack alone: option 0.

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

Verilator · server