Skip to main content

Module 6 — Assertions

VLSI Verification  •  SystemVerilog Series

Module 6 — Assertions



SystemVerilog Assertions (SVA): immediate vs concurrent assertions, properties, sequences, and the implication and repetition operators that let you describe complex temporal protocol behavior declaratively.

🧩 Intermediate → Advanced ⏱ ~22 min read 💻 Code Examples Included

50Immediate Assertions

Immediate assertions are procedural, executed like a statement inside always/initial blocks — they check a boolean expression at the instant they execute, with no notion of time or clocking.

SystemVerilog
always_ff @(posedge clk) begin // basic immediate assertion a_no_x_addr: assert (!$isunknown(addr)) else $error("addr went to X/Z at time %0t", $time); // with explicit pass AND fail actions a_range_check: assert (addr < 16'h1000) $display("addr in range, OK"); // pass action else $fatal(1, "addr out of range: %0h", addr); // fail action end
AspectImmediate AssertionConcurrent Assertion
EvaluationInstant, procedural (like an if-statement)Clock-based, over multiple cycles
Can Describe Sequences?No — single point-in-time checkYes — temporal/multi-cycle behavior
PlacementInside procedural blocks onlyModule-level, procedural blocks, or interfaces
Typical UseSimple sanity/legality checks (no X, in-range)Protocol compliance (req-ack handshakes, pipeline timing)

51Concurrent Assertions

Concurrent assertions describe behavior over time, sampled on a clock edge — they can express "if X happens, then Y must happen within N cycles," making them the tool of choice for protocol checking.

SystemVerilog
// request must be followed by ack within 4 cycles a_req_ack: assert property ( @(posedge clk) disable iff (!rst_n) req |-> ##[1:4] ack ) else $error("ack missing within 4 cycles of req"); // concurrent assertion as a standalone module-level statement // (doesn't need to be inside always/initial) property p_fifo_no_overflow; @(posedge clk) (wr_en && full) |-> 1'b0; endproperty a_no_overflow: assert property (p_fifo_no_overflow); // "cover property" -- NOT a checker, just records whether // the scenario ever occurred (a form of assertion-based coverage) c_back_to_back_wr: cover property ( @(posedge clk) wr_en ##1 wr_en );
💡 disable iff

disable iff (!rst_n) is the standard way to suppress assertion checking during reset — without it, assertions often fire spuriously while the DUT is still in an undefined post-reset state.

52Properties

A property is a named, reusable temporal specification built from boolean expressions, sequences, and implication/logical operators — it's the thing that assert/cover/assume statements check.

SystemVerilog
property p_valid_ready_handshake; @(posedge clk) disable iff (!rst_n) valid && !ready |=> valid; // valid must stay high until ready seen (AXI-style) endproperty property p_one_hot_state; @(posedge clk) $onehot(state_vector); endproperty // properties can take arguments -- reusable across multiple signals property p_max_pulse_width(logic sig, int max_cycles); @(posedge clk) $rose(sig) |-> ##[0:max_cycles] $fell(sig); endproperty // reused for two different signals with different limits assert property (p_max_pulse_width(req, 10)); assert property (p_max_pulse_width(grant, 20));
📘 assert vs assume vs cover

The same property can be used three ways: assert property(p) checks it must hold (bug if violated); assume property(p) tells formal tools/simulators to treat it as a constraint on the environment (used heavily in formal verification); cover property(p) just records whether the scenario ever happened.

53Sequences

A sequence describes an ordered pattern of boolean expressions across clock cycles — the temporal "phrase" building block that properties are constructed from.

SystemVerilog
// basic sequence -- req, then grant exactly 2 cycles later sequence seq_req_grant; req ##2 grant; endsequence // sequence with a variable delay range sequence seq_req_grant_range; req ##[1:5] grant; endsequence // sequences can be combined with 'and' / 'or' / 'intersect' sequence seq_combo; seq_req_grant and (data_valid ##1 data_ready); endsequence // use a sequence inside a property property p_handshake_ok; @(posedge clk) seq_req_grant |-> ##1 ack; endproperty assert property (p_handshake_ok);
💡 Sequences vs Properties

Think of a sequence as a noun phrase ("req followed 2 cycles later by grant") and a property as the full sentence built from one or more sequences plus implication logic ("IF this sequence happens, THEN that must follow"). Sequences alone can't be directly asserted — they need to be wrapped in a property (or used with a bare assert property(seq), which SV allows as shorthand).

54Implication Operators

Implication operators (|-> and |=>) express "if the antecedent (left side) matches, then the consequent (right side) must hold" — the core mechanism for conditional protocol checking.

SystemVerilog
// |-> (overlapped implication) -- consequent checked in the // SAME cycle the antecedent matches property p_overlap; @(posedge clk) req |-> grant; // grant must be high in the SAME cycle as req endproperty // |=> (non-overlapped implication) -- consequent checked // starting the NEXT cycle after the antecedent matches property p_nonoverlap; @(posedge clk) req |=> grant; // grant must be high the cycle AFTER req endproperty // equivalent forms -- |=> is literally shorthand for |-> ##1 property p_equivalent; @(posedge clk) req |-> ##1 grant; // same as "req |=> grant" endproperty // chained implications for multi-step protocols property p_full_txn; @(posedge clk) req |=> grant ##1 (valid throughout (data_beat[0:3])); endproperty
OperatorNameConsequent Checked
|->Overlapped implicationSame clock cycle as the antecedent match
|=>Non-overlapped implicationStarting one cycle after the antecedent match
🚫 Interview Favorite

"Explain the difference between |-> and |=>" is one of the single most common SVA interview questions. Remember: |=> is exactly equivalent to |-> ##1 — non-overlapped just adds one implicit cycle of delay before checking the consequent.

55Repetition Operators

Repetition operators let a sequence match a signal holding a value (or matching a sub-sequence) a specific or variable number of times — essential for expressing burst/back-pressure protocol behavior concisely.

SystemVerilog
// [*n] -- consecutive repetition, exactly n times sequence seq_busy_4cyc; busy[*4]; // busy must be high for exactly 4 CONSECUTIVE cycles endsequence // [*n:m] -- consecutive repetition, between n and m times sequence seq_busy_range; busy[*2:6]; // busy high for 2 to 6 consecutive cycles endsequence // [->n] -- goto repetition: matches on the nth time the // expression becomes true, WITHOUT requiring consecutive cycles sequence seq_3rd_ack; ack[->3]; // waits until ack has pulsed high a 3rd time (non-consecutive OK) endsequence // [=n] -- non-consecutive repetition (like goto but doesn't // anchor the sequence end to the matching cycle) sequence seq_err_seen_twice; err[=2] ##1 recovery_done; // err must occur (non-consecutively) exactly // twice at SOME point before recovery_done endsequence // combined with implication for a full burst-check property property p_burst_of_8; @(posedge clk) start_burst |=> valid[*8] ##1 !valid; endproperty
OperatorNameMeaning
[*n]Consecutive repetitionExpression true for exactly n consecutive cycles
[*n:m]Consecutive range repetitionTrue for between n and m consecutive cycles
[->n]Goto repetitionMatches at the nth occurrence, non-consecutive allowed
[=n]Non-consecutive repetitionExpression true exactly n times, non-consecutively, without anchoring sequence end there
💡 Interview Tip

"Difference between [->n] and [=n]?" — Both allow non-consecutive matches, but [->n] anchors the sequence's completion to the exact cycle of the nth match (so anything chained after it with ## counts from there), while [=n] just requires n occurrences somewhere within the overall sequence window, without anchoring.

🎯 Module 6 Recap

  • Immediate assertions check a condition instantly and procedurally; concurrent assertions check temporal behavior over clock cycles.
  • property is the full checkable specification; sequence is a reusable temporal building block used inside properties.
  • |-> checks the consequent in the same cycle; |=> checks it starting the next cycle (equivalent to |-> ##1).
  • Repetition operators ([*n], [*n:m], [->n], [=n]) compactly express consecutive vs non-consecutive repeated matches.
  • The same property can be used with assert (must hold), assume (treat as environment constraint, esp. in formal), or cover (just record occurrence).

📚 Next up — Module 7: Interfaces (interface, modports, clocking blocks, virtual interface)

↑ Back to Table of Contents

Comments

Popular posts from this blog

Module 1 — SystemVerilog Basics

VLSI Verification  •  SystemVerilog Series Module 1 — SystemVerilog Basics A complete, example-driven walkthrough of SystemVerilog fundamentals: data types, variables vs nets, arrays of every flavor, strings, enums, structs, unions, and typedef — the building blocks every verification engineer needs before UVM. 🧩 Beginner → Intermediate ⏱ ~25 min read 💻 Code Examples Included 📑 Table of Contents Introduction to SystemVerilog Verilog vs SystemVerilog Data Types: 2-State vs 4-State Logic Variables and Nets Arrays: Packed vs Unpacked Dynamic Arrays Queues Associative Arrays Strings Enumerations Structures Unions Typedef 1 Introduction to SystemVerilog SystemVerilog (IEEE 1800) is a unified hardware description and verification language (HDVL). It extends Verilog (IEEE 1364) with powerful constructs for design (interfaces, always_comb/always_ff, enhanced d...

GPU Memory System & Interconnect: How Data Travels Inside a Modern GPU

GPU Memory System & Interconnect: How Data Travels Inside a Modern GPU Modern GPUs deliver incredible computing power by processing thousands of operations simultaneously. While compute cores often receive the spotlight, the real performance of a GPU depends heavily on how efficiently data moves between memory and compute units. A GPU memory system is designed to provide extremely high bandwidth while keeping latency as low as possible. This is achieved through a collection of specialized hardware components working together, including the Memory Controller, HBM/GDDR memory, Crossbar, Network-on-Chip (NoC), DMA Engine, PCIe Interface, and NVLink. In this article, we'll explore each component in detail and understand how they collectively enable high-performance parallel computing. Why Does GPU Memory Matter? Every GPU application—from gaming and graphics rendering to AI model training and scientific simulations—requires continuous movement of enormous amounts of data. For examp...

Clock Domain Crossing (CDC): A Complete Beginner's Guide to Metastability, Synchronizers & Safe Data Transfer

Clock Domain Crossing (CDC): A Complete Beginner's Guide to Metastability, Synchronizers & Safe Data Transfer Modern System-on-Chip (SoC) designs rarely operate with a single clock. Instead, different modules such as CPUs, GPUs, memory controllers, communication interfaces, and peripherals often run at different clock frequencies or even use completely independent clock sources . When data moves from one clock domain to another, timing uncertainty can cause serious problems such as metastability , data corruption , and unpredictable system behaviour . This challenge is known as Clock Domain Crossing (CDC) . CDC is one of the most important topics in ASIC Design , RTL Design , ASIC Verification , FPGA Design , and SoC Architecture . Every modern chip—from smartphones to automotive processors—uses CDC techniques to ensure reliable communication between multiple clock domains. In this article, we'll explore CDC fundamentals, metastability, synchronization techniques, asynchro...

AXI Verification Interview Questions and Real-World Debugging

AMBA Protocol Series · Part 10 of 10 AXI Verification Interview Questions and Real-World Debugging Common protocol violations, how to read them off a waveform, and a curated set of interview questions with concise, correct answers — the capstone of the core 10-day series. AMBA Protocol Series: From APB & AHB to AXI — A Complete Guide for VLSI Engineers This wraps up the core 10-day series. Everything here draws directly on Days 1–9 — if any answer below feels unfamiliar, that's a good signal for which earlier post to revisit. (If you want to go further, see the 20-day extended list at the end of this post.) In This Article Common Protocol Violations Debugging From a Waveform Interview Questions and Answers Series Recap Extending the Series 1. Common Protocol Violations VALID deasserted before handshake — a source drops VALID before READY ever went high (violates the Day 8 stabi...

Cache Basics and Cache Mapping Techniques

  Cache Basics and Cache Mapping Techniques  Modern processors execute billions of instructions every second. However, processor speed has increased much faster than main memory (RAM) speed. This difference, known as the memory wall , creates a performance bottleneck because the CPU often has to wait for data from slower memory. To solve this problem, computer systems use cache memory —a small, high-speed memory located between the CPU and the main memory. In this article, we will understand the fundamentals of cache memory, the principle of locality, cache organization, and the three major cache mapping techniques. What is Cache Memory? Cache memory is a small, high-speed memory that stores copies of frequently accessed data from the main memory. Since accessing cache is much faster than accessing RAM, the CPU first checks whether the required data is available in the cache. If the data is found in the cache, it is called a cache hit . Otherwise, the CPU fetches the dat...

Timing Basics in Static Timing Analysis (STA): Delay Models, Sequential Timing, and Wire Delays

Timing Basics in Static Timing Analysis (STA) Static Timing Analysis (STA) is one of the most important verification techniques used in modern VLSI design. Before a chip is manufactured, engineers must verify that every signal reaches its destination within the required clock period. Even if a design passes functional simulation, it may still fail after fabrication because of timing violations. Unlike simulation, Static Timing Analysis mathematically analyzes every timing path without applying input test vectors. This makes STA significantly faster and capable of analyzing millions of timing paths efficiently. Table of Contents What is Static Timing Analysis? Why STA is Required Propagation Delay Contamination Delay Cell Delay Models Combinational Gate Delay Sequential Timing Setup Time Hold Time Wire Delay RC Delay Model PVT Corners Worked Examples Interview Questions Key Takeaways What is Static Timing Analysis? Static Ti...

Computer Architecture Interview Question Part 1

Skip to content Computer Architecture Interview Series Part 1 · CPU Basics · RISC vs CISC · ISA 50 Most Asked Computer Architecture Interview Questions (Part 1) The foundational round every VLSI, ASIC, and CPU design interview opens with: instruction set architecture, RISC vs CISC trade-offs, Von Neumann vs Harvard design, registers, endianness, and the fetch-decode-execute cycle — explained the way interviewers actually expect you to answer.  40 Questions (Q1–Q40) ⌛ 22 min read  VLSI & Computer Architecture Interviews On this page Foundations of Computer Architecture RISC vs CISC — Core Differences Von Neumann, Harvard & the Semantic Gap Architecture Styles, Endianness & Registers ILP, VLIW, Superscalar & Amdahl's Law Register Files, Microcontrollers & the Fetch Cycle Tip...