uvm_cmdline_processor
无意中看到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的更多相关文章
- uvm_base——打好你的基础
uvm_base 是个很有意思的文件,这是UVM很巧妙的设计,将所有在base中包含的文件都包含在uvm_base.svh, 这样很方便管理各个文件直接的关系,而且还可以看出一些我之前没看过的东西,比 ...
- UVM基础之---Command-line Processor
提供一个厂商独立的通用接口命令行参数,支持分类: 1. 基本参数和值:get_args,get_args_matches 2. 工具信息:get_tool_name(),get_tool_ve ...
随机推荐
- 编写高质量代码改善C#程序的157个建议——建议100:静态方法和实例方法没有区别
建议100:静态方法和实例方法没有区别 静态方法在加载时机和内存使用上和实例方法完全一致.在这里,我们先引出一个概念“类型对象”.比如类型Person,我们都知道new Person() 会产生一个对 ...
- ibatis源码学习2_初始化和配置文件解析
问题在详细介绍ibatis初始化过程之前,让我们先来思考几个问题. 1. ibatis初始化的目标是什么?上文中提到过,ibatis初始化的核心目标是构造SqlMapClientImpl对象,主要是其 ...
- MFC中按钮控件的用法笔记(转)
VC学习笔记1:按钮的使能与禁止 用ClassWizard的Member Variables为按钮定义变量,如:m_Button1:则m_Button1.EnableWindow(true); 使按钮 ...
- window.open之postMessage传参数
这次要实现一个window.open打开子视窗的同时传参数到子视窗,关闭的时候返回参数. 当然简单的做法非常简单,直接在window.open的URL之后接参数即可,但是毕竟get method的参数 ...
- 学习笔记之Struts2—工作原理图
本文以Struts2的官方工作原理图作为主线讲解(参考部分书籍与视频) 1.初始概念 struts2是web.xml进行配置的一个过滤器,当web项目启动的时候,这个过滤器就会生效. 2.web.xm ...
- [Erlang11] 那些经历过的Erlang小坑11-20
11.每次重装系统时都会重新安装Erlang,Ubuntu安装sh秒杀一切. https://gist.github.com/zhongwencool/11174620 12. Erlang Shel ...
- ArrayList用法详解与源码分析
说明 此文章分两部分,1.ArrayList用法.2.源码分析.先用法后分析是为了以后忘了查阅起来方便-- ArrayList 基本用法 1.创建ArrayList对象 //创建默认容量的数组列表(默 ...
- MSSQL Server中partition by与group by的区别
在使用over等开窗函数时,over里头的分组及排序的执行晚于“where,group by,order by(但此排序顺序优先级是最高的)”的执行. ①group by 列名 合并(列值相同的并作一 ...
- 使用System.Data.SQLite及其EF模块操作SQLite数据库(文件)
SQLite for .NET (System.Data.SQLite) introduction An ADO.NET provider for SQLite including EF and Li ...
- Luckily general gradient for spherical harmonics is defined
http://web4.cs.ucl.ac.uk/staff/j.kautz/publications/gradientSH_RS04.pdf