Interview
Interview
Ans: UVM (Universal Verification Methodology) is a standardized methodology for verifying the
both complex & simple digital design in simple way.
UVM Features:
Ans: Here is the detailed connection between SV, UVM, OVM and other methodologies.
Ans:
uvm_component:
• Quasi Static Entity (after build phase it is available throughout the simulation)
• Always tied to a given hardware(DUT Interface) Or a TLM port
• Having phasing mechanism for control the behavior of simulation
• Configuration Component Topology
uvm_object:
• Dynamic Entity (create when needed, transfer from one component to other & then
dereference)
• Not tied to a given hardware or any TLM port
• Not phasing mechanism
Q4: Why phasing is used? What are the different phases in uvm?
Ans: UVM Phases is used to control the behavior of simulation in a systematic way & execute in a
sequential ordered to avoid race condition. This could also be done in system verilog but manually.
1. List of UVM Phases:
2. buid_phase
3. connect_phase
4. end_of_elaboration_phase
5. start_of_simulation_phase
6. run _phase (task)
Sub Phases of Reset Phase:
pre_reset_phase
reset_phase
post_reset_phase
pre_configure_phase
configure_phase
post_configure_phase
pre_main_phase
main_phase
post_main_phase
pre_shutdown_phase
shutdown_phase
post_shutdown_phase
7. extract_phase
8. check_phase
9. report_phase
Below figure makes it more clear
Q5: Which uvm phase is top - down , bottom – up & parallel?
Ans: Only build phase is a top-down & other phases are bottom-up except run phase which is
parallel. The build phase works top-down since the testbench hierarchy may be configure so we
need to build the branches before leafs
Q6: Why build phase is top – down & connect phase is bottom – up?
Ans: The connect phase is intended to be used for making TLM connections between components,
which is why it occur after build phase. It work bottom-up so that its got the correct implementation
all the way up the design hierarchy, if worked top-down this would be not possible
Ans: Only run phase is a task (time consuming phase) & other phases are functions (non-blocking)
Ans: As previously said the run phase is implemented as task and remaining all are function. run
phase will get executed from start of simulation to till the end of simulation. run phase is time
consuming, where the testcase is running.
Ans: UVM phases initiate by calling run_test(“test1”) in top module. When run_test() method call,
it first create the object of test top & then call all phases.
Ans: In top module write run_test(); i.e. Don't give anything in argument.
Then in command line : +UVM_TESTNAME=testname
Ans: uvm_config_db is a parameterized class used for configuration of different type of parameter
into the uvm database, So that it can be used by any component in the lower level of hierarchy.
All of the functions in uvm_config_db#(T) are static, so they must be called using the :: operator
It is extended from the uvm_resource_db#(T), so it is child class of uvm_resource_db#(T)
Ans: The utils macros define the infrastructure needed to enable the object/component for correct
factory operation.
The reason there are two macros is because the factory design pattern fixes the number of
arguments that a constructor can have. Classes derived from uvm_object have constructors with one
argument, a string name. Classes derived from uvm_component have two arguments, a name and a
uvm_component parent.
The two `uvm_*utils macros inserts code that gives you a factory create() method that delegates
calls to the constructors of uvm_object or uvm_component. You need to use the respective macro so
that the correct constructor arguments get passed through. This means that you cannot add extra
constructor arguments when you extend these classes in order to be able to use the UVM factory.
1. create
2. start_item
3. randomize
4. finish_item
5. get_response (optional)
while `uvm_rand_send perform all the above steps except create. User needs to create sequence /
sequence_item.
Ans: UVM is a methodology based on SystemVerilog language and is not a language on its
own. It is a standardized methodology that defines several best practices in verification to
enable efficiency in terms of reuse and is also currently part of IEEE 1800.2 working group.
Ans: In addition to the predefined phases available in uvm , the user has the option to add his own
phase to a component. This is typically done by extending the uvm_phase class the constructor
needs to call super.new which has three arguments
• Name of the phase task or function
• Top down or bottom up phase
• Task or function
The call_task or call_func and get_type_name need to be implemented to complete the addition of
new phase.
Example
class custom_phase extends uvm_phase;
function new();
super.new(“custom”,1,1);
endfunction
Ans: In a verification context, a register model (or register abstraction layer) is a set of classes that
model the memory mapped behavior of registers and memories in the DUT in order to facilitate
stimulus generation and functional checking (and optionally some aspects of functional coverage).
The UVM provides a set of base classes that can be extended to implement comprehensive register
modeling capabilities.
Ans: We all know about new() method that is use to allocate memory to an object instance. In UVM
(and OVM), the create() method causes an object instance to be created from the factory. This
allows you to use factory overrides to replace the desired object with an object of a different type
without having to recode.
Q21: What is analysis port?
Analysis port (class uvm_tlm_analysis_port) — a specific type of transaction-level port that can be
connected to zero, one, or many analysis exports and through which a component may call the
method write implemented in another component, specifically a subscriber.
uvm_analysis_port
Broadcasts a value to all subscribers implementing a uvm_analysis_imp.
uvm_analysis_imp
Receives all transactions broadcasted by a uvm_analysis_port.
uvm_analysis_export
Exports a lower-level uvm_analysis_imp to its parent.
In simpler words TLM FIFO is a FIFO between two UVM components, preferably between
Monitor and Scoreboard. Monitor keep on sending the DATA, which will be stored in TLM FIFO,
and Scoreboard can get data from TLM FIFO whenever needed.
start_item and finish_item together will initiate operation of a sequence item. If the item has not
already been initialized using create_item, then it will be initialized here to use the default
sequencer specified by m_sequencer.
Q24: What is the difference between UVM RAL model backdoor write/read and front door
write/read ?
Fontdoor access means using the standard access mechanism external to the DUT to read or write to
a register. This usually involves sequences of time-consuming transactions on a bus interface.
Backdoor access means accessing a register directly via hierarchical reference or outside the
language via the PLI. A backdoor reference usually in 0 simulation time.
There is a built-in objection for each in-built phase, which provides a way for components and
objects to synchronize their testing activity and indicate when it is safe to end the phase and,
ultimately, the test end.
The component or sequence will raise a phase objection at the beginning of an activity that must be
completed before the phase stops, so the objection will be dropped at the end of that activity. Once
all of the raised objections are dropped, the phase terminates.
m_sequencer is the default handle for uvm_vitual_sequencer and p_sequencer is the hook up for
child sequencer.
m_sequencer is the generic uvm_sequencer pointer. It will always exist for the uvm_sequence and
is initialized when the sequence is started.
The drawback of p_sequencer is that once the p_sequencer is defined, one cannot run the sequence
on any other sequencer type.
Q27: What is the difference between Active mode and Passive mode with respect to agent?
In active mode, the sequencer and the driver are constructed and stimulus is generated by
sequences sending sequence items to the driver through the sequencer. At the same time the monitor
assembles pin level activity into analysis transactions.
In passive mode, only the monitor is constructed and it performs the same function as in an active
agent. Therefore, your passive agent has no need for a sequencer. You can set up the monitor using a
configuration object.
The copy() method can be used as needed in the UVM testbench. One common place where the
copy() method is used is to copy the sampled transaction and pass it into a sb_calc_exp()
(scoreboard calculate expected) external function that is frequently used by the scoreboard
predictor.
The clone() method calls the create() method (constructs an object of the same type) and then calls
the copy() method. It is a one-step command to create and copy an existing object to a new object
handle.
UCM Factory is used to manufacture (create) UVM objects and components. Apart from creating
the UVM objects and components the factory concept essentially means that you can modify or
substitute the nature of the components created by the factory without making changes to the
testbench.
For example, if you have written two driver classes, and the environment uses only one of them. By
registering both the drivers with the factory, you can ask the factory to substitute the existing driver
in environment with the other type. The code needed to achieve this is minimal, and can be written
in the test.
http://www.vlsiencyclopedia.com/2015/09/uvm-interview-questions.html
SV
What Is Callback ?
In computer programming, a callback is executable code that is passed as an argument to
other code. It allows a lower-level software layer to call a subroutine (or function) defined in
a higher-level layer.
- Clock specification
- Input skew,output skew
- Cycle delay (##)
• Can be declared inside interface,module or program
Example :
01.Module M1(ck, enin, din, enout, dout);
02.input ck,enin;
03.input [31:0] din ;
04.output enout ;
05.output [31:0] dout ;
06.
07.clocking sd @(posedge ck);
08.input #2ns ein,din ;
09.output #3ns enout, dout;
10.endclocking:sd
11.
12.reg [7:0] sab ;
13.initial begin
14.sab = sd.din[7:0];
15.end
16.endmodule:M1
• What Is Oops?
Here are some nice OOP links on SystemVerilog OOP which can be used as a good starting
point/reference.
• Object Oriented Programming for Hardware Verification
• Improve Your SystemVerilog OOP Skills by Learning Principles and Patterns
• SystemVerilog OOP OVM Feature Summary
• Enhancing SystemVerilog with AOP Concepts (On how to mimic AOP features in
OOP, good for guyz coming from e background)
• Testbench.in OOP Tutorial
• What Is $root?
$root refers to the top level instance in SystemVerilog
1.package ABC;
2.$root.A; // top level instance A
3.$root.A.B.C; // item C within instance B within top level instance A
• What Is "this"?
"this" pointer refers to current instance.