Run,just run!    ——阿甘正传
 
一个简单的例子:
 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
全局的run_test() 又调用uvm_root.svh的run_test()
 //----------------------------------------------------------------------------
// 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() 验证平台的入口的更多相关文章

  1. UART UVM验证平台平台搭建总结

    tb_top是整个UVM验证平台的最顶层:tb_top中例化dut,提供时钟和复位信号,定义接口以及设置driver和monitor的virual interface,在intial中调用run_te ...

  2. 基于简单DUT的UVM验证平台的搭建(一)

    最近一个月在实习公司做回归测试,对公司的UVM平台用的比较熟练,就想着自己做一个DUT,然后搭建一个UVM验证平台. 首先,DUT是一个简单的32位的加法器,代码如下:alu.v module add ...

  3. ( 转)UVM验证方法学之一验证平台

    在现代IC设计流程中,当设计人员根据设计规格说明书完成RTL代码之后,验证人员开始验证这些代码(通常称其为DUT,Design Under Test).验证工作主要保证从设计规格说明书到RTL转变的正 ...

  4. UART IP和UVM的验证平台

    UART是工程师在开发调试时最常用的工具的,其通信协议简单.opencores 网站提供了兼容16550a的UART IP其基本特性如下: uart16550 is a 16550 compatibl ...

  5. SystemVerilog搭建验证平台使用DPI时遇到的问题及解决方案

    本文目的在于分享一下把DPI稿能用了的过程,主要说一下平台其他部分搭建好之后,在完成DPI相关工作阶段遇到的问题,以及解决的办法. 工作环境:win10 64bit, Questasim 10.1b ...

  6. Android实战简易教程-第三十九枪(第三方短信验证平台Mob和验证码自己主动填入功能结合实例)

    用户注冊或者找回password时通常会用到短信验证功能.这里我们使用第三方的短信平台进行验证实例. 我们用到第三方短信验证平台是Mob,地址为:http://mob.com/ 一.注冊用户.获取SD ...

  7. SystemVerilog搭建APB_I2C IP 层次化验证平台

    一.前言 近期疫情严重,身为社畜的我只能在家中继续钻研技术了.之前写过一篇关于搭建FIFO验证平台的博文,利用SV的OOP特性对FIFO进行初步验证,但有很多不足之处,比如结构不够规范.验证组件类不独 ...

  8. 学会使用Hdlbits网页版Verilog代码仿真验证平台

    给大家推荐一款网页版的 Verilog代码编辑仿真验证平台,这个平台是国外的一家开源FPGA学习网站,通过“https://hdlbits.01xz.net/wiki/Main_Page” 地址链接进 ...

  9. 116-基于5VLX110T FPGA FMC接口功能验证6U CPCI平台 光纤PCIe卡

    基于5VLX110T FPGA FMC接口功能验证6U CPCI平台 一.板卡概述 本板卡是Xilinx公司芯片V5系列芯片设计信号处理板卡.由一片Xilinx公司的XC5VLX110T-1FF113 ...

随机推荐

  1. OnCtlColor

    https://baike.baidu.com/item/OnCtlColor/4750440?fr=aladdin CTLCOLOR_BTN 按钮控件 · CTLCOLOR_DLG 对话框 · CT ...

  2. dubbo 学习笔记 -- provider端

    服务端的配置文件:    provider.xml <?xml version="1.0" encoding="UTF-8"?> <beans ...

  3. 二级ul li元素动态加载click事件

    一.代码 html代码: <ul class="id1" id="id1" style="width:84%; height:75%;overf ...

  4. 浅析Apache/Tomcat/JBOSS/Nginx之区别

    浅析Apache/Tomcat/JBOSS/Nginx服务器之区别 一.Apache和Tomcat的区别 Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上, ...

  5. Flutter实战视频-移动电商-47.详细页_Flutter_html插件的使用

    47.详细页_Flutter_html插件的使用 详情里面是hemlt和图片组成的,但是flutter是不支持html的所以需要其他插件 flutter webview plugin:这个不太好用 f ...

  6. Flex Builder 装SVN

    由于Flex Builder没有内置SVN支持,很是不便.为了方便,给Flex Builder也装了SVN插件.由于FB基于Eclipse,安装方法都是一样的. 选择 Help -> Soft ...

  7. HTML学习笔记(五)框架

    框架 通过使用框架,可以在同一个浏览器窗口中显示多个页面. eg: <frameset rows="50%,50%"> <frame src="/exa ...

  8. vue中循环时动态绑定值

    在vue项目中,有很多需要动态循环绑定的场景,在未知绑定数量的情况下只能动态生成绑定值 1.首先在data中定义一个对象,我在项目中时循环绑定下拉框,所以定义了一个selectVal = {} 2.在 ...

  9. Git之常用的命令操作

    set LESSCHARSET=utf-8 git设置文件名大小写敏感 git branch -rgit checkout 'TestMaster'git checkout -b 'TestMaste ...

  10. Codevs 1043 方格取数

    1043 方格取数 2000年NOIP全国联赛提高组  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解  查看运行结果     题目描述 Descri ...