FPGA设计—UVM验证篇(1) Hello world

首先要感谢我最最亲爱的小虫虫,今天起要开始做些有意义的事,记录和分享一些东西。——题外话

这里就不赘述UVM为何物了,做了半年多的FPGA设计验证工作,按需求一直是用VHDL编写测试程序,最近看了几天UVM验证方法学的书,感觉这是一种很好的验证工具,现在开始UVM的学习,于是准备用ModelSim做一个Hello world,于是到网上随便搜了段代码,进行测试,见下方:

`include "uvm_pkg.sv"
module hello_world_example; 
   import uvm_pkg::*; 
   `include "uvm_macros.svh"
   initial begin 
     `uvm_info ("info1","Hello World!", UVM_LOW) 
   end 
endmodule: hello_world_example

可能是因为使用的测试工具比较新(ModelSim SE 10.0c)吧,直接可以编译,然后进行仿真/运行,结果见下:

# Refreshing C:\t_uvm\work.hello_world_example
# Refreshing C:\t_uvm\work.uvm_pkg
# Loading sv_std.std
# Loading work.uvm_pkg
# Loading work.hello_world_example
# ** 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_example File: top.sv
……
# ** Warning: (vsim-3770) Failed to find user specified function 'uvm_glob_to_re'. 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_example File: top.sv
# ** Fatal: (vsim-160) c:/modeltech_10.0c/verilog_src/uvm-1.1d/src/dpi/uvm_svcmd_dpi.svh(27): Null foreign function pointer encountered when calling 'uvm_dpi_get_next_arg_c'
#    Time: 0 ns  Iteration: 0  Process: /uvm_pkg/#INITIAL#619 File: c:/modeltech_10.0c/verilog_src/uvm-1.1d/src/dpi/uvm_svcmd_dpi.svh
#  Fatal error in Module uvm_pkg at D:/modeltech_10.0c/verilog_src/uvm-1.1d/src/dpi/uvm_svcmd_dpi.svh line 27


于是在个里上网查了些资料,一直调试到现在才可以使用,如下:

1、设置环境变量(下载好的UVM解压到下面的UVM_HOME的目录)

set UVM_HOME c:/modeltech_10.0c/verilog_src/uvm-1.1d
set MODEL_TECH c:/modeltech_10.0c/win32
2、编译UVM_DPI动态链接库(用的是gcc-4.2.1-mingw32vc9编译器)
c:/modeltech_10.0c/gcc-4.2.1-mingw32vc9/bin/g++.exe -g -DQUESTA -W -shared -Bsymbolic -I $MODEL_TECH/../include  $UVM_HOME/src/dpi/uvm_dpi.cc -o  $UVM_HOME/lib/uvm_dpi.dll $MODEL_TECH/mtipli.dll -lregex

3、编译Hello_world_example源文件

vlog +incdir+$UVM_HOME/src -L mtiAvm -L mtiOvm -L mtiUvm -L mtiUPF C:/t_uvm/top.sv

4、仿真Hello_world_example(需要调用刚刚编译的uvm_dpi.dll)

vsim -c -sv_lib $UVM_HOME/lib/uvm_dpi work.hello_world_example

最后运行得到下图结果:

FPGA设计—UVM验证篇(1) Hello world_第1张图片

至此,Hello World终于出来了。

 > > >UVM参考资料< < < 

你可能感兴趣的:(FPGA开发,UVM)