Knowledge / Electronics (VLSI Design) / SystemVerilog for design and verification

SystemVerilog for design and verification

Electronics (VLSI Design) (B.E./B.Tech) · Digital design · free study notes for exams, placements and interviews

In short

SystemVerilog (IEEE 1800, current edition IEEE 1800-2023) is a single language that extends Verilog-2001 with strong design constructs (new data types, always_ff/always_comb, interfaces, packages) and a full object-oriented verification layer (classes, constrained randomisation, assertions, functional coverage). It is the industry language for RTL design and for testbenches built on UVM, so every VLSI company recruiting in India — Intel, Qualcomm, Nvidia, AMD, Synopsys, Cadence, Siemens EDA, Texas Instruments, Microchip, NXP, Bosch, Einfochips, Sasken, Tessolve, Wipro/HCL/L&T Technology Services — tests it in the written round and the technical interview. In universities it appears in Digital Design, HDL/VLSI Design and Verification labs; GATE EC/EE itself asks Verilog-level HDL only, so the SystemVerilog-specific material is mainly placement and lab material. Interviews split almost exactly into two halves: "design" questions (which always block, two-state vs four-state, race in non-blocking assignment) and "verification" questions (class vs module, randomize with constraints, assertion syntax, coverage closure). Treat it as one language with two disciplines inside it.

Explained

Data types and literals

Design constructs that replace plain Verilog

Verification layer: classes, randomisation, threads

Assertions, coverage and the scheduler

Synthesisable vs testbench-only, and language guidance

Key points

Formulas and examples

Bit width of a packed type: $bits(T) ; for logic [m:0][n:0] → (m+1)×(n+1) bits
Memory size = depth × width bits ; logic [W-1:0] mem [0:D-1] → D×W bits
Address bits for D locations: A = ⌈log₂ D⌉
Number of bins in a cross = (bins of cp1) × (bins of cp2) × …
Coverage % = (bins hit with ≥ option.at_least samples) / (total non-ignored, non-illegal bins) × 100
Constrained value space = ∏(legal values of each rand variable) after all constraints are applied

Example 1 — widths of packed and unpacked declarations.

logic [3:0][7:0] a;          // packed:  4 x 8  = 32 bits, a[2] is a byte
logic [7:0] mem [0:1023];    // unpacked: 1024 bytes
typedef struct packed { logic [15:0] addr; logic [7:0] data; logic wr; } cmd_t;

Example 2 — blocking vs non-blocking, counted cycle by cycle. Two shift attempts with a initially 1, b and c 0:

always_ff @(posedge clk) begin   // non-blocking: correct 2-stage shift
  b <= a; c <= b;
end
always_ff @(posedge clk) begin   // blocking: collapses to one stage
  b = a; c = b;
end
After clock edgeNon-blocking b, cBlocking b, c
1st1, 01, 1
2nd1, 11, 1

Example 3 — constrained random, counting the legal space.

class Pkt;
  rand bit [9:0] addr;      // 0..1023
  rand bit [1:0] burst;     // 0..3
  constraint c1 { addr inside {[0:255]}; addr % 4 == 0; }
  constraint c2 { burst != 2'b11; }
endclass

Example 4 — cross coverage arithmetic and closure.

covergroup cg @(posedge clk);
  cp_len  : coverpoint len  { bins b[] = {[1:4]}; }          // 4 bins
  cp_kind : coverpoint kind { bins rd = {0}; bins wr = {1}; } // 2 bins
  cross cp_len, cp_kind;                                      // 8 bins
endgroup

Example 5 — a concurrent assertion read in cycles.

property p_ack; @(posedge clk) disable iff (!rst_n)
  $rose(req) |=> ##[0:2] ack; endproperty
assert property (p_ack) else $error("no ack within 3 cycles of req");
FeatureVerilog-2001SystemVerilog
Signal typereg, wirelogic, bit, enum, struct, union, typedef
Combinational blockalways @(*)always_comb (intent checked, runs at time 0)
Sequential blockalways @(posedge clk)always_ff (intent checked)
Case completenessfull_case/parallel_case pragmasunique / unique0 / priority with runtime checks
Signal groupinglong port listsinterface with modport
Testbench stimulusdirected, $randomclasses, constrained random, $urandom
Checkingif + $displayimmediate and concurrent assertions (SVA)
Progress metriceyeballing waveformsfunctional coverage + code coverage
Reusecopy-paste tasksOOP inheritance, factory, UVM (IEEE 1800.2)

Where it is used

Interview questions

Common mistakes

Related topics

Verilog and HDL basics · Finite state machine design · Sequential circuits: flip-flops, counters and registers · Combinational circuits · Static timing analysis and synthesis · UVM and functional verification methodology

Open in the Knowledge reader →Find jobs →