FREE — INTERVIEW QUESTIONS

SystemVerilog interview questions, with code answers, output-tracing problems and a real code review

90+ free SystemVerilog questions for design verification interviews: data types, arrays and queues, classes, virtual interfaces, constraints, covergroups, assertions, fork-join, mailboxes and scheduling. Includes 18 worked answers with code, 8 solved problems, a buggy transaction class reviewed line by line, a coverage-closure estimator and a rapid-fire round.

1527+ SystemVerilog Interview Questions ebook cover
SYSTEMVERILOG EBOOK · 1,527 QUESTIONS · 24 SECTIONS

Get all 1,527 SystemVerilog and UVM questions

A questions-only bank from data types to UVM RAL, with 323 UVM questions and 170 debugging, company-style and expert questions.

INSTANT PDF DOWNLOAD · 8 FREE PREVIEW PAGES
See the ebook

SystemVerilog interviews for verification roles test two things at once: whether you know the language precisely (what a bit does to an X, what join_any leaves running, which method a base handle calls), and whether you can use it to build a testbench that finds bugs. The second half of most rounds is "write a constraint", "write a covergroup", "write an assertion", then "why doesn't it work?"

Start with the cheat sheet and the container table, skim the 50 questions by topic, then work through the worked answers and the output-tracing problems with a simulator open. Finish with the code review: reading someone else's class and spotting what's wrong is one of the most common senior DV exercises.

HOW IT'S ASKED

Three levels of a SystemVerilog interview

LEVEL 1

Language precision

2-state vs 4-state, packed vs unpacked, dynamic arrays, queues and associative arrays, tasks vs functions, always_comb, fork-join variants. Short questions where the exact answer matters.

LEVEL 2

Write the testbench pieces

A class hierarchy with virtual methods, constraints for a packet, a covergroup with a cross, an assertion for a handshake, a mailbox between generator and driver.

LEVEL 3

Debug & scheduling

"randomize() returns 0", "coverage stuck at 92%", "the test never ends", "passes on one simulator only". They want a method, and an understanding of the event regions.

HOW TO ANSWER

Six habits of strong SystemVerilog answers

01

Write two lines of code

A declaration and one use beats a paragraph. "int q[$]; q.push_back(5);" answers "what is a queue" faster than any definition.

02

Separate handle from object

Say which one you mean. Most OOP confusion (copies, nulls, polymorphism) disappears once handles and objects are kept apart.

03

Say what happens at time 0

Initial values, always_comb running once, X on uninitialised logic. Start-up behaviour is where many testbench bugs live.

04

Name the failure mode

A constraint that can't solve, a bin that can't be hit, an assertion that passes vacuously. Knowing how each feature fails shows you've used it.

05

Tie it to verification

Every feature exists to find bugs faster. Say what it's for: "associative arrays for a sparse memory model", "randc to cover every opcode once per pass".

06

Know where it runs

Active, NBA, Observed, Reactive. You don't need every region, but you should know why clocking blocks and non-blocking assignments prevent races.

CHEAT SHEET

The SystemVerilog facts interviewers expect at once

The rules behind most one-line questions, in one place.

4-STATElogic, reg, integer, nets: 0, 1, X, Z · default value X (nets Z)
2-STATEbit, byte, shortint, int, longint: 0, 1 only · X and Z become 0Signed by default: byte, shortint, int, longint, integer. Unsigned: bit, logic, reg.
ARRAYSfixed [N] · dynamic [] + new[N] · queue [$] · associative [key_type]
FORKjoin: all children · join_any: first child · join_none: none · wait fork, disable fork
RANDrand: any legal value, repeats allowed · randc: every value once before any repeat (n bits → 2n per cycle)
DIST:= weight per value · :/ weight shared across a range · P = weight / total weight
COVERAGE% = hit bins / (all bins − ignore − illegal) · cross bins = product of coverpoint bins
SVA|-> same cycle · |=> next cycle · ##[m:n] window · [*n] consecutive · $rose $fell $stable $past
REGIONSPreponed → Active → Inactive → NBA → Observed → Reactive → PostponedClocking-block inputs (#1step) sample in Preponed; assertions evaluate in Observed; program code runs in Reactive.
COPYb = a copies the handle · b = new a shallow-copies the object · deep copy needs your own method
VIRTUALvirtual method: chosen by the object's type · non-virtual: chosen by the handle's type
TRY IT

Coverage closure estimator

How many cross bins you've created, and roughly how many random samples it takes to hit them all if every bin is equally likely.

CROSS BINS–
EXPECTED SAMPLES–
~95% LIKELY BY–
TESTS NEEDED–

 

WHICH CONTAINER

Arrays, queues and mailboxes compared

"Which would you use, and why?" follows almost every array question. Pick by how the size changes and how you look things up.

CONTAINERDECLARESIZEBEST FORWATCH OUT FOR
Fixed arrayint a[16];Compile timeKnown sizes, register files, lookup tablesCan't grow; out-of-range reads return the default
Dynamic arrayint d[]; d = new[n];Set at run timePayloads whose length is randomisedAccessing before new[]; resize with new[m](d) to keep data
Queueint q[$];Grows and shrinksScoreboard expected lists, FIFOs, in-order matchingPopping an empty queue; q[$] is the last element
Associative arrayint m[int];Only entries you writeSparse memory models, lookups by ID or addressReading a missing key; check with exists() first
Mailboxmailbox #(pkt) mb = new();Unbounded, or bounded by new(n)Passing objects between threads (generator to driver)get() blocks when empty, so a missing producer hangs the test
BROWSE BY TOPIC

50 SystemVerilog interview questions across 10 topics

A sample of what DV interviewers ask most. The 1,527-question ebook goes much deeper on every topic, plus six sections of UVM.

Data Types

States, signs and widths.

  • Why might a testbench pass with bit but fail with logic?
  • What's the difference between logic and wire when a signal has two drivers?
  • When would you use a packed struct instead of an unpacked one?
  • How does an enum help debugging, and what does .name() return?
  • What happens when you assign a signed int to an unsigned 8-bit variable?

Arrays & Queues

Choosing and using containers.

  • How do you grow a dynamic array without losing its contents?
  • How would you model a 4 GB memory that the test only touches in a few places?
  • What do find_index and with return on a queue?
  • How do you iterate over every key of an associative array?
  • Why is a queue a natural fit for a scoreboard's expected list?

Procedural Code

Blocks, tasks and functions.

  • What does always_comb check that always @(*) doesn't?
  • Why can't a function contain @(posedge clk)?
  • What goes wrong when a static task is called from two threads at once?
  • When would you pass an argument by ref, and when by const ref?
  • What is a final block used for in a testbench?

Interfaces & Clocking

Connecting the testbench to the DUT.

  • Why does a class need a virtual interface instead of a plain interface?
  • What problem do modports solve?
  • How does a clocking block prevent races between testbench and DUT?
  • What does input #1step mean in a clocking block?
  • Why have program blocks fallen out of use in UVM testbenches?

Classes & OOP

Handles, inheritance and polymorphism.

  • What does a base-class handle call when it points to a derived object?
  • What's the difference between a shallow and a deep copy?
  • When must you call super.new() explicitly?
  • Why make a class virtual (abstract), and what is a pure virtual method?
  • What does $cast check, and when do you need it?

Randomisation

Constraints and the solver.

  • What's the difference between rand and randc?
  • How do := and :/ differ in a dist?
  • How does solve a before b change the distribution, but not the solutions?
  • How do you turn one constraint off for a single test?
  • What are soft constraints for?

Functional Coverage

Measuring what you tested.

  • How is functional coverage different from code coverage?
  • Why are auto bins on a 32-bit field a bad idea?
  • What do ignore_bins and illegal_bins each do?
  • How do you sample a covergroup from a class instead of a clock?
  • Why can 100% coverage still miss a bug?

Assertions

Checking behaviour over time.

  • What's the difference between immediate and concurrent assertions?
  • When does an implication pass vacuously?
  • How do you write "once req rises, it stays high until gnt"?
  • Why add disable iff for reset?
  • What does cover property tell you that assert can't?

Threads & IPC

Fork-join, mailboxes, events.

  • What's left running after join_any, and how do you stop it?
  • What's the classic bug with fork inside a for loop?
  • When would you use a semaphore instead of a mailbox?
  • What's the difference between @ev and wait(ev.triggered)?
  • What happens when put() is called on a full bounded mailbox?

Scheduling, Packages & DPI

The parts that cause the strangest bugs.

  • Why can the same testbench pass on one simulator and fail on another?
  • Where do non-blocking assignments update in the event schedule?
  • Why put shared types and classes in a package?
  • What's the difference between import and `include?
  • Give a real use for DPI-C in a testbench.

These are samples. The full bank has 1,527 questions.

24 sections from data types to UVM RAL, with 65 debugging scenarios, 70 company-style questions and 35 expert corner cases. Questions only, so you practise producing answers.

See the full question bank
N1 · DIST WEIGHTSBEGINNERlen dist { 0 := 10, [1:4] := 5, [5:8] :/ 20 }; What is P(len = 0), P(len = 3) and P(len is 5 to 8)?Show solution ↓
0      : 10            → 10
[1:4]  : 5 per value   → 20
[5:8]  : 20 shared     → 20   (5 per value)
Total weight = 50
P(0) = 10/50 = 20%   P(3) = 5/50 = 10%   P(5..8) = 20/50 = 40%

Note: := gives every value in the range the full weight; :/ splits it.

N2 · FORK TRACEBEGINNERWhat does this print, and when? fork #10 $display("A"); #5 $display("B"); join_any $display("C"); #20 $display("D");Show solution ↓
t=5   B     (first child finishes, join_any releases)
t=5   C
t=10  A     (still running in the background)
t=25  D     (5 + 20)

Note: with join, C would print at 10 and D at 30; with join_none, C at 0 and D at 20.

N3 · QUEUE TRACEBEGINNERint q[$] = {3, 7}; then push_front(1), push_back(9), insert(2, 5), x = pop_back(), delete(0). What are x, q.size() and q[1]?Show solution ↓
push_front(1)  → {1, 3, 7}
push_back(9)   → {1, 3, 7, 9}
insert(2, 5)   → {1, 3, 5, 7, 9}
x = pop_back() → x = 9, {1, 3, 5, 7}
delete(0)      → {3, 5, 7}
size = 3, q[1] = 5

Note: insert(i, v) puts v at index i and shifts the rest right.

N4 · SVA TIMINGINTERMEDIATEreq rises at cycle 5. In which cycles does $rose(req) |-> ##[1:3] ack look for ack? And with |=>?Show solution ↓
|->  : consequent starts at cycle 5
       ##[1:3] → cycles 6, 7, 8
|=>  : consequent starts at cycle 6
       ##[1:3] → cycles 7, 8, 9
Passes at the first cycle ack is seen; fails if none of the three.

Note: a |=> b is the same as a |-> ##1 b.

N5 · SOLVE BEFOREADVANCEDrand bit a; rand bit [1:0] b; constraint c { a -> b == 0; } What is P(a = 1)? What changes with solve a before b?Show solution ↓
Legal solutions: a=0 with b=0..3 (4), a=1 with b=0 (1) → 5
Default (uniform over solutions): P(a=1) = 1/5 = 20%

solve a before b: pick a first, 50/50
  P(a=1) = 50%
  P(b=0) = 0.5 × 1 + 0.5 × 1/4 = 62.5%

Note: solve...before never changes which solutions are legal, only how likely each is.

N6 · SPARSE MEMORYINTERMEDIATEA testbench models a 32-bit address space of 32-bit words, but tests touch about 10,000 addresses. Compare a fixed array with an associative array.Show solution ↓
Fixed:        2^32 words × 4 bytes = 16 GiB, allocated up front
Associative:  ~10,000 entries × (key + data + overhead)
              → well under a few MB

Note: associative entries cost more each, but you only pay for addresses you touch. Use exists() to return a default for untouched addresses.

N7 · RANDCBEGINNERrandc bit [1:0] c; The first three randomisations give 2, 0 and 3. What is the fourth? Can the fifth be 1?Show solution ↓
Values per cycle: 2^2 = 4 → {0, 1, 2, 3}
Used: 2, 0, 3   → fourth must be 1
Fifth starts a new cycle: any of 0..3, including 1

Note: randc only prevents repeats within a cycle; a value can repeat across the boundary.

N8 · CROSS COVERAGEINTERMEDIATEA length coverpoint has 3 bins, a command coverpoint has 4. You ignore the 3 cross bins with NOP. How many cross bins, and roughly how many uniform random samples to hit them all?Show solution ↓
Cross bins = 3 × 4 − 3 = 9
Expected samples ≈ n × H(n) = 9 × (1 + 1/2 + … + 1/9)
                 ≈ 9 × 2.829 ≈ 25.5
~95% likely by   ≈ n × (ln n + 3) ≈ 9 × 5.2 ≈ 47

Note: this assumes every bin is equally likely, which real stimulus rarely is. The calculator above does the same sums.

// pkt.sv — transaction for a simple streaming bus
class pkt;
  bit [7:0]   len;                           (1)
  rand bit [31:0] addr;
  rand bit [7:0]  data[];
  rand bit        is_long;

  constraint c_len  { len inside {[1:16]}; }
  constraint c_long { is_long -> len > 32; }        (2)
  constraint c_data { data.size() == len; }

  function void display();                       (3)
    $display("addr=%h len=%0d", addr, len);
  endfunction

  function pkt copy();
    copy = this;                                 (4)
  endfunction
endclass

// in the generator
p = new();
p.randomize();                                   (5)
mb.put(p.copy());
  1. len isn't rand. The solver treats it as a constant (0), so c_len and c_data can never be satisfied.
  2. c_long contradicts c_len. Once len is rand, the solver quietly sets is_long to 0 every time. No error, just a coverage hole.
  3. display() isn't virtual, so a derived packet's display() is never called through a base handle.
  4. copy returns the same handle. The mailbox and the generator share one object; the next randomisation changes what the driver is sending.
  5. The return value of randomize() is ignored. With bug (1) every call fails, and every packet goes out with the old values.
Which bug would you mention first?

(1) and (5) together: every randomize() fails and nobody notices, so the whole test sends the same packet. Then (4), which corrupts data in flight, then the silent contradiction in (2).

What does the fixed class look like?
How would you have caught bug (2) without reading the code?

A coverpoint on is_long (or on length ranges) would have shown the long bin at 0% after any amount of regression. That's what coverage is for: finding stimulus that silently never happens.

What else would you add to make it production-ready?

A compare() method for the scoreboard, a soft default for is_long so tests can bias it, and, in UVM, field macros or do_copy/do_compare overrides. The ebook has full sections on OOP, randomisation and debugging questions like this.

Default value of an uninitialised logic?

X.

Default value of an uninitialised bit?

0.

Is int signed or unsigned?

Signed, 32-bit, 2-state.

What does q[$] refer to?

The last element of the queue.

Check a key in an associative array?

exists().

What does join_none wait for?

Nothing. The parent continues at once.

Kill all child threads?

disable fork.

A randc 3-bit variable repeats after?

8 values, one full cycle.

Are class methods virtual by default?

No.

Can a constructor be virtual?

No.

Default lifetime of class methods?

Automatic.

What can a static method access?

Only static properties and other static methods.

What can't a function contain?

Time-consuming statements: #, @, wait.

Overlapping implication operator?

|->

Non-overlapping implication operator?

|=>

When is $rose(sig) true?

When sig went from 0 to 1 since the last clock tick.

What happens when an illegal bin is hit?

The simulator reports an error.

Return value of a failed randomize()?

0, and the variables keep their old values.

Region where NBAs update?

NBA region, after Active and Inactive.

What does $cast return as a function?

1 on success, 0 on failure.

COMMON MISTAKES

What costs candidates the most in SystemVerilog rounds

×

Ignoring randomize()

A failed randomisation that nobody checks sends the same stimulus forever. Always check the return value.

×

2-state types on DUT signals

Sampling DUT outputs into bit or int turns X into 0, and the bug you were looking for disappears.

×

Mixing up handles and objects

"I copied it" when you copied a handle. Say which one you mean, every time.

×

Forgetting virtual

Without it, a base handle calls the base method, and factory overrides seem to do nothing.

×

Driving without a clocking block

Blocking assignments to DUT inputs at the clock edge create races that depend on the simulator.

×

Coverage that isn't a plan

Auto bins on wide fields and covergroups nobody samples give numbers, not answers. Bins should come from the spec.

QUICK FAQ

Before you start preparing

What do SystemVerilog interviews focus on?

For verification roles: data types and arrays, classes and OOP, virtual interfaces, constrained randomisation, functional coverage, assertions, fork-join and inter-process communication, then debugging and scheduling questions. Design roles focus on the synthesisable subset instead.

Should I learn SystemVerilog or UVM first?

SystemVerilog. UVM is a class library written in it, so classes, virtual methods, parameterised classes, constraints and fork-join need to be comfortable before UVM makes sense.

Do I need a commercial simulator to practise?

No. EDA Playground gives free browser access to several simulators, which is enough to run every example on this page. Open-source tools support a growing share of SystemVerilog too.

How much SVA do I need?

For most DV roles: implication, delays and windows, repetition, $rose/$fell/$past, disable iff, and the difference between assert and cover. Formal verification roles go much deeper.

What should a fresher prepare first?

2-state vs 4-state types, arrays and queues, tasks vs functions, classes with inheritance and virtual methods, a simple constraint and covergroup, fork-join variants, and how a basic testbench is structured.

Will I be asked to write code?

Usually. Expect a class with constraints, a covergroup, an assertion, or a small generator-driver pair over a mailbox, followed by "what happens if…" questions.

Want to be tested on these live?

Book a 1:1 mock interview with a mentor working in this exact domain.

Book a mock interview