FPGA設計—UVM驗證篇 Hello world


這里就不贅述UVM為何物了,做了半年多的FPGA設計驗證工作,按需求一直是用VHDL編寫測試程序,最近看了幾天UVM驗證方法學的書,感覺這是一種很好的驗證工具,現在開始UVM的學習,於是准備用ModelSim做一個Hello world,於是到網上隨便搜了段代碼,進行測試,見下方:

  1. `include "uvm_pkg.sv"  
  2. module hello_world_example;   
  3.    import uvm_pkg::*;   
  4.    `include "uvm_macros.svh"  
  5.    initial begin   
  6.      `uvm_info ("info1","Hello World!", UVM_LOW)   
  7.    end   
  8. 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的目錄)

  1. set UVM_HOME c:/modeltech_10.0c/verilog_src/uvm-1.1d  
  2. set MODEL_TECH c:/modeltech_10.0c/win32  

2、編譯UVM_DPI動態鏈接庫(用的是gcc-4.2.1-mingw32vc9編譯器)

  1. 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源文件

  1. 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)

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


最后運行得到下圖結果:

至此,Hello World終於出來了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM