SYSTEMVERILOG
ADVANCED INTERVIEW
QUESTIONS HANDBOOK
Code-Focused Questions with Complete
Solutions for VLSI & Verification Engineers
50+ advanced interview-ready
questions
Ideal for VLSI Enthusiasts,
Freshers, Experienced VLSI
Engineers & VLSI job interviews
Q1. Write a constraint where a 4-bit variable should
never take the values between 4 to 9.
class Test;
rand bit [3:0] data;
constraint c1 {
!(data inside {[4:9]});
}
endclass
module tb;
Test t = new();
initial begin
repeat(10) begin
void'([Link]());
$display("data = %0d", [Link]);
end
end
endmodule
Q2. Constrain an array of 5 integers such that sum
should be 50 and each element should be unique.
class Test;
rand int arr[5];
constraint c_sum {
foreach (arr[i]) arr[i] inside {[1:20]};
[Link]() == 50;
unique {arr};
}
endclass
module tb;
Test t = new();
initial begin
if ([Link]())
$display("arr = %p", [Link]);
else
$display("Randomization failed!");
end
endmodule
Q3. Write constraints for a packet class with length
between 64 to 1500, and the payload size equal to
length - 20.
class Packet;
rand int length;
rand int payload;
constraint c_range {
length inside {[64:1500]};
payload == length - 20;
}
endclass
module tb;
Packet p = new();
initial begin
if ([Link]())
$display("Length = %0d, Payload = %0d",
[Link], [Link]);
end
endmodule