最近开始自学数字IC验证的内容,验证平台的环境安装、配置并不是很难,但是对于小白来说,独自摸索还真不容易。接下来我将步骤单独列出,供后续学习者参考。
- 准备UVM标准库文件,网上版本较多,我们以uvm-1.1d版本为例进行说明。UVM标准库文件已上传到CSDN中[链接:https://download.csdn.net/download/programmer_guan/14991340]
- 把uvm-1.1d.tar.gz放在linux系统中进行解压。也可以在window系统下解压后上传到linux系统中。
- 打开.bashrc进行环境变量的配置
gvim .bashrc#打开.bashrc export UVM_HOME=/home/guanjw356/synopsys/uvm-1.1d#这里需要填写你解压文件的目录 source .bashrc#使配置生效
- 进入标准库文件自带的example目录,会发现Makefile.vcs文件,此文件对于所有验证平台通用,里面主要是对UVM库进行编译。但是要注意,并不能在此目录下此文件的编译。继续进入integrated/ubus/examples目录,此处才是UVM进行编译的目录,输入命令后运行若不报错则说明编译成功。
make -f makefile.vcs
- 在我的Ubuntu系统中发现报错,修改如下:将前一个ma kefile.vcs中的部分配置内容修改如下,运行后正常。
VCS =vcs -sverilog -timescale=1ns/1ns \ -full64 -cpp g++-4.8 -cc gcc-4.8 -LDFLAGS -Wl,--no-as-needed\ +acc +vpi \ +define+UVM_OBJECT_MUST_HAVE_CONSTRUCTOR \ +incdir+$(UVM_HOME)/src $(UVM_HOME)/src/uvm.sv \ $(UVM_HOME)/src/dpi/uvm_dpi.cc -CFLAGS -DVCS
- 自带案例测试成功后,进行首个最简单的UVM平台代码top_tb.sv的编写。
`include "uvm_pkg.sv" `include "uvm.sv" module hello_uvm; import uvm_pkg::*; `include "uvm_macros.svh" initial begin `uvm_info("infol","\n===\nUVM_Hello\n==\n",UVM_LOW) end endmodule:hello_uvm
- 进行makefile脚本的编写
vcs参数解析如下:.PHONY:com sim clean UVM_VERBOSITY = UVM_LOW OUTPUT = demo_top VCS =vcs -R -sverilog -timescale=1ns/1ns \ -full64 -cpp g++-4.8 -cc gcc-4.8 -LDFLAGS -Wl,--no-as-needed\ +acc +vpi \ +define+UVM_OBJECT_MUST_HAVE_CONSTRUCTOR \ +incdir+$(UVM_HOME)/src $(UVM_HOME)/src/uvm.sv \ $(UVM_HOME)/src/dpi/uvm_dpi.cc -CFLAGS -DVCS #SIM = ./${OUTPUT} -l run.log SIMV = ./simv +UVM_VERBOSITY=$(UVM_VERBOSITY) -l vcs.log URG = urg -format text -dir simv.vdb CHECK = \ @$(TEST) \( `grep -c 'UVM_ERROR : $(N_ERRS)' vcs.log` -eq 1 \) -a \ \( `grep -c 'UVM_FATAL : $(N_FATALS)' vcs.log` -eq 1 \) run_all: ${VCS} -f filelist.f sim: ${SIM} clean: rm -rf *~ core csrc simv* vc_hdrs.h ucli.key urg* *.log
其中filelist.f中内容如下:+incdir+directory 添加文件的搜索路径 -CC "opts" pass 'opts' to C compiler -CFLAGS "opts" pass 'opts' to C compiler // cc 和 cflags 作用相同 -DVCS 当我们使用外部的UVM源(库?)时,必须使用-DVCS选项 $(UVM_HOME)/src/dpi/uvm_dpi.cc 导入 DPI-C 的程序 (一般要和 -CC 和 -DVCS 一起用) +acc Enable pli applications to use acc routines (see manual) -sverilog Enables the use of SystemVerilog code +vcs+lic+wait 等待vcs的license -l file_name logfile文件名 -R 在编译之后立即执行产生的可执行文件
$UVM_HOME/src/uvm_pkg.sv top_tb.sv
- 最后运行make run_all,运行结果如下图所示。