Run,just run!    ——阿甘正传
 
一个简单的例子:
  1. module tb_top;
  2. dut u_dut ();
  3.  
  4. initial begin
  5. run_test();
  6. end
  7.  
  8. config_db #()::set();
  9.  
  10. endmoudle

UVM验证平台从仿真器执行时,开始执行initial中的run_test(); 这时首先去uvm_global.svh中查找run_test();

  1. // Title: Globals
  2.  
  3. //------------------------------------------------------------------------------
  4. //
  5. // Group: Simulation Control
  6. //
  7. //------------------------------------------------------------------------------
  8.  
  9. // Task: run_test
  10. //
  11. // Convenience function for uvm_top.run_test(). See <uvm_root> for more
  12. // information.
  13.  
  14. task run_test (string test_name="");
  15. uvm_root top;
  16. uvm_coreservice_t cs;
  17. cs = uvm_coreservice_t::get();
  18. top = cs.get_root();
  19. top.run_test(test_name);
  20. endtask
全局的run_test() 又调用uvm_root.svh的run_test()
  1. //----------------------------------------------------------------------------
  2. // Group: Simulation Control
  3. //----------------------------------------------------------------------------
  4.  
  5. // Task: run_test
  6. //
  7. // Phases all components through all registered phases. If the optional
  8. // test_name argument is provided, or if a command-line plusarg,
  9. // +UVM_TESTNAME=TEST_NAME, is found, then the specified component is created
  10. // just prior to phasing. The test may contain new verification components or
  11. // the entire testbench, in which case the test and testbench can be chosen from
  12. // the command line without forcing recompilation. If the global (package)
  13. // variable, finish_on_completion, is set, then $finish is called after
  14. // phasing completes.
  15.  
  16. extern virtual task run_test (string test_name="");
  17.  
  18. // run_test
  19. // --------
  20.  
  21. task uvm_root::run_test(string test_name="");
  22.  
  23. uvm_report_server l_rs;
  24. uvm_coreservice_t cs = uvm_coreservice_t::get();
  25. uvm_factory factory=cs.get_factory();
  26. bit testname_plusarg;
  27. int test_name_count;
  28. string test_names[$];
  29. string msg;
  30. uvm_component uvm_test_top;
  31.  
  32. process phase_runner_proc; // store thread forked below for final cleanup
  33.  
  34. testname_plusarg = ;
  35.  
  36. // Set up the process that decouples the thread that drops objections from
  37. // the process that processes drop/all_dropped objections. Thus, if the
  38. // original calling thread (the "dropper") gets killed, it does not affect
  39. // drain-time and propagation of the drop up the hierarchy.
  40. // Needs to be done in run_test since it needs to be in an
  41. // initial block to fork a process.
  42. uvm_objection::m_init_objections();
  43.  
  44. `ifndef UVM_NO_DPI
  45.  
  46. // Retrieve the test names provided on the command line. Command line
  47. // overrides the argument.
  48. test_name_count = clp.get_arg_values("+UVM_TESTNAME=", test_names);
  49.  
  50. // If at least one, use first in queue.
  51. if (test_name_count > ) begin
  52. test_name = test_names[];
  53. testname_plusarg = ;
  54. end
  55.  
  56. // If multiple, provided the warning giving the number, which one will be
  57. // used and the complete list.
  58. if (test_name_count > ) begin
  59. string test_list;
  60. string sep;
  61. for (int i = ; i < test_names.size(); i++) begin
  62. if (i != )
  63. sep = ", ";
  64. test_list = {test_list, sep, test_names[i]};
  65. end
  66. uvm_report_warning("MULTTST",
  67. $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);
  68. end
  69.  
  70. `else
  71.  
  72. // plusarg overrides argument
  73. if ($value$plusargs("UVM_TESTNAME=%s", test_name)) begin
  74. `uvm_info("NO_DPI_TSTNAME", "UVM_NO_DPI defined--getting UVM_TESTNAME directly, without DPI", UVM_NONE)
  75. testname_plusarg = ;
  76. end
  77.  
  78. `endif
  79.  
  80. // if test now defined, create it using common factory
  81. if (test_name != "") begin
  82. uvm_coreservice_t cs = uvm_coreservice_t::get();
  83. uvm_factory factory=cs.get_factory();
  84.  
  85. if(m_children.exists("uvm_test_top")) begin
  86. uvm_report_fatal("TTINST",
  87. "An uvm_test_top already exists via a previous call to run_test", UVM_NONE);
  88. #; // forces shutdown because $finish is forked
  89. end
  90. $cast(uvm_test_top, factory.create_component_by_name(test_name,
  91. "", "uvm_test_top", null));
  92.  
  93. if (uvm_test_top == null) begin
  94. msg = testname_plusarg ? {"command line +UVM_TESTNAME=",test_name} :
  95. {"call to run_test(",test_name,")"};
  96. uvm_report_fatal("INVTST",
  97. {"Requested test from ",msg, " not found." }, UVM_NONE);
  98. end
  99. end
  100.  
  101. if (m_children.num() == ) begin
  102. uvm_report_fatal("NOCOMP",
  103. {"No components instantiated. You must either instantiate",
  104. " at least one component before calling run_test or use",
  105. " run_test to do so. To run a test using run_test,",
  106. " use +UVM_TESTNAME or supply the test name in",
  107. " the argument to run_test(). Exiting simulation."}, UVM_NONE);
  108. return;
  109. end
  110.  
  111. begin
  112. if(test_name=="")
  113. uvm_report_info("RNTST", "Running test ...", UVM_LOW);
  114. else if (test_name == uvm_test_top.get_type_name())
  115. uvm_report_info("RNTST", {"Running test ",test_name,"..."}, UVM_LOW);
  116. else
  117. uvm_report_info("RNTST", {"Running test ",uvm_test_top.get_type_name()," (via factory override for test \"",test_name,"\")..."}, UVM_LOW);
  118. end
  119.  
  120. // phase runner, isolated from calling process
  121. fork begin
  122. // spawn the phase runner task
  123. phase_runner_proc = process::self();
  124. uvm_phase::m_run_phases();
  125. end
  126. join_none
  127. #; // let the phase runner start
  128.  
  129. wait (m_phase_all_done == );
  130.  
  131. // clean up after ourselves
  132. phase_runner_proc.kill();
  133.  
  134. l_rs = uvm_report_server::get_server();
  135. l_rs.report_summarize();
  136.  
  137. if (finish_on_completion)
  138. $finish;
  139.  
  140. 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. 使用svnsync实时备份SVN版本库

    前段时间把SVN版本库从win迁移到了Linux上,没隔几天那台win的磁盘就严重坏道了....这TMD什么运气! 花费了点时间研究了下svn自己的同步工具.写个日志记录下. 注意:svnsync要求 ...

  2. PHP/Javascript 数组定义 及JSON中的使用 ---OK

    PHP数组定义 一维数组: 1.$a=array(1,2,4,5,6); 2.$a= Array("cec"=>"cecValue","logo ...

  3. DTP模型之二:(XA协议之二)jotm分布式事务实现

    分布式事务是指操作多个数据库之间的事务,spring的org.springframework.transaction.jta.JtaTransactionManager,提供了分布式事务支持.如果使用 ...

  4. 最新sublimetext3080注册

    ----- BEGIN LICENSE -----K-20Single User LicenseEA7E-9401293A099EC1 C0B5C7C5 33EBF0CF BE82FE3BEAC216 ...

  5. HDOJ-1263

    水果 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...

  6. UVa 1641 ASCII Area (计算几何,水题)

    题意:给定一个矩阵,里面有一个多边形,求多边形的面积. 析:因为是在格子里,并且这个多边形是很规则的,所以所有格子不是全属于多边形就是全不属于,或者一半,并且我们可以根据"/"和“ ...

  7. 查看python 3中的内置函数列表,以及函数功能描述

    >>> dir(__builtins__)//查看内置函数(BIF)列表 ['ArithmeticError', 'AssertionError', 'AttributeError' ...

  8. E20190226-hm

    shallow  adj. 浅的,肤浅的; 表面的,皮毛的; (水,器物等) 浅的; (呼吸) 浅的;  n. 浅处; 浅滩;

  9. Unity3D调用摄像头,画面为翻转的问题

    http://blog.csdn.net/a117653909/article/details/16119907 Unity3D中新建一个工程,加一个Plane,新建一个C# 脚本,调用摄像头,不过显 ...

  10. LVS-DR VIP和RIP不同网段的配置方法

    http://blog.itpub.net/25723371/viewspace-1446935/