QuestaSIM Guide
QuestaSIM Guide
Contents
1 Introduction
2 Simulating the UVM Out-Of-The-Box with Questa
o 2.1 Controlling UVM Versions
2.1.1 Modify the modelsim.ini File
2.1.2 Command Line Switch
3 Compiling UVM Automatically with 'vlog'
o 3.1 Questa Debug Package
Introduction
The UVM class library is an open source SystemVerilog package that relies on DPI c code in order to
implement some of the library features such as regular expression matching and register backdoor
accesses.
For UVM, we recommend using the built-in, pre-compiled UVM and DPI compiled libraries that ship
with Questa. This will remove the need to install any compilers or create a "build" environment.
Depending on the Questa version there should be at least 2-3 versions of the UVM library available.
If you have a file called hello.sv which imports the uvm_pkg, then your flow would look like this:
vlib work
vlog hello.sv
vsim hello ...
Notice that we don't have to specify +incdir+$UVM_HOME/src or add a -sv_lib command to the vsim
command to load the uvm_dpi shared object.
mtiUvm =$MODEL_TECH/../uvm-1.1d
This example is pointing to the UVM 1.1d release included inside the Questa release. If we wanted to
upgrade to UVM 1.2, then we would simply modify the line to look like this:
mtiUvm =$MODEL_TECH/../uvm-1.2
Command Line Switch
The Questa commands can also accept a switch on the command line to tell it which libraries to look
for. This switch overrides what is specified in the modelsim.ini file if there is a conflict. The switch is '-
L'. If this switch is used, then all Questa commands with the exception of vlib will need to use the
switch.
vlib work
vlog hello.sv -L$QUESTA_HOME/uvm-1.2
vsim hello -L$QUESTA_HOME/uvm-1.2 ...
To compile the same hello.sv file while also compiling the uvm_pkg manually, then the flow would
look like this:
vlib work
# Compile your own UVM
vlog +incdir+$UVM_HOME/src$UVM_HOME/src/uvm_pkg.sv$UVM_HOME/s
rc/dpi/uvm_dpi.cc
# Compile your testbench code
vlog +incdir+$UVM_HOME/src hello.sv
vsim hello ...
Notice that we are specifying the dpi c code on a command line directly to vlog. Vlog handles
compiling and automatically adding a -sv_lib switch to the vsim command line for us.
vlib work
# Compile your own UVM
vlog+incdir+$UVM_HOME/src $UVM_HOME/src/uvm_pkg.sv $UVM_HOME/
src/dpi/uvm_dpi.cc
# Compile the questa_uvm_pkg
vlog+incdir+$UVM_HOME/src+incdir+$QUESTA_HOME/verilog_src/que
sta_uvm_pkg-1.2/src \
$QUESTA_HOME/verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_
pkg.sv
# Compile your testbench code
vlog+incdir+$UVM_HOME/src hello.sv
vsim hello ...
The questa_uvm_pkg must be compiled because it references the uvm_pkg which was compiled with
vlog.