无意中看到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. ThinkPhp 生成静态页面

    //开启静态缓存'HTML_CACHE_ON' => true, //开启缓存'HTML_CACHE_TIME' =>60, //开启缓存时间'HTML_FILE_SUFFIX' => ...

  2. windows10个性化设置

    任务栏DIY 日期显示样式 字体

  3. JS各种情况处理

    1.获取URL及其参数 实例:URL:file:///C:/Program%20Files/nodejs/test/jumbTarget.html?a=1&&b=2&& ...

  4. 编写高质量代码改善C#程序的157个建议——建议156:利用特性为应用程序提供多个版本

    建议156:利用特性为应用程序提供多个版本 基于如下理由,需要为应用程序提供多个版本: 应用程序有体验版和完整功能版. 应用程序在迭代过程中需要屏蔽一些不成熟的功能. 假设我们的应用程序共有两类功能: ...

  5. Java中一对多映射关系

    通过栗子,一个人可以有多辆汽车 定义人   这个类 人可以有很多辆汽车,类中车属性用数组 class Person{ private String name; private String phone ...

  6. Android-ListView-CursorAdapter

    在上篇博客,Android-ListView-SimpleCursorAdapter,中介绍了SimpleCurosrAdapter的使用操作(SimpleCursorAdapter是简单便捷Curs ...

  7. 群晖Synology

    简介 群晖是做的最好的一家NAS公司,声称是买软件卖硬件,软件有丰富的功能. 白群晖就是指从正规渠道买软件+硬件,价格昂贵,性价比低. 黑群晖是指自己搭建或购买单独的硬件(可以是电脑主机.可以是其他厂 ...

  8. Oracle 字符集常见字符集及解决方案

    Oracle 字符集常见字符集及解决方案 优先级别:alter session>环境变量>注册表>参数文件 一.查看字符集: 1.查询服务端字符集: select userenv(' ...

  9. 读取二元组列表,打印目录的层级结构-----C++算法实现

    要求是--某个文件中存储了一个最多3层的层级结构,其中每个元素都是一个自然数,它的存储方法是一个二元组的列表,每个二元组的形式为:(元素,父元素).现在希望能够通过读取该二元组列表,打印出目录的层级结 ...

  10. hdu 1542/1255 Atlantis/覆盖的面积

    1542 1255 两道扫描线+线段树的入门题. 基本没有什么区别,前者是模板,后者因为是求覆盖次数至少在两次以上的,这个同样是具有并集性质的,所以把cover的判断条件更改一下就可以了qwq. hd ...