Using the UVM libraries with Questa
by Rich Edelman and Dave Rich
Introduction
The UVM is a derivative of OVM 2.1.1. It has similar use model, and is run in generally the same way.
One significant change is that the UVM requires a DPI compiled library in order to enable regular expression matching, backdoor access and other functionality.
When running UVM based testbenches, we recommend using the built-in, pre-compiled UVM and DPI compiled libraries. This will remove the need to install any compilers or create a “build” environment.
One other issue to mention if you are converting from OVM to UVM, and if you use stop_request() and/or global_stop_request(), then you will need to use the following plusarg, otherwise your testbench will end prematurely without awaiting your stop_request().
vsim +UVM_USE_OVM_RUN_SEMANTIC +UVM_TESTNAME=hello …
Simulating with UVM Out-Of-The-Box with Questa
The UVM base class libiraries can be used out of the box with Questa 10.0b or higher very easily. There is no need to compile the SystemVerilog UVM package or the C DPI source code yourself. The Questa 10.0b release and every release afterwards contains a pre-compiled DPI library, as well as a pre-compiled UVM library. The only dependency is that your host system requires glibc-2.3.4 or later installed. Questa 10.0c Windows users only, please read this important note about the location of the DPI libraries.
You can easily use these steps:
vlib work
vlog hello.sv
vsim hello …
|
Notice that we don’t have to specify +incdir+$(UVM_HOME)/src, $(UVM_HOME)/src/uvm_pkg.sv to vlog, or add a -sv_lib command to the vsim command to load the uvm_dpi shared object.
Controling UVM Versions
Each release of Questa comes with multiple versions of the UVM pre-compiled and ready to load. Â By default, a fresh install of Questa will load the latest version of UVM that is available in the release. Â If an older version of UVM is needed, this version can be selected in one of two ways.
Modify the modelsim.ini File
Inside the modelsim.ini file, it contains a line which defines a library mapping for Questa. Â That line is the mtiUvm line. Â It looks something like this:
mtiUvm = $MODEL_TECH/../uvm-1.1b |
This example is pointing to the UVM 1.1b release included inside the Questa release. Â If we wanted to downgrade to UVM 1.1a, then we would simply modify the line to look like this:
mtiUvm = $MODEL_TECH/../uvm-1.1a |
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.1a vsim hello -L $QUESTA_HOME/uvm-1.1a ...
If you are using some other platform, or you want to compile your own DPI library, please follow the directions below.
If you use an earlier Questa installation, like 6.6d or 10.0, then you must supply the +incdir, and you must compile the UVM.
For example, with 10.0a on linux, you can do
vlib work
vlog hello.sv
vsim -c -sv_lib $UVM_HOME/lib/uvm_dpi …
if you use your own UVM download, or you use Questa 6.6d or 10.0 you need to do the following:
vlib work
vlog +incdir+$UVM_HOME/src $UVM_HOME/src/uvm_pkg.sv
mkdir -p $UVM_HOME/lib
g++ -m32 -fPIC -DQUESTA -g -W -shared
-I/u/release/10.0a/questasim//include
$UVM_HOME/src/dpi/uvm_dpi.cc
-o $UVM_HOME/lib/uvm_dpi.so
vlog +incdir+$UVM_HOME/src hello.sv
vsim -c -sv_lib $UVM_HOME/lib/uvm_dpi …
Building the UVM DPI Shared Object Yourself
If you don’t use the built-in, pre-compiled UVM, then you must provide the vlog +incdir+ and you must compile the UVM yourself, including the DPI library.
In $UVM_HOME/examples, there is a Makefile.questa which can compile and link your DPI shared object.
For Linux (linux):
cd $UVM_HOME/examples
setenv MTI_HOME /u/release/10.0a/questasim/
make -f Makefile.questa dpi_lib
> mkdir -p ../lib
> g++ -m32 -fPIC -DQUESTA -g -W -shared
>Â Â -I/u/release/10.0a/questasim//include
>Â Â ../src/dpi/uvm_dpi.cc -o ../lib/uvm_dpi.so
For Linux 64 (linux_x86_64)
cd $UVM_HOME/examples
setenv MTI_HOME /u/release/10.0a/questasim/
make LIBNAME=uvm_dpi64 BITS=64 -f Makefile.questa dpi_lib
> mkdir -p ../lib
> g++ -m64 -fPIC -DQUESTA -g -W -shared
>Â Â -I/u/release/10.0a/questasim//include
>Â Â ../src/dpi/uvm_dpi.cc -o ../lib/uvm_dpi64.so
For Windows (win32):
cd $UVM_HOME/examples
setenv MTI_HOME /u/release/10.0a/questasim/
make -f Makefile.questa dpi_libWin
> mkdir -p ../lib
> c:/QuestaSim_10.0a/gcc-4.2.1-mingw32vc9/bin/g++.exe
>Â Â -g -DQUESTA -W -shared
>Â Â -Bsymbolic -Ic:/QuestaSim_10.0a/include
>Â Â ../src/dpi/uvm_dpi.cc -o
>Â Â ../lib/uvm_dpi.dll
>Â Â c:/QuestaSim_10.0a/win32/mtipli.dll -lregex
Note: For Windows, you must use the GCC provided on the Questa download page: (questasim-gcc-4.2.1-mingw32vc9.zip)
Save to /tmp/questasim-gcc-4.2.1-mingw32vc9.zip
cd $MTI_HOME
unzip /tmp/questasim-gcc-4.2.1-mingw32vc9.zip
<creates the GCC directories in the MTI_HOME>
Using the UVM DPI Shared Object
You should add the -sv_lib switch to your vsim invocation. You do not need to specify the extension, vsim will look for ‘.so’ on linux and linux_x86_64, and ‘.dll’ on Windows.
linux:
vsim -sv_lib $UVM_HOME/lib/uvm_dpi -do “run -all; quit -f”
linux_x86_64:
vsim -sv_lib $UVM_HOME/lib/uvm_dpi64 -do “run -all; quit -f”
win32:
cp $UVM_HOME/lib/uvm_dpi.dll .
vsim -sv_lib uvm_dpi -do “run -all; quit -f”
Running the examples from the UVM 1.1 Release
If you want to run the examples from the UVM 1.0 Release you need to get the Open Source kit – it contains the examples.
1. Download the UVM tar.gz and unpack it.
- Go to http://verificationacademy.com/verification-methodology – the download link is in the “UVM/OVM Downloads & Contributions” box.
- On the Accellera download page, click on “Download UVM”
2. set your UVM_HOME to point to the UVM installation.
- setenv UVM_HOME /tmp/uvm-<version#>
3. Go to the example that you want to run.
- cd $UVM_HOME/examples/simple/hello_world
4. Invoke make for your platform:
- For Windows (win32)
cd $UVM_HOME/examples/simple/hello_world make DPILIB_TARGET=dpi_libWin -f Makefile.questa all # Note: for windows, you need a "development area", with make, gcc/g++, etc. Using cygwin is the easiest solution |
- For Linux (linux)
cd $UVM_HOME/examples/simple/hello_world make -f Makefile.questa all |
- For Linux 64 (linux_x86_64)
cd $UVM_HOME/examples/simple/hello_world make BITS=64 -f Makefile.questa all |
Migration from OVM to UVM
An OVM design can be migrated to UVM using a script. Many OVM designs can work without any hand coded changes or other intervention. It is a good idea to first get your design running on the latest version of OVM 2.1.2, before starting the migration process.
These designs can be converted from OVM to UVM using the distributed conversion script:
cd $MY_TEST_BENCH
$UVM_HOME/bin/ovm2uvm
In certain cases hand coded changes might be required.
Using the ovm2uvm script, you can run a “dry run” try and see what must be changed. There are many options to the script. Before using it, you should study it carefully, and run it in ‘dry-run’ mode until you are comfortable with it. In all cases, make a backup copy of your source code, before you use the script to replace-in-place.
By default it does not change files.
Here is a simple script which copies the ovm code, then applies
the script.
# Copy my ovm-source to a new place.
(cd ovm-source; tar cf – .) | (mkdir -p uvm-source; cd uvm-source; tar xf -)
# Do a dry-run
$UVM_HOME/bin/ovm2uvm.pl -top_dir uvm-source
# Examine the *.patch file
….
# If satisfied with the analysis, change in place
$UVM_HOME/bin/ovm2uvm.pl -top_dir uvm-source -write
If you are migrating to the UVM from OVM, you are NOT required to use this script, but you must do a conversion by some means.
Once your OVM design is converted to UVM, you are almost ready to run.
The UVM requires that you use some DPI code. Additionally, the UVM defines a different semantic for run(). If you are using an OVM design converted to UVM, and you use stop_request() or global_stop_request(), then you need to add a switch:
vsim +UVM_USE_OVM_RUN_SEMANTIC +UVM_TESTNAME=hello …
In order to NOT use this switch, you need to change your OVM design. You need to NOT use stop_request() or global_stop_request(). You should cause your test and testbench to be controlled by raising objections as the first thing in your run tasks, and then lowering your objections where you previously had your stop requests.
More information about migrating from OVM to UVM can be found in the Verification Academy Cookbook (registration required).
Comments
Leave a Reply
You must be logged in to post a comment.
localhost% /work/sv/uvm-1.0p1/examples>make -f Makefile.questa dpi_lib
mkdir -p /work/sv/uvm-1.0p1/lib
g++ -m32 -fPIC -DQUESTA -g -W -shared -I/asic/ssg_vol2/modeltech/questa6_4a/questasim/include /work/sv/uvm-1.0p1/src/dpi/uvm_dpi.cc -o /work/sv/uvm-1.0p1/lib/uvm_dpi.so
In file included from /work/sv/uvm-1.0p1/src/dpi/uvm_dpi.cc:30:
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c: In function `int uvm_hdl_set_vlog(char*, t_vpi_vecval*, PLI_INT32)’:
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c:234: error: `vpi_release_handle’ was not declared in this scope
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c: In function `int uvm_hdl_get_vlog(char*, t_vpi_vecval*, PLI_INT32)’:
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c:294: error: `vpi_release_handle’ was not declared in this scope
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c:311: error: `vpi_release_handle’ was not declared in this scope
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c: In function `int uvm_hdl_check_path(char*)’:
/work/sv/uvm-1.0p1/src/dpi/uvm_hdl.c:341: error: `vpi_release_handle’ was not declared in this scope
make: *** [dpi_lib] Error 1
What’s wrong here?
mdt,
You are using a very old version of Questa. You need at least version 6.6d. 10.0a is the current version.
Dave,
Thank you very much!
Hi,
I am trying to use uvm-1.0p1 with 10.0b. Can you please specify steps?
I used uvm_1.0 with 10.0a and everything was working OK.
Now I am getting the following
Warning: (vsim-3747) Failed to find user-specified function ‘uvm_hdl_check_path’ in DPI search list ….
…………………………….
Fatal: (vsim-160) …10.0b/verilog_src/uvm-1.0p1/src/dpi/uvm_svcmd_dpi.svh(27): Null foreign function pointer encountered when calling ‘dpi_get_next_arg_c’
Thanks in advance
With 10.0b, the out-of-the-box instructions change to no -sv_lib switch required.
Hi,
the important note for questa 10.0c windows users – link is broken. What doe’s it says?
Thanks
You need a SupportNet account to see the document. Basically it says the DPI library was placed in the wrong location in the distribution and you need to move or link it to the correct location.
Hi Dave,
I am trying to run UVM 1.1 on Questa 10.0c and am facing the same issue. Just like “orenieru” I am also seeing that “important link” says “broken link”. Where is this uvm_dpi.so supposed to be in the install dir? And more importantly what is the final use model to use the pre-compiled DPI for UVM 1.1?
Thanks
Srini
http://www.cvcblr.com
BTW, quick update – a simple find command on Cygwin (Windows) revealed no results for uvm_dpi.so, so am I supposed to compile it? Will the 10.0c1 relelase have the fix?
Thanks
You need to move
/win32//uvm_dpi.dll
to
//win32/
Then, no -sv_lib switch is required.
How to resolve error in simulating UVM1.1 W7(64-bit ) Questasim10.0c even installed gcc-4.2.1-mingw32vc9.
** Fatal: (vsim-7019) Can’t locate a C compiler for compilation of DPI export tasks/functions.
#
# Time: 0 ns Iteration: 0 Unknown: File: UNKNOWN
# FATAL ERROR while loading design
Make sure you are using the 32-bit version of Questa (recommended anyways because 32-bit mode is faster) with a 32-bit compiler. Did you put the compiler on your system path?
hi ,
how to update uvm 1.0 to uvm 1.1 ?in linux
Hi ,
I am getting error with uvm-1.1d with questa 10.0b
make DPILIB_TARGET=dpi_libWin -f Makefile.questa all
mkdir -p ../../../lib
/cygdrive/c/questasim_10.0b//gcc-4.2.1-mingw32vc9/bin/g++.exe -g -DQUESTA -W -shared -Bsymbolic -x c -I/cygdrive/c/questasim_10.0b//include ../../../src/dpi/uvm_dpi.cc -o ../../../lib/uvm_dpi.dll /cygdrive/c/questasim_10.0b//win32/mtipli.dll -lregex
In file included from ../../../src/dpi/uvm_dpi.cc:34:
../../../src/dpi/uvm_regex.cc:26:22: error: vpi_user.h: No such file or directory
In file included from ../../../src/dpi/uvm_dpi.cc:34:
../../../src/dpi/uvm_regex.cc: In function ‘uvm_re_match’:
I am trying to simulate the examples with Questasim 10.0c. I can compile ok but when I try to simulate I get a lot of error messages like the following
** Warning: (vsim-3770) Failed to find user specified function ‘uvm_hdl_check_path’. The search list was empty.
# Using -sv_lib, -sv_root, and -sv_liblist arguments can provide a search list
# of shared libraries that will be used to resolve user specified functions.
# Time: 0 ns Iteration: 0 Instance: /hello_world File: D:/HDS/uvm/examples/simple/hello_world/hello_world.sv
# ** Warning: (vsim-3770) Failed to find user specified function ‘uvm_hdl_deposit’. The search list was empty.
# Using -sv_lib, -sv_root, and -sv_liblist arguments can provide a search list
# of shared libraries that will be used to resolve user specified functions.
# Time: 0 ns Iteration: 0 Instance: /hello_world File: D:/HDS/uvm/examples/simple/hello_world/hello_world.sv
# ** Warning: (vsim-3770) Failed to find user specified function ‘uvm_hdl_force’. The search list was empty.
# Using -sv_lib, -sv_root, and -sv_liblist arguments can provide a search list
# of shared libraries that will be used to resolve user specified functions.
Can anyone give me a solution?
Thanks
Please read the important note above about using the UVM with 10.0c on Windows. That release had misplaced files.
Provided link is not opening. Can u tell me what to do to run UVM on Questa 10.0c on windows
Am very new to UVM and stuck with this error.. please help in sloving this.
** Error: pci_package.sv(27): near “endpackage”: syntax error, unexpected endpackage, expecting function or task
make: *** [comp] Error 2
hi dave,
i am trying to stimulate questasim 10.1c but i am getting the error as “failed to find user specified function ‘uvm_hdl_check_path’ in DPI C/C++ source ” . .thanks in advance
while compiling the UVM based testbench, Questa sim 10.2 tool gave these mesages as “unexpected signal 11 error” . please suggest us, why we are getting error.
Please contact http://supportnet.mentor.com and provide more information about the OS version, command line used, and any messages prior to the fatal error.
after read this note ,, still I failed to run ubus example exist in uvm kit developed by accellera ,, shall you derive me the nested steps to do this so as to know my mistakes ,,,
Hi, Dave
I’d like to know whether modelsim/6.3g can compile uvm-1.1d
while compilation in questa 10.0b, I am getting a warning:
# ** Warning: (vsim-8607) G:/projects/work/spi_top.v(120): Non-positive replication multiplier inside concat. Replication will be ignored.
How to remove this.
Thanks.
Please use the Verification Academy forums to ask questions like this and supply the supporting lines of code that are causing the error.
Hi all,
i’m using ModelSim 10.1c to simulate an UVM code using UVM 1.1b, i got the following fatal error:
vl_unpack_regbit: Cannot handle type
what does it mean?
Hello sir,
I’m using questa sim 10.0b in windows 8.1 but when i gave make run_test it’s shows make is not recognized as an int. Or extnl command. Please to me to how this problem overcome
Hi
Can anybody tell how to utilize UVM 1.2 package in questasim 10.0b
Please help me out in the complete steps that i need to follow for using UVM package.
thanks in advance
Field/method name (m_do_cycle_check) not in ‘__m_uvm_status_container’
this error is generated in questasim
Please use the Verification Academy Forums
Hi Dave can you tell me how i can run uvm in questasim using cygwin, i need the steps
Sorry, I can’t provide that kind of support.