A3.3.3 Precedence of Property Operators

MediumDebugVerilator · serverReview the topic

Group nine unparenthesised sequences and properties the way the standard's precedence table does.

Hardware context: Unparenthesised assertion expressions from a checker library. Group sequence and property 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.

Questions 0 to 2 are worked examples on sequence operators. Questions 3 to 8 mix property operators and are graded only by the full check.

Signals in the Timeline

SignalWidthRole
question4input of each check
Full specification
qExpressionOption 0Option 1Kind
0a ##1 b[*2]a ##1 (b[*2])(a ##1 b)[*2]worked example
1a throughout b ##1 ca throughout (b ##1 c)(a throughout b) ##1 cworked example
2x within y intersect zx within (y intersect z)(x within y) intersect zworked example
3not a and b(not a) and bnot (a and b)graded
4a |-> b or c(a |-> b) or ca |-> (b or c)graded
5a until b implies c(a until b) implies ca until (b implies c)graded
6p and q or r(p and q) or rp and (q or r)graded
7x |-> y |=> z(x |-> y) |=> zx |-> (y |=> z)graded
8p iff q until r(p iff q) until rp iff (q until r)graded

Use IEEE 1800-2023 Table 16-3: operators higher in the table bind tighter; within one row, the associativity decides.

Examples

Example 1

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

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

Example 2

Delay Before Throughout
Input
answer(1)
Output
option = 0

## binds tighter than throughout, so a must hold through the whole b ##1 c: option 0.

Example 3

Within Before Intersect
Input
answer(2)
Output
option = 1

within binds tighter than intersect: option 1.

Constraints and Contract

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

Hints

Hint 1

not binds tighter than and, and and tighter than or.

Hint 2

|-> and |=> bind loosest of these, and group to the right.

Hint 3

until and implies share a row and group to the right; iff is one row above them.

What the grader checks: Nine constant answers, graded against IEEE 1800-2023 Table 16-1 (16.9.1) for the sequence operators and Table 16-3 (16.12) for the implication. Four graded forms are also measured on Verilator 5.052 (tools/probes/sva-w1a/delays-precedence.mjs): each counts like the grouping the table gives. Question 5 cannot be confirmed on 5.052 (it misses the failure that tells the groupings apart), and question 8 has no distinguishing trace.

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 4 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 b alone: option 0.

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

Verilator · server