UVM打印hello word

DUT文件hello_world.sv打印

class hello_world extends uvm_test;//定义
  `uvm_component_utils(hello_world);//将类注册到工厂factory,才能用uvm框架

  function new (string name, uvm_component parent);//规定用new()函数分配空间
    super.new(name, parent);
  endfunction

  virtual task run_phase(uvm_phase phase);
   //phase.raise_objection(this); 
   `uvm_info("TEST", "****************************", UVM_MEDIUM);
   `uvm_info("TEST", "* my first uvm hello_world *", UVM_MEDIUM);
   `uvm_info("TEST", "****************************", UVM_MEDIUM);
   //phase.drop_objection(this); 
  endtask

endclass:hello_world

TB文件test.sv

program automatic test;
  import uvm_pkg::*;//进入所有uvm的feature,如factory,config机制
  `include "../hello_world.sv"

  initial begin
    $timeformat(-9, 1, "ns", 10);
    run_test();//启动uvm_root的架构,激活component的phase函数,从test开始执行。从+UVM_TESTNAME获取一个测试激励,并创建测试组件uvm_test_top
  end
endprogram

run_test()的整个启动及执行流程参考张强的《UVM 实战》白皮书第55页,大致为run_test----启动验证平台—根据UVM_TESTNAME产生实例依次执行build_phase,形成为完整的UVM树,再按照顺序执行UVM树,各结点的connect_phase、main_phase等,最后所有phase执行完,仿真结束。
UVM的Makefile文件

UVM_VERBOSITY =	UVM_MEDIUM
DEFINE=

##TB filelist
TB_FILES   = ../test.sv

#compile option
VCS =	vcs -full64\
       	+v2k\
       	-sverilog\
        -sim_res=1ps\
	-l compile.log\
	-debug_acc+all -debug_region+cell+encrypt\
       	-fsdb\
	+vcd+vcdpluson\
        -lca -cm line+fsm+cond+path+branch+tgl\
	+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
##simv option
SIMV = 	./simv +UVM_VERBOSITY=$(UVM_VERBOSITY) -l vcs.log\
	-sml +ntb_random_seed=$(SEED)\
	-lca -cm line+fsm+cond+path+branch+tgl

##for testbench compile command 
comp:
	$(VCS) $(TB_FILES)
##for simv command
run:
	$(SIMV) +UVM_TESTNAME=hello_world

##clean compile and simv generate files
clean:
	rm -rf AN.DB DVEfiles csrc *.simv *.simv.daidir simv* ucli.key 64
	rm -rf *.log* *.vpd *.fsdb *.vdb novas* *verdi*
	rm -rf vc_hdrs.h  via.rc
	

make comp编译之后会报错,原因是环境构建有问题
在这里插入图片描述
配置UVM_HOME环境变量

export UVM_HOME=/usr/synopsys/vcs/O-2018.09-SP2/etc/uvm-1.1
echo $UVM_HOME

enter键之后显示结果
/usr/synopsys/vcs/O-2018.09-SP2/etc/uvm-1.1
重新编译,make run之后结束,打开vcs.log文件结果如下
vcs.log文件

UVM_INFO @ 0.0ns: reporter [RNTST] Running test hello_world...
UVM_INFO ../hello_world.sv(10) @ 0.0ns: uvm_test_top [TEST] ****************************
UVM_INFO ../hello_world.sv(11) @ 0.0ns: uvm_test_top [TEST] * my first uvm hello_world *
UVM_INFO ../hello_world.sv(12) @ 0.0ns: uvm_test_top [TEST] ****************************
****************************
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值