SV
SV
A
For VLSI Aspirants Targeting Top Product Companies
Prepared by:
KITTU K PATEL
ASIC Design & Verification Mentor — VERICORE
May 2025
Introduction
The SystemVerilog Interview Mastery Guide is designed to be a one-stop solution for
aspirants preparing for digital verification and front-end roles in the VLSI industry. With
increasing demand for ASIC and SoC professionals, top companies such as Intel, AMD,
Synopsys, and Qualcomm are seeking engineers with a solid grasp on SystemVerilog and
UVM fundamentals.
This guide compiles 1000 curated interview questions, thoroughly explained with
code, theory, and use-case context. The questions are organized by key topics such as:
• OOP in SV
• Digital Electronics
• Computer Architecture
• CMOS Design
• Verilog/SystemVerilog
3. Get Skilled
Take up hands-on projects. Use open-source platforms like:
• GitHub Repositories
5. Apply Strategically
Target product companies, EDA vendors, and VLSI service startups. Use referral net-
works and hackathons for visibility.
Topic 1: Randomization and Constraints
class even_rand;
rand bit [7:0] val;
constraint even_c {
val inside {[10:50]};
val % 2 == 0;
}
endclass
module tb;
even_rand obj = new();
initial begin
repeat(5) begin
void’(obj.randomize());
$display("Even Value = %0d", obj.val);
end
end
endmodule
Explanation:
• ‘
module tb;
unique_array u = new();
initial begin
if (u.randomize())
$display("Unique Array = %p", u.arr);
end
endmodule
Explanation:
class my_rand;
rand bit [3:0] a;
constraint c1 {
a inside {[5:15]};
a % 2 == 1;
!(a == 7 || a == 9 || a == 11 || a == 13); // no consecutive odds
}
endclass
module tb;
my_rand obj = new();
initial begin
repeat(10) begin
void’(obj.randomize());
$display("a = %0d", obj.a);
end
end
endmodule
Explanation: The constraint excludes specific consecutive values to comply with the
rule. This is a common interview challenge to test your understanding of exclusion logic
in constraints.
Q4. Constrain two variables such that one is twice the other and
their sum is less than 50.
Answer:
class rel_constraint;
rand bit [7:0] a, b;
constraint twice {
a == 2 * b;
a + b < 50;
}
endclass
module tb;
rel_constraint obj = new();
initial begin
repeat (5) begin
void’(obj.randomize());
$display("a=%0d, b=%0d, sum=%0d", obj.a, obj.b, obj.a + obj.b);
end
end
endmodule
class sort_array;
rand bit [7:0] arr[4];
constraint c_sorted {
arr[0] <= arr[1];
arr[1] <= arr[2];
arr[2] <= arr[3];
}
endclass
module tb;
sort_array s = new();
initial begin
if (s.randomize())
$display("Sorted Array = %p", s.arr);
end
endmodule
Explanation: Constraints are applied pairwise to enforce the sorting order. This is
often used in test scenarios to ensure stimulus validity.
class even_q;
rand bit [7:0] q[$];
constraint c1 {
q.size() == 5;
foreach (q[i]) q[i] % 2 == 0;
}
endclass
module tb;
even_q obj = new();
initial begin
if (obj.randomize())
$display("Even Queue: %p", obj.q);
end
endmodule
Explanation: Queues are dynamic arrays. The ‘foreach‘ loop ensures that each
element satisfies the modulus constraint.
class array2D;
rand bit [7:0] arr[3][4];
constraint row_sorted {
foreach (arr[i]) {
foreach (arr[i,j]) if (j < 3)
arr[i][j] <= arr[i][j+1];
}
}
endclass
module tb;
array2D obj = new();
initial begin
if (obj.randomize())
$display("2D Array = %p", obj.arr);
end
endmodule
class array_sum;
rand bit [7:0] arr[5];
constraint sum_c {
arr.sum() == 100;
}
endclass
module tb;
array_sum obj = new();
initial begin
repeat (5) begin
void’(obj.randomize());
$display("Array = %p, Sum = %0d", obj.arr, obj.arr.sum());
end
end
endmodule
Explanation: ‘.sum()‘ is a built-in method used to calculate the total value of all
elements in an array. This is especially useful for checksum generation and protocol
timing scenarios.
class exp_queue;
rand bit [7:0] q[5];
constraint exp {
q[0] == 1;
foreach(q[i]) if (i > 0) q[i] == 2 * q[i-1];
}
endclass
module tb;
exp_queue obj = new();
initial begin
if (obj.randomize())
$display("Exponential Queue: %p", obj.q);
end
endmodule
class unique_q;
rand bit [3:0] q[$];
constraint c1 {
q.size() == 10;
foreach (q[i], q[j]) i != j -> q[i] != q[j];
foreach (q[i]) q[i] inside {[0:9]};
}
endclass
module tb;
unique_q obj = new();
initial begin
if (obj.randomize())
$display("Unique Queue: %p", obj.q);
end
endmodule
Explanation: Constraints are used to ensure range and uniqueness, commonly used
in generating randomized IDs or token sets.
Q11. Write a constraint to ensure sum of two variables is always
even.
Answer:
class sum_even;
rand bit [3:0] a, b;
constraint even_sum { (a + b) % 2 == 0; }
endclass
module tb;
sum_even obj = new();
initial begin
repeat (5) begin
void’(obj.randomize());
$display("a=%0d, b=%0d, sum=%0d", obj.a, obj.b, obj.a + obj.b);
end
end
endmodule
class less_than;
rand bit [7:0] a, b;
module tb;
less_than obj = new();
initial begin
repeat (5) begin
void’(obj.randomize());
$display("a = %0d, b = %0d", obj.a, obj.b);
end
end
endmodule
class transaction;
rand bit [3:0] data;
covergroup cg;
option.per_instance = 1;
DATA: coverpoint data {
bins low = {[0:7]};
bins high = {[8:15]};
}
endgroup
function new();
cg = new();
endfunction
module tb;
transaction t = new();
initial begin
repeat(10) begin
void’(t.randomize());
t.sample_data();
$display("Data = %0d", t.data);
end
end
endmodule
class bus_tx;
rand bit [3:0] burst_len;
covergroup burst_cg;
coverpoint burst_len {
bins single = {1};
bins short = {[2:4]};
bins long = {[5:15]};
}
endgroup
function new();
burst_cg = new();
endfunction
endclass
module tb;
bus_tx tx = new();
initial begin
repeat (10) begin
void’(tx.randomize());
tx.burst_cg.sample();
$display("Burst Length = %0d", tx.burst_len);
end
end
endmodule
class cross_cov;
rand bit [3:0] addr;
rand bit [1:0] mode;
covergroup cg;
ADDR: coverpoint addr {
bins low = {[0:7]};
bins high = {[8:15]};
}
MODE: coverpoint mode {
bins rw = {0, 1};
bins burst = {2, 3};
}
ADDR_MODE: cross ADDR, MODE;
endgroup
function new();
cg = new();
endfunction
endclass
Explanation: Cross coverage helps ensure that all combinations of two signals are
exercised, which is vital in protocol verification.
covergroup cg;
option.per_instance = 1;
coverpoint opcode;
endgroup
When to Use:
• In class-based models
covergroup cg;
coverpoint opcode {
bins valid = {[0:15]};
ignore_bins reserved = {6, 7};
}
endgroup
Explanation: Ignored bins are excluded from coverage goals and are often used to
filter out illegal or unused values.
class div_by_3;
rand bit [7:0] val;
constraint c1 {
val inside {[30:90]};
val % 3 == 0;
}
endclass
module tb;
div_by_3 obj = new();
initial begin
repeat (10) begin
void’(obj.randomize());
$display("Value divisible by 3: %0d", obj.val);
end
end
endmodule
Q21. Generate a 3-element array such that the sum is even and
elements are between 1 and 10.
Answer:
class sum_even_array;
rand bit [3:0] arr[3];
module tb;
sum_even_array obj = new();
initial begin
repeat (5) begin
void’(obj.randomize());
$display("Array = %p, Sum = %0d", obj.arr, obj.arr.sum());
end
end
endmodule
class avoid_vals;
rand bit [7:0] val;
constraint c1 {
!(val inside {13, 27, 55});
val inside {[10:60]};
}
endclass
module tb;
avoid_vals obj = new();
initial begin
repeat (5) begin
void’(obj.randomize());
$display("Value = %0d", obj.val);
end
end
endmodule
• Code Coverage: Measures which parts of the code were executed (e.g., line,
toggle, FSM).
Example:
covergroup cg;
coverpoint op;
coverpoint a;
cross op, a;
endgroup
Example:
coverpoint val {
bins low = {[0:3]};
bins mid = {[4:7]};
bins high = {[8:15]};
}
Q36. What are coverage options in SystemVerilog?
Answer: Coverage options control how coverage data is collected or reported. Examples
include:
cg_inst.sample();
Example:
coverpoint mode {
bins valid = {[0:3]};
ignore_bins skip = {[4:5]};
illegal_bins err = {[6:7]};
}
Q40. How can cross coverage be customized?
Answer: Cross coverage can be customized using:
Example:
cross a, b {
ignore_bins ignore_ab = binsof(a) intersect {1} && binsof(b) intersect {3};
}
coverpoint state {
bins s_trans[] = (S0 => S1 => S2);
}
• bins name[] = (a => b => c); creates a series of bins to capture each possible
transition in the chain.
Q44. How can you collect coverage conditionally?
Answer: You can use iff clauses to conditionally enable coverage sampling. Example:
cross a, b {
bins cross_ab = binsof(a) intersect {1,2} &&
binsof(b) with (item < 5);
}
class cov;
covergroup cg(int limit);
coverpoint val {
bins range[] = {[0:limit]};
}
endgroup
endclass
Q56. What are automatic bins and when are they useful?
Answer: Automatic bins are generated implicitly when a coverpoint range is specified
without user-defined bins. They’re useful for quickly covering wide ranges during early
verification. Example:
Q58. What is the difference between ignore bins and illegal bins?
Answer:
• ignore bins excludes values from coverage without raising any errors.
• illegal bins raises a runtime error if those values are encountered, and they count
as test failures.
Q59. How can you reduce simulation time while still collecting
meaningful coverage?
Answer:
• Use targeted constraints to hit specific coverage goals.
• Percentage covered.
Analyzing this helps guide regression planning and identify unverified behavior.
Q61. What is an assertion in SystemVerilog and why is it used?
Answer: An assertion in SystemVerilog is a construct used to validate the behavior
of a design by checking for expected conditions at runtime. Assertions help catch design
bugs early by ensuring that certain conditions hold true during simulation. They improve
design reliability and simplify debugging by localizing violations of intended behavior.
• Concurrent Assertions: These evaluate properties over time and are used to
monitor behavior across clock cycles. They are written using temporal expressions.
Q63. What are the primary methods used with concurrent assertions?
Answer: Concurrent assertions use the following keywords/methods:
• cover property: Used to ensure that a property occurs during simulation for
functional coverage.
Q64. What is the significance of the “disable iff” construct in assertions?
Answer: The disable iff clause is used in concurrent assertions to disable or ignore
the evaluation of the assertion when a certain condition is true. It’s typically used to
avoid false failures during reset or when specific invalid conditions are present.
assert property (@(posedge clk) disable iff (reset) (req |=> ack));
Q66. Write a concurrent assertion to check that whenever ‘req‘ goes high,
‘ack‘ should go high in the next cycle.
Answer:
property req_ack;
@(posedge clk) req |=> ack;
endproperty
This assertion checks that if ‘req‘ is high on one clock cycle, ‘ack‘ must be high on the
next clock cycle.
Q67. How do you assert that a signal ‘data valid‘ remains high for 3
consecutive clock cycles once it becomes high?
Answer:
property data_valid_stable;
@(posedge clk) data_valid |=> data_valid [*2];
endproperty
Q68. Write an assertion to ensure that a signal ‘write‘ is not active during
reset.
Answer:
property no_write_on_reset;
@(posedge clk) disable iff (reset) !write;
endproperty
The assertion ensures that ‘write‘ is not asserted when reset is active.
Q69. How can you use the ‘cover property‘ to check that a transaction of
‘start ¿ done‘ happens at least once during simulation?
Answer:
property start_done_transaction;
@(posedge clk) start |=> done;
endproperty
The ‘cover property‘ is used for functional coverage to ensure the ‘start -¿ done‘ scenario
occurs during simulation.
property burst_transfer;
@(posedge clk) burst_start |=> data_valid [*4];
endproperty
This checks that after ‘burst start‘, ‘data valid‘ remains high for 4 consecutive cycles,
indicating a proper burst transfer.
Q76. Explain how the ‘disable iff‘ clause works in assertions and provide
an example.
Answer:
The ‘disable iff‘ clause disables the assertion when its condition is true, effectively
masking the assertion temporarily.
Example:
property p;
@(posedge clk) disable iff (reset) (a |=> b);
endproperty
Concurrent assertion:
property p;
@(posedge clk) a |=> b;
endproperty
property p;
@(posedge clk) (a ##1 b) |=> (c ##1 d);
endproperty
Answer:
OOP in SystemVerilog is a programming paradigm that uses objects and classes to model
real-world entities and concepts. It supports encapsulation, inheritance, and polymor-
phism to improve code reuse, modularity, and maintainability in verification environ-
ments.
Answer:
The main features are:
- Encapsulation: Bundling data and methods in classes.
- Inheritance: Deriving new classes from existing ones to reuse and extend functionality.
- Polymorphism: Ability to call methods of derived classes through base class handles
(dynamic dispatch).
- Abstraction: Hiding implementation details behind interfaces and classes.
Answer:
A class is a blueprint for creating objects containing data (variables) and behavior (meth-
ods). It is defined using the class keyword.
Example:
class Packet;
int data;
function void display();
$display("Data = %0d", data);
endfunction
endclass
Answer:
You create an object using the new operator on a class handle.
Example:
Packet pkt;
pkt = new();
pkt.data = 10;
pkt.display();
Q85: What is a constructor in SystemVerilog classes?
Answer:
A constructor is a special function named new that initializes the object at creation. It
can take arguments to set initial values.
Example:
class Packet;
int data;
function new(int d);
data = d;
endfunction
endclass
Answer:
Inheritance allows a class (derived class) to acquire properties and methods of another
class (base class). Implemented using the extends keyword.
Example:
class BaseClass;
function void show();
$display("Base class");
endfunction
endclass
Answer:
Polymorphism allows methods to behave differently depending on the object’s actual
derived type, even if accessed through a base class handle. Achieved using virtual methods
and dynamic dispatch.
Q88: How do you declare and use virtual methods?
Answer:
Declare a method with the virtual keyword in the base class. Derived classes override
it. When called via a base class handle, the derived version executes at runtime.
Example:
class BaseClass;
virtual function void display();
$display("Base");
endfunction
endclass
BaseClass obj;
obj = new DerivedClass();
obj.display(); // Prints "Derived"
Q89: What are class handles and how do they differ from variables?
Answer:
Class handles are pointers/references to objects. Variables hold actual data. Class han-
dles allow dynamic memory allocation, sharing, and polymorphism.
Answer:
Objects are created dynamically using new. The simulator automatically garbage collects
unreferenced objects, but explicit delete can be used to free objects sooner.