Skip to Fundamentals questions

Part 1 · Fundamentals

SystemVerilog AssertionsSampling and assertion anatomy

Learn what a property samples, how assertion scheduling avoids races, and how Boolean expressions become sequences, properties, and directives.

Question directory

Questions for Fundamentals

Open a question at its supporting explanation. The complete property reference stays directly above each answer set.

Start with the reading method

Read every property as seven explicit decisions.

This is the shortest path from an English requirement to reviewable SVA. If one decision is missing, the property is probably underspecified.
Sampling grid

Sample one coherent snapshot at every positive clock edge.

Each waveform column is one posedge of clk. Temporal delays count these sampling events, not simulator time and not arbitrary signal transitions between edges.

Selected clause@(posedge clk)
All eight columns are sampling events. One ##1 delay moves exactly one column to the right.
Complete request-to-acknowledgement contractSystemVerilog
a_req_ack: assert property (
  @(posedge clk) disable iff (!rst_n)
  $rose(req) |-> ##[1:3] (ack && !$isunknown(ack))
) else $error("ack missing or unknown: ack=%b", $sampled(ack));

c_last_slot: cover property (
  @(posedge clk) disable iff (!rst_n)
  $rose(req) ##1 !ack[*2] ##1 ack
);

Clock. Sampling grid. All eight columns are sampling events. One ##1 delay moves exactly one column to the right.

RequirementSampled tracePropertyDiagnostic + coverage

01 · Sampling modelReason from the sampled clock edge.

Separate simulation updates from assertion sampling, then explain exactly when a concurrent property observes, evaluates, and reports a result.

Concept modelOne clock tick crosses three assertion regions
01SamplePreponed

Capture values before Active and NBA updates.

02EvaluateObserved

Run the property using the sampled values.

03ReportReactive

Execute the concurrent pass or fail action.

disable iff observes current values and can abort between sampled clock events.

Concurrent properties sample design values in Preponed, evaluate those samples in Observed, and schedule pass or fail action blocks in Reactive.

Always-visible reference

Learn the mechanism before testing the interview answer.

These notes, tables, examples, and design limits contain the working knowledge for this chapter. The interview questions below are a checkpoint, not the primary explanation.

Why assertions

Use SVA as an executable contract, not as decorative checking.

A useful assertion turns one requirement into an observable, reusable rule. It catches the failure close to its source, documents the intended behavior, and can run in both simulation and formal analysis.
Specification

Capture intent precisely

Name the clock, reset policy, trigger, deadline, and required outcome. The property is only as correct as that translation.

Observability

Fail near the cause

Internal invariants can expose a corrupt state before the bug propagates to a scoreboard-visible output.

Reuse

Carry checks with the IP

Interface and block contracts can run in unit simulation, subsystem regression, emulation where supported, and formal harnesses.

Evidence

Measure exercise separately

Assertion coverage and cover properties show whether attempts and important scenarios occurred. They do not replace data-oriented covergroups.

Two execution models

Choose the assertion form that matches the requirement.

Immediate assertions are procedural checks at one execution point. Concurrent assertions create clocked attempts that can span many samples.
FormWhen it evaluatesBest useImportant caution
assert (expr)When procedural control reaches itLocal combinational or algorithmic invariantSimple form can observe transient delta-cycle values
assert #0 / assert finalDeferred within the current time slotSettled combinational resultStill procedural, not a multi-cycle temporal property
assert propertyOn the declared or inherited sampling eventLatency, ordering, stability, pulse, and protocol rulesUses sampled values and can create overlapping attempts
Procedural invariant and temporal contractSystemVerilog
always_comb begin
  a_grant_shape: assert final ($onehot0(grant))
    else $error("grant is not one-hot-or-zero");
end

a_req_ack: assert property (
  @(posedge clk) disable iff (!rst_n)
  $rose(req) |-> ##[1:3] ack
);

Scheduler model

The sampled value can differ from the waveform value you see later.

At a concurrent assertion clock event, design values are sampled before Active and NBA updates. The property evaluates those samples later in the same time slot, and its action block runs after the result is known.
Preponed

Sample

Capture the values used by the property before ordinary Active-region logic and nonblocking assignment updates.

Observed

Evaluate

Evaluate sequence matches and property truth using the Preponed samples.

Reactive

Report

Run pass or fail action blocks. Use $sampled(signal) when the message must show the value that the property evaluated.

Asynchronous control

Abort

disable iff observes its current expression and can terminate an active attempt between sampling events.

Report sampled failure contextSystemVerilog
a_state_known: assert property (
  @(posedge clk) disable iff (!rst_n)
  !$isunknown(state)
) else $error(
  "sampled state=%b current state=%b",
  $sampled(state), state
);

Function handbook

Use the sampled-value and four-state helpers deliberately.

Every history function is interpreted on the property's sampling event. Vector edge functions inspect the least significant bit, so write an explicit vector comparison when the requirement is broader.
FunctionMeaning at this sampleTypical contract
$rose(x)LSB changed from 0/X/Z to 1One attempt per rising event
$fell(x)LSB changed from 1/X/Z to 0Release or completion edge
$stable(x)Whole expression equals its prior samplePayload held under stall
$changed(x)Whole expression differs from its prior sampleState or ownership transition
$past(x, n)Value sampled n clock events earlierHistory and causality
$sampled(x)Value captured for this assertion evaluationAccurate failure message
$onehot(x)Exactly one bit is 1Exactly one owner
$onehot0(x)Zero or one bit is 1Idle-capable one-hot grant
$isunknown(x)At least one bit is X or ZFour-state control integrity
$countones(x)Number of bits equal to 1Population limit

Deployment

Place each checker where its inputs and ownership are clear.

White-box checks belong near internal state and datapath invariants. Black-box protocol checks belong at interfaces or in bound checkers. System-level ordering may require state outside a pure temporal property.
LocationSeesBest forOwnership risk
RTL moduleInternal state and datapathWhite-box invariantsTight implementation coupling
interfaceProtocol signalsReusable interface contractClock and modport conventions
checker + bindExplicit checker portsNon-invasive integrationAccidental bind to every module instance
formal harnessBoundary inputs and stateAssumptions, assertions, coversOverconstraint
scoreboard/modelTransactions and historyIdentity, ordering, one-to-one accountingNot a replacement for local assertions

Interview checkpoint

Explain the rule, then defend its edge cases.

Open a prompt after studying the reference above. A strong answer should name the sampled edge, match endpoint, failure mode, and proof evidence.

Strong answer

SVA stands for SystemVerilog Assertions. It adds executable Boolean and temporal properties that can check design behavior in simulation and formal analysis, and can record that meaningful scenarios occurred.

Why it works

  • Immediate assertions check a condition at a procedural execution point. Concurrent assertions describe sampled behavior across one or more clock events.
  • Assertions work best as compact contracts near an interface, block, or bound checker, not as a replacement for scoreboards and end-to-end data models.
  • A useful assertion names the requirement, states its clock and reset policy, and reports enough sampled context to reproduce a failure.
What the interviewer is testing

Whether you can describe assertions as executable specifications and choose them for temporal control behavior without claiming they replace every verification technique.

Common trap

Do not define SVA as only a simulator feature. The same property language is also central to formal verification and assertion coverage.

  • SVA
  • assertions
  • simulation
  • formal

02 · Assertion anatomyBuild the temporal sentence in layers.

Start with Boolean expressions, compose sequences across sampled clocks, turn them into properties, and finally choose assert, assume, or cover.

Concept modelSVA grows from values into verification intent
01Booleanreq && readyValue now
02Sequencereq ##[1:3] ackMatch across clocks
03Propertyreq |-> responseConditional obligation
04Directiveassert property (...)Verification job
Delay##n · ##[m:n]
Repeat[*] · [=] · [->]
Matchand · or · intersect
Spanthroughout · within
Outcome|-> · |=>
Each layer adds one kind of meaning. A directive gives a property a job; it does not change the property's timing semantics.

Always-visible reference

Learn the mechanism before testing the interview answer.

These notes, tables, examples, and design limits contain the working knowledge for this chapter. The interview questions below are a checkpoint, not the primary explanation.

Language model

Identify the language layer before explaining an operator.

The same-looking words can have different semantics at the Boolean, sequence, property, and directive layers. Build the rule from the bottom up.
LayerQuestion it answersRepresentative syntax
Boolean expressionWhat is true on this sample?req && ready, !$isunknown(state)
SequenceWhat temporal pattern matched?req ##[1:3] ack, beat[*4]
PropertyWhat obligation is true or false?trigger |-> consequent, disable iff
DirectiveWhat should the tool do?assert, assume, cover, expect

Reusable syntax

Name sequences and properties when the timing deserves a name.

A named sequence may have formal arguments, local variables, and an explicit or inherited clock. A property adds implication, reset, and truth-valued composition. Keep the trigger and outcome visible at the call site.
Sequence, property, checker, and bindSystemVerilog
sequence s_req_to_ack;
  $rose(req) ##[1:3] $rose(ack);
endsequence

property p_req_to_ack;
  @(posedge clk) disable iff (!rst_n)
  $rose(req) |-> ##[1:3] $rose(ack);
endproperty

checker req_ack_checker (
  input logic clk, rst_n, req, ack
);
  a_req_to_ack: assert property (p_req_to_ack);
endchecker

bind request_unit
  req_ack_checker i_req_ack_checker (.*);

Operator atlas

Use this table to translate English timing into SVA.

Parenthesize mixed temporal operators even when you know precedence. It makes the intended start point, span, and endpoint reviewable.
FamilySyntaxCore meaningTypical mistake
Delay##0, ##n, ##[m:n]Concatenate sequence elements by sampled clocksCounting simulator time instead of samples
Consecutive repeat[*n], [*m:n]Repeat a Boolean or sequence on consecutive samplesForgetting the implicit ##1 between repeats
Nonconsecutive repeat[=n], [=m:n]Count Boolean hits with gaps and optional trailing slackExpecting the match to end on the last hit
Goto repeat[->n], [->m:n]Count Boolean hits with gaps and end on the final hitApplying it to an arbitrary sequence
Sequence choiceorEither sequence match is sufficientAssuming only one candidate endpoint exists
Sequence conjunctionandBoth start in one compound attempt; later endpoint winsTreating it like Boolean &&
Endpoint conjunctionintersectBoth sequence matches must share an endpointUsing it when different endpoints are legal
Spanexpr throughout seqExpression holds over every sample of the selected matchForgetting the endpoint is included
Containmentinner within outerA complete inner match fits inside outerConfusing containment with implication
Implication|->, |=>Create a conditional property obligationClaiming |=> serializes attempts
Endpoint selectionfirst_match(seq), seq.endedSelect earliest match or observe a named endpointConfusing endpoint selection with transaction ownership
Outcome controldisable iff, accept_on, reject_onAbort or force an attempt outcomeTreating all three as reset

Per-attempt state

A property-local variable belongs to one attempt.

Capture a sampled value in a sequence match item. Every overlapping attempt receives its own copy, which makes local variables useful for correlation but not for global event consumption.
  • The comma introduces a sequence match item and captures the value when the trigger matches.
  • Do not use a standalone assignment as if it were a sequence expression.
  • One response can still satisfy multiple overlapping attempts. Use outstanding-ID state or a scoreboard for one-to-one accounting.
  • Functions called from assertion expressions should be side-effect-free. Verify tool support for complex dynamic, class, handle, or real-valued constructs.
Capture an ID legallySystemVerilog
property p_tagged_response;
  logic [ID_W-1:0] saved_id;

  @(posedge clk) disable iff (!rst_n)
    ($rose(req), saved_id = req_id)
      |-> ##[1:8] (rsp && rsp_id == saved_id);
endproperty

Interview checkpoint

Explain the rule, then defend its edge cases.

Open a prompt after studying the reference above. A strong answer should name the sampled edge, match endpoint, failure mode, and proof evidence.