在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 8052|回复: 8

[转贴] 使用QuestaSIM进行UVM仿真环境搭建 (Using the UVM libraries with Questa)

[复制链接]
发表于 2014-6-3 15:57:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
注意: 直到目前的questaSim 10.1版本(2012-01-31)为止,仍旧不能支持win64环境下的UVM编译,所以如果您要确定使用UVM环境,则不要使用X64版本的Windows操作系统。
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.0 release 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 thisimportant noteabout the location of the DPI libraries.

You can easily use these steps:

vlib work
vlog hello.sv
vsim -c hello …

If you are using some other platform, or you want to compile your own DPI library, please follow the directions below. The text above describes using Questa 10.0b in a way that reduces the need for +incdir+ and compiling the UVM itself. This capability is built-in to 10.0b and following releases.

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.1 Release you need to get the Open Source kit – it contains the examples.

  • Download the uvm-1.1.tar.gz and unpack it.
      ); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 3px 6px; background-repeat: no-repeat no-repeat; ">Go to the Accellerawebsite and download the “UVM 1.1 class library code and user guide”
  • set your UVM_HOME to point to the UVM 1.1 installation.
      ); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 3px 6px; background-repeat: no-repeat no-repeat; ">setenv UVM_HOME /tmp/uvm-1.1
  • Go to the example that you want to run.
      ); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 3px 6px; background-repeat: no-repeat no-repeat; ">cd $UVM_HOME/examples/simple/hello_world
  • Invoke make for your platform:
      ); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 3px 6px; background-repeat: no-repeat no-repeat; ">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); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 3px 6px; background-repeat: no-repeat no-repeat; ">For Linux (linux)
      cd $UVM_HOME/examples/simple/hello_world
      make -f Makefile.questa all); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 3px 6px; background-repeat: no-repeat no-repeat; ">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).



from : http://blogs.mentor.com/verificationhorizons/blog/2011/03/08/using-the-uvm-10-release-with-questa/

发表于 2014-12-29 23:54:20 | 显示全部楼层
good job
发表于 2014-12-31 12:24:04 | 显示全部楼层
thx for sharing
发表于 2015-1-5 15:07:32 | 显示全部楼层
回复 1# kwanmen
开玩笑了吧? 我一直在用window 7 64版本的......
发表于 2016-1-9 23:48:44 | 显示全部楼层
感谢您的上传
发表于 2016-1-21 00:02:46 | 显示全部楼层
感谢分享
发表于 2016-1-31 13:30:51 | 显示全部楼层
thank you
发表于 2017-1-19 13:44:40 | 显示全部楼层
谢谢分享,正需要
发表于 2018-4-12 23:09:06 | 显示全部楼层
谢谢分享!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

×

小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-15 09:24 , Processed in 0.024547 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表