System Verilog Interview Questions
System Verilog Interview Questions
System Verilog Interview Questions
Q. What is default data type of byte, shortint, int, integer and longint?
A. 2-state for byte,shortint, int, longint and 4-state for integer.
Q. What is callback ?
Callback is mechanism of changing to behavior of a verification component such as driver or generator
or monitor without actually changing to code of the component. It's used for functional coverage, inject
error and output transaction in a scoreboard.
Q. Explain the difference between data types logic and reg and wire.
A. Logic is a data-type which can be used both as a wire or a reg.
A reg is data type which can hold certain valu and can be used inside procedural blocks only, while wire
is just like a wire in real time which can be only driven, and cannot be declared inside any procedural
block but can only be assigned using assign keyword.
Q. What are the ways to avoid race condition between testbench and RTL using SystemVerilog?
Program block
Clocking block
Enforcement of design signals being driven in non-blocking fashion from program block
if(My_usb_packet == null) begin.// This loop will get exited if the handle is not holding any
object
end else begin// Hurray ... the handle is holding an object
end
int UniqVal[10];
foreach(UniqVal[i]) UniqVal[i] = i;
UniqVal.shuffle();
class Base;
integer a,b;
task always_task();
fork
forever
begin
@(a,b);
$display(" a is %d : b is %d at %t ",a,b,$time);
end
join_none
endtask
endclass
forever begin
fork
begin : reset_logic
@ (negedge reset_);
data <= '0;
end : reset_logic
begin : clk_logic
@ (posedge clk);
if(!reset_) data <= '0;
else data <= data_next;
end : clk_logic
join_any
disable fork
end
Q. Describe the difference between Code Coverage and Functional Coverage Which is more important
and Why we need them?
Code Coverage indicates the how much of RTL has been exercised. The Functional Coverage indicates
which features or functions has been executed. Both of them are very important. With only Code
Coverage, it may not present the real features coverage. On the other hand, the functional coverage
may miss some unused RTL coverage.
Q. What is polymorphism?
Polymorphism allows an entity to take a variety of representations. Polymorphism means
the ability to request that the same Operations be performed by a wide range of different types of
things. Effectively, this means that you can ask many different objects to perform the same action.
Override polymorphism is an override of existing code. Subclasses of existing classes are given a
"replacement method" for methods in the superclass. Superclass objects may also use the replacement
methods when dealing with objects of the subtype. The replacement method that a subclass provides
has exactly the same signature as the original method in the superclass.
Polymorphism allows the redefining of methods for derived classes while enforcing a
common interface.To achieve polymorphism the 'virtual' identifier must be used when defining the base
class and method(s) within that class.
Q. What is bin?
A coverage-point bin associates a name and a count with a set of values or a sequence of value
transitions. If the bin designates a set of values, the count is incremented every time the coverage
point matches one of the values in the set. If the bin designates a sequence of value transitions,
the count is incremented every time the coverage point matches the entire sequence of value
transitions.
Q. Do we need to call super.new() when extending a class ? What happens if we don’t call?
The new constructor is by default called by the extended class while creating, but if the parent
class constructor needs some arguments then we should pass the arguments from the extended
class constructor, which is mandatory and should always be on the first line of the function new()
of extended class.
Q. What is the need to implement explicitly a copy() method inside a transaction , when we
can simple assign one object to other ?
Assigning an object handle to another will simply make both of the handles to point to a same
object, and will share same resource of memory, so as to separate both the objects according to
its handle name we need to have a copy method to create a replica of the object.
Q. Explain how the timescale unit and precision are taken when a module does not have
any timescalerdeclaration in RTL?