System Verilog_Interview_Question

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

SV INTERVIEW QUESTION

SV Interview Questions
❖ What and When Type of Questions:
➔ Datatypes:
1. Different types of data types, when to use which one and fundamentals
● byte vs. bit [7:0]
● Types of arrays and when to use them
2. Difference between Associative array and dynamic array.
3. Byte and bit [7:0] in terms of signed and unsigned (packed & unpacked array).
4. Advantage of associative array over dynamic array.
5. Why to use logic data type?
6. How can we access the particular index in queue?
7. Does an unpacked array have a packed array inside it?
8. What is the difference between packed And Unpacked Array?
9. Logic, bit, wire and reg explanation.
10. Wire value assignment?
11. How 4state consume more memory compare to 2state?
12. When to use dynamic array and when to use associative?
13. Can we peek from queue?

➔ Procedural Statements:
14. What is the use of ref keyword?
15. Difference between Task and Function.
16. Overloading and overriding using task and functions?
17. How can we replace $monitor with $display?
18. Out of all fork join, which one is used in a function?
19. Explain always_comb and always@(*).
20. Can we write Task in function or function in task??
21. Explain Fork join,fork join_none,fork join_any,disable fork,wait fork?
22. Blocking and non-blocking assignment with example.
23. What we will be there on LHS and RHS of continuous assignment statement? (i.e., reg or wire)
24. Create a Multidimensional dynamic array and assign values.
25. How to disable one process in fork join?
26. Difference between initial and final block.
27. Difference between always and initial block.
SV INTERVIEW QUESTION

28. If there is a fork_join inside a fork_join, then how to disable only inner fork_join without using
label.
29. What are producedural or non-procedural statement?

➔ IPC:
30. IPC concepts explanation, their uses in layered testbench, examples and fundamentals.
31. Mailbox, queue, and event explanation?
32. Explain Event regions.
33. Explain bounded and unbounded mailbox.
34. Difference between get and try_get methods of semaphore.
35. Difference between ‘get’ and ‘peek’ methods of mailbox.
36. How does race condition occur in event data type?
37. Use of mailbox in layered TB?
38. Semaphore based question?
39. edge vs level triggered event.
40. If the size of queue and mailbox are same, then is there any difference between them?
41. put is blocking or non-blocking?
42. @ and .triggered difference.

➔ Interface:
43. Interface benefits, examples, use of modport and clocking block pros and cons.
44. What is the use of clocking block and how does it avoid race conditions?
45. What is input skew and output skew.
46. What is skew? Why is it use?
47. Fundamental of interface, modport and clocking.
48. Why do we need to take the interface as virtual in a class?
49. When do we need to define a modport in an interface?
50. If I have a modport with few signals as input and other as output, if in my testbench I need the
input declared signals to work as output and same for the output declared signals, what would u
do?
51. Can we call task and function that define in interface?
52. virtual vs physical interface.
53. In interface why we use datatype as logic?
SV INTERVIEW QUESTION

➔ OOPS:
54. Why OOP? Advantages of OOP, OOPS concepts and properties
● Inheritance use case
● Virtual methods purpose
● Purpose of abstract classes
55. Deep copy and shallow copy.
56. Virtual and pure virtual.
57. Fundamentals of Static and dynamic casting, usage of dynamic casting.
58. What is the use of this keyword?
59. What is the use of $cast?
60. You have a task in base class, how can you call in derived class?
61. What is polymorphism?
62. Use case of virtual method.
63. Static properties and methods.
64. Explain fundamental of OOPs.
65. What is $cast?
66. What is abstract class?
67. Explain SV Inheritance.
68. How can we override a base class method in an extended class?
69. When do we need to define a method as virtual in a class?
70. Difference between Overriding and Overloading.
71. Explain local and protected.
72. What is high level constructor in OOPs?

➔ Constraint Randomization:
73. Randomization examples based on constraints
● := vs. :/
● How to check that pkt is randomized or not except $display/$write/$monitor?
ANS. assert(pkt.randomize);

• Why derived class_constraint overrides the parent class constraint?


74. What is the replacement of randc to generate unique values?
75. Write not repeat random number without using randc keyword.
76. Difference Between $urandom and $urandom_range.
77. Can we randomize the variable which is not declared as ‘rand’?
78. Word size =32 based address generation by randomization.
SV INTERVIEW QUESTION

79. How to create non-negative values in constraint of dynamic array?


80. What are inline constraints?
81. What is the purpose of using solve before in a constraint?
82. What is Inline Constraint?
83. Example of Soft constraint (Indirectly Ask)?
84. What is Bidirectional constraint?
85. Indirectly Ask Example of disable constraint.
86. Static constraint example.
87. How to override any constraint of base class?
88. If want to disable constraint, how is it disable? give two ways for that.
89. Create a dynamic array of size 100. Fill each element of the array from 1 to 100 such that 1 to
100 should not be in series. (All the elements should be in random positions).
90. Write a constraint for aligned address and range between 200-500.
91. What is standard randomization?
92. Write constraint where I have array of size 5, assign values with value same as its index.
93. Different between randcase and rand sequence.

➔ Layered TB:
94. The requirement of each block of layered testbench and their role
● What is the purpose of an interface in SV layered TB?
● Does scoreboard always require the reference model?
● Working of reference model.
95. Explain program and module.
96. What is active and passive monitor?
97. Why we use fork join_none in the driver class’s run task?
98. What purpose Scoreboard serves in Testbench?
99. Why we need driver, generator and monitor and scoreboard?
100. Reference model how to get input?
101. If we connect slave DUT instead of slave VIP, how will you implement scoreboard?
102. Without test instance create how we call test run in testbench?
103. Why monitor required?
104. How did you access the value from config class to driver and monitor?
105. How does driver and sequencer handshaking mechanism work?
SV INTERVIEW QUESTION

➔ Assertions:
106. Assertion uses, fundamentals, problems, and examples
● Assertions vs. checkers
● Can we assert property inside property definition?
107. $rose and posedge
108. Difference between immediate and concurrent assertion?
109. $rose and $fell
110. Implication operator
111. Fundamental of assertion
112. Write an assertion to check that if ‘req’ signal is asserted, then, ‘gnt’ signal should be asserted
after two clock cycles.
113. Why we need assertion?
114. Difference between ##1 and |=>.
115. How antecedent should fire if condition is not true?
116. Difference between ##0, |->, |=>.
117. Are following assertions equivalent?
1) @(posedge clk) req |=> ##2 $rose(ack);
2) @(posedge clk) req |-> ##3 $rose(ack);
117. If more than one values are required for a signal, then how do you write assertion for that
without using (||)
118. What if we write assertions in test?

➔ Coverage:
118. What is coverage?
119. What are different types of coverage?
120. What are the different types of code coverage?
121. Cross coverage, purpose of coverage
• Code coverage vs. Functional coverage
• Conditional coverage
122. Illegal and ignore bins.
123. Types of Coverage.
124. Functional Coverage.
125. Implication operator.
126. How do we ensure in layer tb that all the test cases have been covered?
127. What will you comment if functional cvg is 100% and code coverage is 90% and vice versa?
128. What it signifies if functional coverage is low and code coverage is 100%?
SV INTERVIEW QUESTION

129. Where we declare cover groups in a layer tb?


130. Functional coverage basic example?
131. Sampling method in functional coverage?
132. Code coverage has transitions bins, so it is necessary to write that bin in functional
133. How you have covered FSM coverage
134. Cross coverage possible between two cover groups?
135. Define implicit and explicit bins.
136. What are wildcard bins?
137. What is cross coverage?
138. To cover bit [7:0] how much bins required?
139. Write a transitions coverage on given statement 100 100 100.
140. What is coverage? is it possible to come result of coverage = 90% and scoreboard = 50%?
141. What is per instance in coverage?
142. What are the cover points and cover group?

➔ Miscellaneous:
143. Difference between
• == & ===
• Localparam and typedef
144. What is the advantage of System Verilog over Verilog?
145. Explain all the system tasks (difference between $display and $monitor)
146. What is Scope resolution operator?
147. What is callback?
148. What is the Output of following code: wire x; assign x=0; assign x=1; $display(x);
149. `define and parameter difference.
150. Default Data Type of Enum
151. What is difference between assertion and checker?
152. Difference between parameter and constant.
153. Difference between parameter and define.
154. Meaning of compilation and run.
155. We can check design by Verilog, but why we prefer SV?
156. In Enum data type signed or unsigned?
157. Describe: a=b; b=c; c= a; v/s a<=b; b<=c; c<=a;
158. What is Checker?
SV INTERVIEW QUESTION

❖ How to implement type of Questions:


1. Conversion from pack to unpack and unpack to pack an array.
2. How to implement different types of arrays.
3. I have a piece of code so what will be the output of this code and how many threads will be
created
fork
for (int i=0;i<10;i++) begin
Abc; //this is task called
end
Join
4. Suppose i have processes, one two four five, and i have to include process “three” so where and
how can i include it without disturbing other processes.
5. Suppose i have a constraint in base class with constraint addr_c {addr <5;} and by using in-line
constraint i use {addr>5;} so it will lead to constraint failure, so what are the methods to avoid
that failure.
6. How to assign a size of dynamic array from 1 to 10 without having negative values.
7. Suppose i have the following piece of code, what will be the output
module xyz;
initial
begin

for(int j=0;j<3;j++) begin

fork
$display(j);
join_none

end
end
SV INTERVIEW QUESTION

8. And continue to question 27, what if i made the following change


module xyz;
initial
begin

for(int j=0;j<3;j++) begin


#1;
fork
$display(j);
join_none

end
end
9. initial begin
for(int j=0;j<3;j++) begin
#1;
fork
$display(j);
join_none;
end
end
10. Declare a function having unpacked array return type.
11. How to write following code using forever block.
12. Predict the output:
fork
//Process-1
begin
$display($time,"P1");
SV INTERVIEW QUESTION

#5;
$display($time,"P1 - a");
end
//Process-2
begin
$display($time,"P2");
#20;
$display($time,"P2 - a ");
end
join_any$display ($time, "p3");

You might also like