33 SystemVerilog Interview Questions and Answers
SystemVerilog questions for design verification (DV) interviews: data types, arrays, OOP, interfaces, clocking blocks and randomization.
Updated 05 November 2026 · Written by Semicon Weekly in our own words · 33 questions
Practise these 33 questions free : type, speak or pick from 4 options and get an instant AI score.
Start practising →
Questions on this page Difference between bit and logic? Why was logic introduced? Difference between int and integer? byte and bit [7:0]? Difference between packed and unpacked arrays? Explain fixed, dynamic, associative arrays and queues with a use case each. Difference between dynamic array and queue? Difference between always_comb and always @(*)? Difference between fork-join, fork-join_any and fork-join_none? Difference between module and program block? How does program avoid races? Difference between initial and final blocks? Explain pass-by-value vs pass-by-reference (ref) in SV. Difference between struct and class? How does OOP help in verification? What are this and super keywords? What is a virtual method? Difference between virtual and pure virtual? Base class has function display() (not virtual). Child overrides it. Base b; Child c = new; b = c; b.display(); which version runs? What if display is virtual? Difference between shallow copy and deep copy? What are local and protected access qualifiers? What is a parameterised class? What is the scope resolution operator (::) used for? What is an interface and why was it introduced? What is a modport? What is a clocking block? What are input and output skew? What is a virtual interface and why do we need it? Difference between mailbox and queue? What is a semaphore? What is DPI? Explain import and export. What is a callback? Name the components of a layered SV testbench and their roles. Why do we use constrained randomization? Difference between rand and randc? What are pre_randomize and post_randomize? How do you disable a constraint or randomization of a variable? What are bidirectional constraints? Explain dist with := and :/ . What is std::randomize()?
easy Data types theory
1. Difference between bit and logic? Why was logic introduced?Show answer bit is 2-state (0,1), logic is 4-state (0,1,x,z); logic removes the wire-vs-reg confusion: it can be driven by assign or by a procedural block (but only one continuous driver); still use wire for multiple drivers (tri-state buses)
Common mistake: Saying logic can have multiple drivers
Interviewer may ask next: What happens if you drive a bit with x?
Answer this in the AI interview bot → easy Data types theory
2. Difference between int and integer? byte and bit [7:0]?Show answer int: 2-state signed 32-bit integer: 4-state signed 32-bit byte: 2-state SIGNED 8-bit (-128..127) Bit [7:0]: 2-state UNSIGNED 8-bit (0..255) Common mistake: Saying byte is unsigned
Answer this in the AI interview bot → medium Arrays theory
3. Difference between packed and unpacked arrays?Show answer Packed: dimensions before the name (bit [3:0][7:0] a), stored as one contiguous vector, can be sliced and used in arithmetic unpacked: dimensions after the name (int a [4]), each element stored separately, any type allowed Packed only for single-bit types Interviewer may ask next: How many bits is bit [3:0][7:0] x [2]?
Answer this in the AI interview bot → medium Arrays theory
4. Explain fixed, dynamic, associative arrays and queues with a use case each.Show answer Fixed: size known at compile time dynamic: size set at run time with new[], good for variable-length packets associative: sparse, indexed by any key, good for memory models with large address space queue: variable size with push/pop at both ends, good for scoreboards Interviewer may ask next: Which methods do you use to walk through an associative array (first, next)?
Answer this in the AI interview bot → medium Arrays theory
5. Difference between dynamic array and queue?Show answer Dynamic array must be resized with new[] (old content copied only if you pass it) Queue grows/shrinks automatically with push_back/push_front/pop Queue supports insert/delete anywhere Dynamic array is slightly faster for fixed-after-allocation data Answer this in the AI interview bot → medium Procedural theory
6. Difference between always_comb and always @(*)?Show answer always_comb runs once at time 0 even without events, is sensitive to signals inside called functions too, tools warn if it infers a latch, and the variables cannot be written by another process; always @(*) has none of these checks
Common mistake: Saying they are exactly the same
Interviewer may ask next: What are always_ff and always_latch for?
Answer this in the AI interview bot → medium Procedural theory
7. Difference between fork-join, fork-join_any and fork-join_none?Show answer join: wait for ALL child threads join_any: continue when ANY one finishes (others keep running) join_none: continue immediately, children run in background Use disable fork / wait fork to control leftover threads Common mistake: Thinking join_any kills the remaining threads
Interviewer may ask next: Inside a for loop with fork-join_none, why do you need an automatic copy of the loop variable?
Answer this in the AI interview bot → medium Procedural theory
8. Difference between module and program block? How does program avoid races?Show answer Program is testbench-only: cannot contain always blocks, modules or interfaces instances Its initial blocks run in the Reactive region, after the DUT settles, so the testbench samples stable values $finish is called automatically when all program initial blocks end Interviewer may ask next: Why is program block rarely used in UVM testbenches?
Answer this in the AI interview bot → easy Procedural theory
9. Difference between initial and final blocks?Show answer Initial runs at time 0 Final runs at the end of simulation (after $finish), in zero time, used for printing summaries/coverage reports Final cannot have delays Answer this in the AI interview bot → medium Tasks & functions theory
10. Explain pass-by-value vs pass-by-reference (ref) in SV.Show answer By value: argument copied, changes inside do not affect caller ref: the subroutine works on the original variable, changes are visible to caller, saves copying large arrays Const ref prevents modification Ref only allowed in automatic subroutines Answer this in the AI interview bot → Reading is not enough. Say your answer out loud or type it, and get a score out of 10 with what you missed.
Practise free → easy OOP theory
11. Difference between struct and class?Show answer struct: static data grouping, no methods, value type, synthesizable (packed struct) class: dynamic object created with new, has properties and methods, supports inheritance, polymorphism, randomization Handle points to object Answer this in the AI interview bot → medium OOP theory
12. How does OOP help in verification?Show answer Inheritance: extend a base transaction/driver for new tests without editing it polymorphism: base handle calls the extended method, enabling factory overrides encapsulation: local/protected hide internals Reusable layered testbench components Common mistake: Listing OOP terms without linking to testbench examples
Interviewer may ask next: Give an example of using inheritance to create an error-injection transaction.
Answer this in the AI interview bot → medium OOP theory
13. What are this and super keywords?Show answer This refers to the current object, used to separate class property from same-named argument (this.addr = addr) Super refers to the parent class, used to call parent methods/constructor (super.new(), super.build_phase(phase)) Answer this in the AI interview bot → medium OOP theory
14. What is a virtual method? Difference between virtual and pure virtual?Show answer Virtual method: the call is resolved by the object type, not the handle type, enabling polymorphism Pure virtual: declared with no body inside a virtual (abstract) class and must be implemented by any non-abstract child class Common mistake: Saying a virtual class can be instantiated
Interviewer may ask next: What prints if a base handle points to an extended object and the method is NOT virtual?
Answer this in the AI interview bot → medium OOP output-predict
15. Base class has function display() (not virtual). Child overrides it. Base b; Child c = new; b = c; b.display(); which version runs? What if display is virtual?Show answer Non-virtual: base version runs (decided by handle type) virtual: child version runs (decided by object type) Answer this in the AI interview bot → medium OOP theory
16. Difference between shallow copy and deep copy?Show answer Shallow copy (new obj_h) copies the property values and handles, but nested objects are SHARED Deep copy also creates new copies of nested objects, so the copy is fully independent Deep copy needs a user-written copy() method Answer this in the AI interview bot → medium OOP theory
17. What are local and protected access qualifiers?Show answer local: visible only inside that class, not even in children protected: visible inside the class and its children, not from outside Default is public Answer this in the AI interview bot → medium OOP theory
18. What is a parameterised class? What is the scope resolution operator (::) used for?Show answer Parameterised class takes a type or value parameter (e.g. class fifo #(type T = int)), each specialization is a different type :: accesses static members, declares methods outside the class (extern), and accesses package items Answer this in the AI interview bot → medium Interface theory
19. What is an interface and why was it introduced?Show answer Bundles related signals (e.g. all APB signals) into one object Avoids long port lists and connection mistakes Can include modports, clocking blocks, tasks, assertions and coverage One change in the interface updates every connection Answer this in the AI interview bot → medium Interface theory
20. What is a modport?Show answer Defines direction views of an interface for each user (e.g. master, slave, monitor) Restricts who can drive which signal Can include clocking blocks and tasks A module port can be declared as intf.master Answer this in the AI interview bot → Reading is not enough. Say your answer out loud or type it, and get a score out of 10 with what you missed.
Practise free → hard Interface theory
21. What is a clocking block? What are input and output skew?Show answer Groups signals synchronous to one clock and defines when the testbench samples and drives them Input skew: sample that much BEFORE the clock edge (#1step = just before, in Preponed region) Output skew: drive that much AFTER the edge Removes testbench-DUT races Common mistake: Saying input skew delays the input
Interviewer may ask next: What does default input #1step output #0 mean?
Answer this in the AI interview bot → medium Interface theory
22. What is a virtual interface and why do we need it?Show answer Classes are dynamic and cannot contain static interface instances, so a class holds a virtual interface handle that points to the real interface in the top module In UVM it is passed through uvm_config_db Answer this in the AI interview bot → medium IPC theory
23. Difference between mailbox and queue? What is a semaphore?Show answer Mailbox: built-in class for passing messages between threads, get() blocks when empty, put() blocks when bounded and full queue: plain data structure, no blocking semaphore: key bucket that controls access to a shared resource (get/put keys), e.g. two drivers sharing one bus Interviewer may ask next: Bounded vs unbounded mailbox?
Answer this in the AI interview bot → medium Misc theory
24. What is DPI? Explain import and export.Show answer Direct Programming Interface lets SV call C functions and C call SV import: SV calls a C function (e.g. reference model in C) export: SV function made callable from C Data types must map (int, byte, chandle) Answer this in the AI interview bot → medium Misc theory
25. What is a callback?Show answer A hook method left empty in a base component that users fill in by extending a callback class and registering it Adds behaviour (e.g. error injection, extra checks) without editing the original code Answer this in the AI interview bot → medium Testbench theory
26. Name the components of a layered SV testbench and their roles.Show answer Transaction (data), generator (creates randomized transactions), driver (converts to pin wiggles via interface), monitor (watches pins, rebuilds transactions), scoreboard (compares with reference model), agent (driver + monitor + generator), environment, test, top module Common mistake: Missing the monitor or scoreboard
Interviewer may ask next: How do generator and driver communicate?
Answer this in the AI interview bot → easy Randomization theory
27. Why do we use constrained randomization?Show answer Covers many combinations directed tests miss, finds corner-case bugs, constraints keep values legal, weights steer distribution, one test can run with many seeds Measured with functional coverage Answer this in the AI interview bot → easy Randomization theory
28. Difference between rand and randc?Show answer rand: each value random, repeats allowed randc: random-cyclic, goes through all values in the range before any value repeats Randc limited to smaller bit widths by tools Interviewer may ask next: How would you implement randc behaviour without randc?
Answer this in the AI interview bot → medium Randomization theory
29. What are pre_randomize and post_randomize?Show answer Callback functions automatically called before and after randomize() pre: set up or turn off constraints post: compute dependent fields like CRC/parity from the random values Answer this in the AI interview bot → medium Randomization theory
30. How do you disable a constraint or randomization of a variable?Show answer constraint_mode(0) on a constraint block (obj.c_name.constraint_mode(0)); rand_mode(0) on a variable to freeze it; check randomize() return value; can also use inline constraint with randomize() with { }
Answer this in the AI interview bot → Reading is not enough. Say your answer out loud or type it, and get a score out of 10 with what you missed.
Practise free → medium Randomization theory
31. What are bidirectional constraints?Show answer Constraints are solved together, not top to bottom A constraint on b can restrict a even if written as a -> b Use solve-before to change probability distribution (not the legal set) Common mistake: Thinking constraints execute line by line
Interviewer may ask next: What does solve a before b change?
Answer this in the AI interview bot → medium Randomization theory
32. Explain dist with := and :/ .Show answer := gives the weight to EACH value in a range :/ divides the weight equally across the range E.g. [1:4] := 10 gives each value weight 10 (total 40), [1:4] :/ 10 gives each 2.5 Common mistake: Mixing the two
Answer this in the AI interview bot → medium Randomization theory
33. What is std::randomize()?Show answer Randomizes variables that are not class members (local variables in a task/module) with inline constraints using with { }; no need to create a class
Answer this in the AI interview bot →