{"id":2056,"date":"2011-03-08T09:05:50","date_gmt":"2011-03-08T16:05:50","guid":{"rendered":"https:\/\/blogs.mentor.com\/verificationhorizons\/?p=2056"},"modified":"2026-03-27T08:33:59","modified_gmt":"2026-03-27T12:33:59","slug":"using-the-uvm-10-release-with-questa","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/2011\/03\/08\/using-the-uvm-10-release-with-questa\/","title":{"rendered":"Using the UVM libraries with Questa"},"content":{"rendered":"<p>by Rich Edelman and Dave Rich<\/p>\n<h3>Introduction<\/h3>\n<p>The UVM is a derivative of OVM 2.1.1. It has similar use model, and is run in generally the same way.<\/p>\n<p>One significant change is that the UVM requires a DPI compiled library in order to enable regular expression matching, backdoor access and other functionality.<\/p>\n<p>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 &#8220;build&#8221; environment.<\/p>\n<p>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().<\/p>\n<p>vsim +<strong>UVM_USE_OVM_RUN_SEMANTIC<\/strong> +UVM_TESTNAME=hello &#8230;<\/p>\n<h3>Simulating with UVM Out-Of-The-Box with Questa<\/h3>\n<p>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. <strong>Questa 10.0c Windows users only, please read this<a title=\"UVM DPI files missing in the 10.0c install\" href=\"http:\/\/supportnet.mentor.com\/reference\/technotes\/public\/technote.cfm?id=MG554190\" target=\"_blank\" rel=\"noopener\"> important note <\/a>about the location of the DPI libraries.<\/strong><\/p>\n<p>You can easily use these steps:<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>\n<div dir=\"ltr\">\n<div>vlib work<\/div>\n<div>vlog hello.sv<\/div>\n<div>vsim hello &#8230;<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Notice that we don&#8217;t have to specify +incdir+$(UVM_HOME)\/src,\u00a0 $(UVM_HOME)\/src\/uvm_pkg.sv\u00a0 to <strong>vlog<\/strong>, or add a -sv_lib command to the <strong>vsim<\/strong> command to load the uvm_dpi shared object.<\/p>\n<h3>Controling UVM Versions<\/h3>\n<p>Each release of Questa comes with multiple versions of the UVM pre-compiled and ready to load. \u00a0By default, a fresh install of Questa will load the latest version of UVM that is available in the release. \u00a0If an older version of UVM is needed, this version can be selected in one of two ways.<\/p>\n<h4>Modify the modelsim.ini File<\/h4>\n<p>Inside the modelsim.ini file, it contains a line which defines a library mapping for Questa. \u00a0That line is the mtiUvm line. \u00a0It looks something like this:<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>\n<div dir=\"ltr\">\n<div>\n<pre>mtiUvm = $MODEL_TECH\/..\/uvm-1.1b<\/pre>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>This example is pointing to the UVM 1.1b release included inside the Questa release. \u00a0If we wanted to downgrade to UVM 1.1a, then we would simply modify the line to look like this:<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>\n<div dir=\"ltr\">\n<div>\n<pre>mtiUvm = $MODEL_TECH\/..\/uvm-1.1a<\/pre>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Command Line Switch<\/h4>\n<p>The Questa commands can also accept a switch on the command line to tell it which libraries to look for. \u00a0This switch overrides what is specified in the modelsim.ini file if there is a conflict. \u00a0The switch is &#8216;-L&#8217;. \u00a0If this switch is used, then all Questa commands with the exception of vlib will need to use the switch.<\/p>\n<div dir=\"ltr\">\n<div>\n<pre>vlib work\nvlog hello.sv -L $QUESTA_HOME\/uvm-1.1a\nvsim hello -L $QUESTA_HOME\/uvm-1.1a ...<\/pre>\n<\/div>\n<\/div>\n<p>If you are using some other platform, or you want to compile your own DPI library, please follow the directions below.<\/p>\n<p>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.<\/p>\n<p>For example, with 10.0a on linux, you can do<\/p>\n<p>vlib work<br \/>\nvlog hello.sv<br \/>\nvsim -c -sv_lib $UVM_HOME\/lib\/uvm_dpi &#8230;<\/p>\n<p>if you use your own UVM download, or you use Questa 6.6d or 10.0 you need to do the following:<\/p>\n<p>vlib work<br \/>\nvlog +incdir+$UVM_HOME\/src $UVM_HOME\/src\/uvm_pkg.sv<br \/>\nmkdir -p $UVM_HOME\/lib<br \/>\ng++ -m32 -fPIC -DQUESTA -g -W -shared<br \/>\n-I\/u\/release\/10.0a\/questasim\/\/include<br \/>\n$UVM_HOME\/src\/dpi\/uvm_dpi.cc<br \/>\n-o $UVM_HOME\/lib\/uvm_dpi.so<br \/>\nvlog +incdir+$UVM_HOME\/src hello.sv<br \/>\nvsim -c -sv_lib $UVM_HOME\/lib\/uvm_dpi &#8230;<\/p>\n<h3>Building the UVM DPI Shared Object Yourself<\/h3>\n<p>If you don&#8217;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.<\/p>\n<p>In $UVM_HOME\/examples, there is a Makefile.questa which can compile and link your DPI shared object.<\/p>\n<h4>For Linux (linux):<\/h4>\n<p>cd $UVM_HOME\/examples<br \/>\nsetenv MTI_HOME \/u\/release\/10.0a\/questasim\/<br \/>\nmake -f Makefile.questa dpi_lib<\/p>\n<p>&gt; mkdir -p ..\/lib<br \/>\n&gt; g++ -m32 -fPIC -DQUESTA -g -W -shared<br \/>\n&gt;\u00a0\u00a0 -I\/u\/release\/10.0a\/questasim\/\/include<br \/>\n&gt;\u00a0\u00a0 ..\/src\/dpi\/uvm_dpi.cc -o ..\/lib\/uvm_dpi.so<\/p>\n<h4>For Linux 64 (linux_x86_64)<\/h4>\n<p>cd $UVM_HOME\/examples<br \/>\nsetenv MTI_HOME \/u\/release\/10.0a\/questasim\/<br \/>\nmake LIBNAME=uvm_dpi64 BITS=64 -f Makefile.questa dpi_lib<\/p>\n<p>&gt; mkdir -p ..\/lib<br \/>\n&gt; g++ -m64 -fPIC -DQUESTA -g -W -shared<br \/>\n&gt;\u00a0\u00a0 -I\/u\/release\/10.0a\/questasim\/\/include<br \/>\n&gt;\u00a0\u00a0 ..\/src\/dpi\/uvm_dpi.cc -o ..\/lib\/uvm_dpi64.so<\/p>\n<h4>For Windows (win32):<\/h4>\n<p>cd $UVM_HOME\/examples<br \/>\nsetenv MTI_HOME \/u\/release\/10.0a\/questasim\/<br \/>\nmake -f Makefile.questa dpi_libWin<\/p>\n<p>&gt; mkdir -p ..\/lib<br \/>\n&gt; c:\/QuestaSim_10.0a\/gcc-4.2.1-mingw32vc9\/bin\/g++.exe<br \/>\n&gt;\u00a0\u00a0 -g -DQUESTA -W -shared<br \/>\n&gt;\u00a0\u00a0 -Bsymbolic -Ic:\/QuestaSim_10.0a\/include<br \/>\n&gt;\u00a0\u00a0 ..\/src\/dpi\/uvm_dpi.cc -o<br \/>\n&gt;\u00a0\u00a0 ..\/lib\/uvm_dpi.dll<br \/>\n&gt;\u00a0\u00a0 c:\/QuestaSim_10.0a\/win32\/mtipli.dll -lregex<\/p>\n<p>Note: For Windows, you must use the GCC provided on the Questa download page: (questasim-gcc-4.2.1-mingw32vc9.zip)<\/p>\n<p>Save to \/tmp\/questasim-gcc-4.2.1-mingw32vc9.zip<br \/>\ncd $MTI_HOME<br \/>\nunzip \/tmp\/questasim-gcc-4.2.1-mingw32vc9.zip<br \/>\n&lt;creates the GCC directories in the MTI_HOME&gt;<\/p>\n<h3>Using the UVM DPI Shared Object<\/h3>\n<p>You should add the -sv_lib switch to your vsim invocation. You do not need to specify the extension, vsim will look for &#8216;.so&#8217; on linux and linux_x86_64, and &#8216;.dll&#8217; on Windows.<\/p>\n<h4>linux:<\/h4>\n<p>vsim -sv_lib $UVM_HOME\/lib\/uvm_dpi -do &#8220;run -all; quit -f&#8221;<\/p>\n<h4>linux_x86_64:<\/h4>\n<p>vsim -sv_lib $UVM_HOME\/lib\/uvm_dpi64 -do &#8220;run -all; quit -f&#8221;<\/p>\n<h4>win32:<\/h4>\n<p>cp $UVM_HOME\/lib\/uvm_dpi.dll .<br \/>\nvsim -sv_lib uvm_dpi -do &#8220;run -all; quit -f&#8221;<\/p>\n<h3>Running the examples from the UVM 1.1 Release<\/h3>\n<p>If you want to run the examples from the UVM 1.0 Release you need to get the Open Source kit &#8211; it contains the examples.<\/p>\n<p>1. Download the UVM tar.gz and unpack it.<\/p>\n<ul>\n<li>Go to <a href=\"http:\/\/verificationacademy.com\/verification-methodology\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">http:\/\/verificationacademy.com\/verification-methodology<\/a>\u00a0&#8211; the download link is in the &#8220;UVM\/OVM Downloads &amp; Contributions&#8221; box.<\/li>\n<li>On the Accellera download page, click on &#8220;Download UVM&#8221;<\/li>\n<\/ul>\n<p>2. set your UVM_HOME to point to the UVM installation.<\/p>\n<ul>\n<li>setenv UVM_HOME \/tmp\/uvm-&lt;version#&gt;<\/li>\n<\/ul>\n<p>3. Go to the example that you want to run.<\/p>\n<ul>\n<li>cd $UVM_HOME\/examples\/simple\/hello_world<\/li>\n<\/ul>\n<p>4. Invoke make for your platform:<\/p>\n<ul>\n<li>For Windows (win32)<\/li>\n<\/ul>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>\n<div dir=\"ltr\">\n<div>\n<pre>cd $UVM_HOME\/examples\/simple\/hello_world\nmake DPILIB_TARGET=dpi_libWin -f Makefile.questa all\n# Note: for windows, you need a \"development area\", with make, gcc\/g++, etc. Using cygwin is the easiest solution<\/pre>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>For Linux (linux)<\/li>\n<\/ul>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>\n<div dir=\"ltr\">\n<div>\n<pre>cd $UVM_HOME\/examples\/simple\/hello_world\nmake -f Makefile.questa all<\/pre>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>For Linux 64 (linux_x86_64)<\/li>\n<\/ul>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td>\n<div dir=\"ltr\">\n<div>\n<pre>cd $UVM_HOME\/examples\/simple\/hello_world\nmake BITS=64 -f Makefile.questa all<\/pre>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h3>Migration from OVM to UVM<\/h3>\n<p>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 <a title=\"OVM 2.1.2 and UVM Register Kits\" href=\"http:\/\/verificationacademy.com\/news\/ovm-2.1.2-kit-and-uvm-register-kit\" target=\"_blank\" rel=\"noopener\">OVM 2.1.2<\/a>, before starting the migration process.<\/p>\n<p>These designs can be converted from OVM to UVM using the distributed conversion script:<\/p>\n<p>cd $MY_TEST_BENCH<br \/>\n$UVM_HOME\/bin\/ovm2uvm<\/p>\n<p>In certain cases hand coded changes might be required.<\/p>\n<p>Using the ovm2uvm script, you can run a &#8220;dry run&#8221; 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 &#8216;dry-run&#8217; 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.<\/p>\n<p>By default it does not change files.<\/p>\n<p>Here is a simple script which copies the ovm code, then applies<br \/>\nthe script.<\/p>\n<p># Copy my ovm-source to a new place.<br \/>\n(cd ovm-source; tar cf &#8211; .) | (mkdir -p uvm-source; cd uvm-source; tar xf -)<\/p>\n<p># Do a dry-run<br \/>\n$UVM_HOME\/bin\/ovm2uvm.pl -top_dir uvm-source<\/p>\n<p># Examine the *.patch file<br \/>\n&#8230;.<\/p>\n<p># If satisfied with the analysis, change in place<br \/>\n$UVM_HOME\/bin\/ovm2uvm.pl -top_dir uvm-source -write<\/p>\n<p>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.<\/p>\n<p>Once your OVM design is converted to UVM, you are almost ready to run.<\/p>\n<p>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:<\/p>\n<p>vsim +UVM_USE_OVM_RUN_SEMANTIC +UVM_TESTNAME=hello &#8230;<\/p>\n<p>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.<\/p>\n<p>More information about migrating from OVM to UVM can be found in the <a title=\"OVM to UVM Migration\" href=\"http:\/\/verificationacademy.com\/uvm-ovm\/OVM2UVM\/Overview\" target=\"_blank\" rel=\"noopener\">Verification Academy Cookbook<\/a> (registration required).<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>by Rich Edelman and Dave Rich Introduction The UVM is a derivative of OVM 2.1.1. It has similar use model,&#8230;<\/p>\n","protected":false},"author":71589,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[595,658,787,808,809],"industry":[],"product":[],"coauthors":[],"class_list":["post-2056","post","type-post","status-publish","format-standard","hentry","category-news","tag-methodology","tag-questa","tag-uvm","tag-uvm-10","tag-uvm-1-1"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/2056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/users\/71589"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/comments?post=2056"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/2056\/revisions"}],"predecessor-version":[{"id":19730,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/posts\/2056\/revisions\/19730"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/media?parent=2056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/categories?post=2056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/tags?post=2056"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/industry?post=2056"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/product?post=2056"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/verificationhorizons\/wp-json\/wp\/v2\/coauthors?post=2056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}