← Design Verification Interviews
Interview Question · Code Reading
What First Match Changes
The Question
The interviewer asks
The spec says done follows the first ack after a request by exactly one cycle, and ack may pulse more than once. Compare these two properties on a trace with ack at +1 and +2 and done at +3.
a_plain: assert property (@(posedge clk) req |-> ##[1:3] ack ##1 done);
a_first: assert property (@(posedge clk) req |-> first_match(##[1:3] ack) ##1 done);You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
a_plain passes: its thread through the second ack at +2 finds done at +3, and one matching thread is enough. a_first fails. first_match keeps only the earliest end point of the range, the ack at +1, so done must come at +2, and it does not. Use first_match when only the earliest occurrence may count, which is what "the first ack" means.
Without first_match, any thread can satisfy the rest of the sequence.
Self-Check
Tick each key point you covered in your answer.
What Interviewers Listen For (Mid-Level)
A good mid-level answer follows both threads of the plain property. It explains why the later thread rescues the attempt.
What Interviewers Listen For (Senior)
A good senior answer knows that many tools get first_match wrong. It checks tool support, and often rewrites the rule as two assertions keyed on the event itself.
Cross-Questions
Where the interviewer goes next. Open a node to practise that follow-up.
WhyWhat IfBreak ItCompare
- What First Match Changes
-
CompareFirst Match vs Two Assertions Keyed on the EventL2 Mid-Level
Compare
req |-> first_match(##[1:3] ack) ##1 donewith the pairreq |-> ##[1:3] ackandack |=> done.2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
The pair is close but not the same.
ack |=> donedemandsdoneafter everyack, including the second pulse. Thefirst_matchform only cares about the first one. If everyackreally owes adone, the pair is simpler, easier to debug and runs on every simulator. If later pulses must not owe one, you need thefirst_matchform or a small model that marks the firstack.first_matchformack |=> donepairWhich acks owe a doneOnly the first one Every one Debug One property to read Each half reports on its own Runs on every simulator No Yes Self-Check
Tick each key point you covered in your answer.
Half-Truth
"The two forms are always equivalent."
They differ when
ackcan pulse more than once per request, which is exactly the casefirst_matchwas used for.Source IEEE 1800-2017 §16.9.8
-
WhyWhy First Match Matters in an AntecedentL3 Senior
Why does
first_matchmatter even more in an antecedent, as infirst_match(req ##[1:3] gnt) |=> busy?2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Each end point of the antecedent starts its own check of the consequent. Without
first_match, two grants inside the window start two obligations for one request, sobusyis demanded after each.first_matchkeeps one end point per start and one obligation per request.Self-Check
Tick each key point you covered in your answer.
Misconception
"A ranged antecedent starts one check per attempt."
It starts one check per end point of the antecedent match, which can be several per attempt.
Source IEEE 1800-2017 §16.12.7
-
Break ItFirst Match That Turns a Pass into a FailureL3 Senior
Break it: show a consequent where adding
first_matchturns a pass into a failure.2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Take
req |-> ##[1:3] gnt ##1 busy. Withoutfirst_match, the attempt passes if any grant in the window is followed bybusy. Withfirst_match(##[1:3] gnt) ##1 busy, only the first grant counts. Ifbusyfollows the second grant but not the first, the first form passes and the second fails.Self-Check
Tick each key point you covered in your answer.
Misconception
"
first_matchonly matters for performance."It changes which end points exist. In a consequent, fewer end points can turn a pass into a failure.
Source IEEE 1800-2017 §16.9.8
-
What IfWhy One Match Ends the AttemptL1 Junior
Asked if they ask about ranges at the end of a consequent
Why does the implication stop at the first match of
busy[*2:4]instead of checking the longest one?2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
A property built from a sequence asks whether the sequence can match. The implication succeeds as soon as one consequent match exists. Longer matches add nothing to that answer. Anything that must happen after the match has to be written as more sequence or as a separate rule.
Self-Check
Tick each key point you covered in your answer.
Misconception
"The simulator picks the longest match, like a greedy regular expression."
There is no greedy choice; the property holds if any match exists, and the earliest one already proves it.
Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §8.8 (PDF p142)
-
Break ItA First Match Rule That Never FailsL2 Mid-Level
Your
first_matchrule has passed every regression for months. How do you find out whether it can fail at all?log a_first: 0 failures in 2,431 tests (no directed test violates the first-ack rule)2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Write a small directed test whose traffic must break the rule: here, an
ackat +1 withdoneonly at +3. Check that the assertion reports exactly that failure. If it does not, the tool is not evaluating the construct and the months of passes are worthless. This negative control belongs next to every non-trivial property.Self-Check
Tick each key point you covered in your answer.
Wrong Altitude
"Mutating the design is the only way to test an assertion."
A directed must-fail stimulus is often enough, much cheaper, and exactly targets the construct in doubt.
What People Get Wrong
Common wrong answers and why they fail.
Misconception
"Without first_match, a range always uses the first occurrence."
Every delay in the range starts a thread. Any thread that completes the sequence makes the attempt pass, so a later ack can rescue it.
Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §8.28 (PDF p181)
Tool as Truth
"first_match passed in our simulator, so the design meets the first-ack rule."
Verilator 5.052 reports no failure for first_match over a range followed by more sequence. A newer build rejects it. So that pass proves nothing.
Source ASIC Point engine notes (Verilator 5.052 SVA probes), row "first_match"
Wrong Altitude
Puts first_match around every range "to be safe".
On a range at the end of a consequent it changes nothing, because the attempt already passes at the first match. It only adds tool risk.