run_test() 验证平台的入口
- module tb_top;
- dut u_dut ();
- initial begin
- run_test();
- end
- config_db #()::set();
- endmoudle
UVM验证平台从仿真器执行时,开始执行initial中的run_test(); 这时首先去uvm_global.svh中查找run_test();
- // Title: Globals
- //------------------------------------------------------------------------------
- //
- // Group: Simulation Control
- //
- //------------------------------------------------------------------------------
- // Task: run_test
- //
- // Convenience function for uvm_top.run_test(). See <uvm_root> for more
- // information.
- task run_test (string test_name="");
- uvm_root top;
- uvm_coreservice_t cs;
- cs = uvm_coreservice_t::get();
- top = cs.get_root();
- top.run_test(test_name);
- endtask
- //----------------------------------------------------------------------------
- // Group: Simulation Control
- //----------------------------------------------------------------------------
- // Task: run_test
- //
- // Phases all components through all registered phases. If the optional
- // test_name argument is provided, or if a command-line plusarg,
- // +UVM_TESTNAME=TEST_NAME, is found, then the specified component is created
- // just prior to phasing. The test may contain new verification components or
- // the entire testbench, in which case the test and testbench can be chosen from
- // the command line without forcing recompilation. If the global (package)
- // variable, finish_on_completion, is set, then $finish is called after
- // phasing completes.
- extern virtual task run_test (string test_name="");
- // run_test
- // --------
- task uvm_root::run_test(string test_name="");
- uvm_report_server l_rs;
- uvm_coreservice_t cs = uvm_coreservice_t::get();
- uvm_factory factory=cs.get_factory();
- bit testname_plusarg;
- int test_name_count;
- string test_names[$];
- string msg;
- uvm_component uvm_test_top;
- process phase_runner_proc; // store thread forked below for final cleanup
- testname_plusarg = ;
- // Set up the process that decouples the thread that drops objections from
- // the process that processes drop/all_dropped objections. Thus, if the
- // original calling thread (the "dropper") gets killed, it does not affect
- // drain-time and propagation of the drop up the hierarchy.
- // Needs to be done in run_test since it needs to be in an
- // initial block to fork a process.
- uvm_objection::m_init_objections();
- `ifndef UVM_NO_DPI
- // Retrieve the test names provided on the command line. Command line
- // overrides the argument.
- test_name_count = clp.get_arg_values("+UVM_TESTNAME=", test_names);
- // If at least one, use first in queue.
- if (test_name_count > ) begin
- test_name = test_names[];
- testname_plusarg = ;
- end
- // If multiple, provided the warning giving the number, which one will be
- // used and the complete list.
- if (test_name_count > ) begin
- string test_list;
- string sep;
- for (int i = ; i < test_names.size(); i++) begin
- if (i != )
- sep = ", ";
- test_list = {test_list, sep, test_names[i]};
- end
- uvm_report_warning("MULTTST",
- $sformatf("Multiple (%0d) +UVM_TESTNAME arguments provided on the command line. '%s' will be used. Provided list: %s.", test_name_count, test_name, test_list), UVM_NONE);
- end
- `else
- // plusarg overrides argument
- if ($value$plusargs("UVM_TESTNAME=%s", test_name)) begin
- `uvm_info("NO_DPI_TSTNAME", "UVM_NO_DPI defined--getting UVM_TESTNAME directly, without DPI", UVM_NONE)
- testname_plusarg = ;
- end
- `endif
- // if test now defined, create it using common factory
- if (test_name != "") begin
- uvm_coreservice_t cs = uvm_coreservice_t::get();
- uvm_factory factory=cs.get_factory();
- if(m_children.exists("uvm_test_top")) begin
- uvm_report_fatal("TTINST",
- "An uvm_test_top already exists via a previous call to run_test", UVM_NONE);
- #; // forces shutdown because $finish is forked
- end
- $cast(uvm_test_top, factory.create_component_by_name(test_name,
- "", "uvm_test_top", null));
- if (uvm_test_top == null) begin
- msg = testname_plusarg ? {"command line +UVM_TESTNAME=",test_name} :
- {"call to run_test(",test_name,")"};
- uvm_report_fatal("INVTST",
- {"Requested test from ",msg, " not found." }, UVM_NONE);
- end
- end
- if (m_children.num() == ) begin
- uvm_report_fatal("NOCOMP",
- {"No components instantiated. You must either instantiate",
- " at least one component before calling run_test or use",
- " run_test to do so. To run a test using run_test,",
- " use +UVM_TESTNAME or supply the test name in",
- " the argument to run_test(). Exiting simulation."}, UVM_NONE);
- return;
- end
- begin
- if(test_name=="")
- uvm_report_info("RNTST", "Running test ...", UVM_LOW);
- else if (test_name == uvm_test_top.get_type_name())
- uvm_report_info("RNTST", {"Running test ",test_name,"..."}, UVM_LOW);
- else
- uvm_report_info("RNTST", {"Running test ",uvm_test_top.get_type_name()," (via factory override for test \"",test_name,"\")..."}, UVM_LOW);
- end
- // phase runner, isolated from calling process
- fork begin
- // spawn the phase runner task
- phase_runner_proc = process::self();
- uvm_phase::m_run_phases();
- end
- join_none
- #; // let the phase runner start
- wait (m_phase_all_done == );
- // clean up after ourselves
- phase_runner_proc.kill();
- l_rs = uvm_report_server::get_server();
- l_rs.report_summarize();
- if (finish_on_completion)
- $finish;
- endtask
在该run_test 实现中根据有没有DPI调用phase.这样在运行仿真命令时通过simcmd +UVM_TESTNAME=my_case 来执行该case,这样整个系统就被调用了起来。这样做有什么好处?它根据传入的字符串或者从运行参数+UVM_TESTNAME="test_name"读取字符串来生成uvm_test对象, 并运行这个对象的全部phase函数来执行一次测试用例的运行,很方便实现regression。
run_test() 验证平台的入口的更多相关文章
- UART UVM验证平台平台搭建总结
tb_top是整个UVM验证平台的最顶层:tb_top中例化dut,提供时钟和复位信号,定义接口以及设置driver和monitor的virual interface,在intial中调用run_te ...
- 基于简单DUT的UVM验证平台的搭建(一)
最近一个月在实习公司做回归测试,对公司的UVM平台用的比较熟练,就想着自己做一个DUT,然后搭建一个UVM验证平台. 首先,DUT是一个简单的32位的加法器,代码如下:alu.v module add ...
- ( 转)UVM验证方法学之一验证平台
在现代IC设计流程中,当设计人员根据设计规格说明书完成RTL代码之后,验证人员开始验证这些代码(通常称其为DUT,Design Under Test).验证工作主要保证从设计规格说明书到RTL转变的正 ...
- UART IP和UVM的验证平台
UART是工程师在开发调试时最常用的工具的,其通信协议简单.opencores 网站提供了兼容16550a的UART IP其基本特性如下: uart16550 is a 16550 compatibl ...
- SystemVerilog搭建验证平台使用DPI时遇到的问题及解决方案
本文目的在于分享一下把DPI稿能用了的过程,主要说一下平台其他部分搭建好之后,在完成DPI相关工作阶段遇到的问题,以及解决的办法. 工作环境:win10 64bit, Questasim 10.1b ...
- Android实战简易教程-第三十九枪(第三方短信验证平台Mob和验证码自己主动填入功能结合实例)
用户注冊或者找回password时通常会用到短信验证功能.这里我们使用第三方的短信平台进行验证实例. 我们用到第三方短信验证平台是Mob,地址为:http://mob.com/ 一.注冊用户.获取SD ...
- SystemVerilog搭建APB_I2C IP 层次化验证平台
一.前言 近期疫情严重,身为社畜的我只能在家中继续钻研技术了.之前写过一篇关于搭建FIFO验证平台的博文,利用SV的OOP特性对FIFO进行初步验证,但有很多不足之处,比如结构不够规范.验证组件类不独 ...
- 学会使用Hdlbits网页版Verilog代码仿真验证平台
给大家推荐一款网页版的 Verilog代码编辑仿真验证平台,这个平台是国外的一家开源FPGA学习网站,通过“https://hdlbits.01xz.net/wiki/Main_Page” 地址链接进 ...
- 116-基于5VLX110T FPGA FMC接口功能验证6U CPCI平台 光纤PCIe卡
基于5VLX110T FPGA FMC接口功能验证6U CPCI平台 一.板卡概述 本板卡是Xilinx公司芯片V5系列芯片设计信号处理板卡.由一片Xilinx公司的XC5VLX110T-1FF113 ...
随机推荐
- 使用svnsync实时备份SVN版本库
前段时间把SVN版本库从win迁移到了Linux上,没隔几天那台win的磁盘就严重坏道了....这TMD什么运气! 花费了点时间研究了下svn自己的同步工具.写个日志记录下. 注意:svnsync要求 ...
- PHP/Javascript 数组定义 及JSON中的使用 ---OK
PHP数组定义 一维数组: 1.$a=array(1,2,4,5,6); 2.$a= Array("cec"=>"cecValue","logo ...
- DTP模型之二:(XA协议之二)jotm分布式事务实现
分布式事务是指操作多个数据库之间的事务,spring的org.springframework.transaction.jta.JtaTransactionManager,提供了分布式事务支持.如果使用 ...
- 最新sublimetext3080注册
----- BEGIN LICENSE -----K-20Single User LicenseEA7E-9401293A099EC1 C0B5C7C5 33EBF0CF BE82FE3BEAC216 ...
- HDOJ-1263
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- UVa 1641 ASCII Area (计算几何,水题)
题意:给定一个矩阵,里面有一个多边形,求多边形的面积. 析:因为是在格子里,并且这个多边形是很规则的,所以所有格子不是全属于多边形就是全不属于,或者一半,并且我们可以根据"/"和“ ...
- 查看python 3中的内置函数列表,以及函数功能描述
>>> dir(__builtins__)//查看内置函数(BIF)列表 ['ArithmeticError', 'AssertionError', 'AttributeError' ...
- E20190226-hm
shallow adj. 浅的,肤浅的; 表面的,皮毛的; (水,器物等) 浅的; (呼吸) 浅的; n. 浅处; 浅滩;
- Unity3D调用摄像头,画面为翻转的问题
http://blog.csdn.net/a117653909/article/details/16119907 Unity3D中新建一个工程,加一个Plane,新建一个C# 脚本,调用摄像头,不过显 ...
- LVS-DR VIP和RIP不同网段的配置方法
http://blog.itpub.net/25723371/viewspace-1446935/