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. 【旧文章搬运】PsVoid中IrpCreateFile函数在Win7下蓝屏BUG分析及解决

    原文发表于百度空间,2010-04-05========================================================================== 这也许是我 ...

  2. PLSQL ORA-12154 TNS无法解析指定的连接标识符

    若你的机子上Windows 64位操作系统, 将PL Sql 的默认安装目录  Program Files (x86) 文件夹改为Program Files 或者别的便可以了

  3. 怎样通过计算机ip地址访问sql server 2008数据库

      在设置外网访问SQL2008数据库之前,首先必须保证局域网内访问SQL2008没有问题 .那么,我们先来看看局域网内访问SQL2008数据库需要哪些步骤和设置,才能做到在局域网内任何一台机器上输入 ...

  4. shell编程流程控制

    前言: 在linux shell中,通常我们将一些命令写在一个文件中就算是一个shell脚本了,但是如果需要执行更为复杂的逻辑判断,我们就需要使用流程控制语句来支持了. 所谓流程控制既是通过使用流程控 ...

  5. SpringCloud之旅第一篇-微服务概念

    一.单体架构的问题 微服务为什么会出现?在学习Springboot的时候知道Springboot极大的简化了我们的开发,我们可以快速的进行业务开发,Springboot单体应用在项目的开发初期能够满足 ...

  6. POJ1011【判重剪枝】

    题意: 给你一堆棒子,这些棒子是你从一堆一样的棒子折断而来的, 现在你忘记了是从那一堆一样的棒子的长度,让你写一个程序,求最短的长度. 思路: 首先这个棒长肯定是和的约数,且大于最大值. 然后是sor ...

  7. Lightoj1014【基础题】

    题意: 有C个人,安排了P个吃的,每个人会吃Q个吃的,最后留下L个吃的:求所有可能的Q,从小到大输出,要保证Q>L; 思路: 其实就是求出P-L的所有数的约数,然后这个约数>L的话就满足: ...

  8. WINDOWS编程基础-最简单的windows程序

    流程 1 建立并注册windows类 2 使用windows类创建窗口 3 实现事件处理,主循环 PeekMessage与GetMessage的对比 相同点: PeekMessage函数与GetMes ...

  9. bzoj 1901: Zju2112 Dynamic Rankings【整体二分+树状数组||主席树+树状数组】

    整体二分: 对于每一个修改操作,标记为1,并且加一个标记为-1的这个位置原来值,并且对于a数列每个点都当成修改操作 然后整体二分,扫当前操作区间lr,把在值域区间标记为1和-1的操作都在树状数组对应位 ...

  10. C 语言实例 - 字符串排序

    C 语言实例 - 字符串排序 C 语言实例 C 语言实例 按字典顺序排序. 实例 #include<stdio.h> #include <string.h> int main( ...