无意中看到uvm_cmdline_processor,之前使用+UVM_TESTNAME也没深究,现在记录一下

内部调用脚本中的参数,通过使用uvm_cmdline_processor可以从脚本层级,从外部向仿真环境传递参数

get_arg_value( string match, ref string value )
Function:
        get_arg_value

This function finds the first argument which matches the match arg and
returns the suffix of the argument. This is similar to the $value$plusargs
system task, but does not take a formating string. The return value is
the number of command line arguments that match the match string, and
value is the value of the first match.

使用例子:

uvm_cmdline_processor clp = uvm_cmdline_processor::get_inst();

等价于:

uvm_cmdline_processor clp;

clp=new();

 1 program automatic test;
2 import uvm_pkg::*;
3
4 class hello_world extends uvm_test;
5
6 uvm_cmdline_processor clp;
7 int arg_value;
8 string arg;
9
10 `uvm_component_utils(hello_world);
11
12 function new (string name, uvm_component parent);
13 super.new(name, parent);
14 clp=new();
15 if(clp.get_arg_value("+arg_value=",this.arg)) begin
16 this.arg_value=this.arg.atoi();
17 `uvm_info("test_arg", $sformatf("input value = %d", arg_value), UVM_DEBUG);
18 end
19 else begin
20 `uvm_info("test_arg", "no input arg_value", UVM_DEBUG);
21 end
22
23 endfunction
24
25 endclass
26
27 initial begin
28 run_test();
29 end
30
31 endprogram

运行:
./simv +UVM_TESTNAME=hello_world +UVM_VERBOSITY=UVM_DEBUG +arg_value=100

结果:

UVM_INFO hello.sv(19) @ 0: uvm_test_top [test_arg] input value =         100

uvm_cmdline_processor的更多相关文章

  1. uvm_base——打好你的基础

    uvm_base 是个很有意思的文件,这是UVM很巧妙的设计,将所有在base中包含的文件都包含在uvm_base.svh, 这样很方便管理各个文件直接的关系,而且还可以看出一些我之前没看过的东西,比 ...

  2. UVM基础之---Command-line Processor

    提供一个厂商独立的通用接口命令行参数,支持分类:   1. 基本参数和值:get_args,get_args_matches   2. 工具信息:get_tool_name(),get_tool_ve ...

随机推荐

  1. 第08章 ElasticSearch Java API

    本章内容 使用客户端对象(client object)连接到本地或远程ElasticSearch集群. 逐条或批量索引文档. 更新文档内容. 使用各种ElasticSearch支持的查询方式. 处理E ...

  2. ORB_SLAM2应用实践_ROS小强机器人

    http://www.cnblogs.com/2008nmj/p/6166282.html

  3. add以及update

    const addressData = { name: this.post('name'), mobile: this.post('mobile'), province_id: this.post(' ...

  4. Transaction And Lock--已提交读快照

    --===================================================== --行版本控制已提交读ALTER DATABASE DB5 SET READ_COMMI ...

  5. selenium+jenkins+maven+testNG搭建持续集成环境

    为了简明起见,分几大部分,很基础的细节就不详述了 一·安装jenkins 二·创建一个maven项目的job 2.1   填上SVN的Repository URL 2.2  由于是在本地执行maven ...

  6. 关于Relay的麻烦之处

    问题背景 由于QueryRender是直接将数据塞进Render()里的 handleUpdate = (hasNextPage, xdata) =>{ console.log(3); cons ...

  7. jquery 全选反选 .prop('checked',!$(this).is(':checked'));

    //废话不说直接上代码 $("#").click(function(){ $("#content-div label input[type='checkbox']&quo ...

  8. 8 个用于生产环境的 SQL 查询优化调整

    在没有数据仓库或单独的分析数据库的组织中,报告的唯一来源和最新的数据可能是在现场生产数据库中. 在查询生产数据库时,优化是关键.一个低效的查询可能会对生产数据库产生大量的资源消耗,如果查询有错误会引发 ...

  9. 来到cnblong dayone

    以前懒得做笔记,csdn上有些小随笔,但是感觉csdn上的广告和积分下载越来越无法忍受了.现在转到cnblog.希望以后能够多写一些随笔吧.也算是一种坚持.听说90天可以养成一种习惯,那么就从现在开始 ...

  10. [ActionScript 3.0] 像素级碰撞检测

    package { import flash.display.BitmapData; import flash.display.BlendMode; import flash.display.Disp ...