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 ...
随机推荐
- java IO其他流
1.内存操作流,ByteArrayInputStream和 ByteArrayOutputStream 案例:将小写转化为大写 /* * 内存操作流,将大写字母转化为小写字母(ByteArrayInp ...
- Java中多对多映射关系
多对对的映射,可以用学生和课程进行演示.一个学生可以选择多个课程,一个课程又对应了多个学生 定义学生类 class Stu{ private String name; private String n ...
- 年年岁岁花相似,岁岁年年人不同。——linux课程初探
写在前面 记得大约两年以前第一次学习linux,当初的目的还仅仅是学习操作系统,后来慢慢开始写linux内核代码,慢慢学会重构与代码的维护.在娄老师课上感觉这些工具是如此亲切和熟悉,没错这些曾经被我抛 ...
- 简单介绍Java的静态分派和动态分派
最近复习JVM的知识,对于静态分派和动态分派的理解有点混乱,于是自己尝试写写代码,在分析中巩固知识. 有如下一段代码,请问每一段分别输出什么? package com.khlin.my.test; c ...
- Android-隐式意图激活所有应用
显示意图 与 隐式意图 对比 显示意图不能激活多个组件,只能激活一个组件 隐式意图能激活多个组件 显示意图只能在自身应用激活,不能激活其他应用 隐士意图能在自身应用激活,也能激活其他应用 每个应用程序 ...
- 三张图片看懂ZKEACMS的设计思想
前言 如果你还不知道ZKEACMS,不妨先了解一下. ASP.NET MVC 开源建站系统 ZKEACMS 推荐,从此网站“拼”起来 官方地址:http://www.zkea.net/zkeacms ...
- .net core 使用redis 基于 StackExchange.Redis
一.添加引用包 StackExchange.Redis Microsoft.Extensions.Configuration 二.修改配置文件 appsettings.json { " ...
- const 与define 创建符号常量的 用法与区别
一.define 的用法: 在c语言中我经常会看到 :#define PI 12 ,这是创建了一个符号常量,这里面要注意没有那个等于号“=”: 二.const 的用法: 1.const 也可以来创 ...
- ArrayList用法详解
1.什么是ArrayList ArrayList就是传说中的动态数组,用MSDN中的说法,就是Array的复杂版本,它提供了如下一些好处: 动态的增加和减少元素 实现了ICollection和ILis ...
- 驼峰转大写(javaScript)
var a = function(s){return s.replace(/([A-Z])/g,"_$1").toUpperCase();} F12控制台可以直接用