无意中看到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. C# 订单号的生成

    /**        * 根据当前系统时间加随机序列来生成订单号         * @return 订单号        */        public static string Generat ...

  2. 用word2013发布csdn博客

    目前大部分的博客作者在用Word写博客这件事情上都会遇到以下3个痛点: 1.所有博客平台关闭了文档发布接口,用户无法使用Word,Windows Live Writer等工具来发布博客.使用Word写 ...

  3. 基于JDBC的数据库连接池技术研究与应用

    引言 近年来,随着Internet/Intranet建网技术的飞速发展和在世界范围内的迅速普及,计算机 应用程序已从传统的桌面应用转到Web应用.基于B/S(Browser/Server)架构的3层开 ...

  4. PyCharm可用Active Code分享

    目前可用,不保证更新!请及时取用. 6YQUPH9R7H-eyJsaWNlbnNlSWQiOiI2WVFVUEg5UjdIIiwibGljZW5zZWVOYW1lIjoi5o6I5p2D5Luj55C ...

  5. CSS基础知识:常见选择器示例

    CSS(Cascading Style Sheet),中文译为层叠样式表,可以让设计者方便灵活地控制Web页面的外观表现.CSS是1996年由W3C审核通过并且推荐使用的.CSS的引入,就是为了使HT ...

  6. ios系统架构及常用框架

    1.iOS基于UNIX系统,因此从系统的稳定性上来说它要比其他操作系统的产品好很多 2.iOS的系统架构分为四层,由上到下一次为:可触摸层(Cocoa Touch layer).媒体层(Media l ...

  7. [Erlang16]为什么要用MFA代替fun()–>end?

    MFA:Module Function Arguments. 首先你要知道Module:Func(Args)和Func(Args)的区别在哪里? 如果对细节感兴趣,可以通过这里了解:http://ww ...

  8. RabbitMQ与.net core(四) 消息的优先级 与 死信队列

    1.消息的优先级 假如现在有个需求,我们需要让一些优先级最高的通知推送到客户端,我们可以使用redis的sortedset,也可以使用我们今天要说的rabbit的消息优先级属性 Producer代码 ...

  9. CentOS下Docker与.netcore(三)之 三剑客之一Docker-Compose

    CentOS下Docker与.netcore(一) 之 安装 CentOS下Docker与.netcore(二) 之 Dockerfile CentOS下Docker与.netcore(三)之 三剑客 ...

  10. UML uml基础知识

    uml基础知识 一.了解: uml是Unified Modeling Language的缩写,意思是统一建模语言或标准建模语言. UML规范用来描述建模的概念有,类(对象的).对象.关联.职责.行为. ...