UVM基础之---Command-line Processor

提供一个厂商独立的通用接口命令行参数,支持分类:

  1. 基本参数和值:get_args,get_args_matches

2. 工具信息:get_tool_name(),get_tool_version()

3. 支持从命令行设置各种UVM变量如冗长和配置设置积分和字符串类型:  +uvm_set_config_int, +uvm_set_config_string

类:uvm_cmdline_processor:

这个类在模拟过程中提供一个命令参数接口,这个类应该是当成一个单例类使用,但这不是必须的。一个全局变量 uvm_cmdline_proc在初始化的时候创建,用于访问命令行提供的信息。也支持从命令行配置各种各样的UVM变量。

下面简单的分析下这个类的实现机制:首先这个类继承自uvm_report_object,是一个单态类。

protected string m_argv[$];

protected string m_plus_argv[$];

protected string m_uvm_argv[$];

首先是基本的参数操作:

get_args(output string args[$]) 命令行的所有用于控制仿真状态的参数做成一个队列并返回。

get_plusargs(output string args[$]) :返回一个队列,包含所有用于启动仿真的附加参数。

get_uvm_args(output string args[$]) : 使用一个队列返回所有uvm参数。

get_arg_matches(string match, ref string args[$]) :这个函数加载所有匹配match string的参数到一个队列,并返回匹配的个数。如果表达式包含//扩展正则表达式,下面是一个例子:

//| string myargs[$]

//| initial begin

//|    void‘(uvm_cmdline_proc.get_arg_matches("+foo",myargs)); //matches +foo, +foobar

//|                                                            //doesn‘t match +barfoo

//|    void‘(uvm_cmdline_proc.get_arg_matches("/foo/",myargs)); //matches +foo, +foobar,

//|                                                             //foo.sv, barfoo, etc.

//|    void‘(uvm_cmdline_proc.get_arg_matches("/^foo.*\.sv",myargs)); //matches foo.sv

//|                                                                   //and foo123.sv,

//|                                                                   //not barfoo.sv.

function int get_arg_matches (string match, ref string args[$]);

`ifndef UVM_CMDLINE_NO_DPI

chandle exp_h = null;

int len = match.len();   //检查match的长度

args.delete();

if((match.len() > 2) && (match[0] == "/") && (match[match.len()-1] == "/")) begin//如果长度大于2 且包含//

match = match.substr(1,match.len()-2);//提取需要match的表达式

exp_h = uvm_dpi_regcomp(match);//使用dpi匹配满足表达式,

if(exp_h == null) begin

uvm_report_error("UVM_CMDLINE_PROC", {"Unable to compile the regular expression: ", match}, UVM_NONE);

return 0;

end

end

foreach (m_argv[i]) begin

if(exp_h != null) begin

if(!uvm_dpi_regexec(exp_h, m_argv[i]))

args.push_back(m_argv[i]);

end

else if((m_argv[i].len() >= len) && (m_argv[i].substr(0,len - 1) == match))

args.push_back(m_argv[i]);

end

if(exp_h != null)

uvm_dpi_regfree(exp_h);

`endif

return args.size();

endfunction

get_arg_value(string match,ref string value):从args里面找到第一个满足match的参数,并返回对应的值

get_arg_values(string match, ref srring values[$]) : 从args里面找到所有满足match的参数,并返回一个值得队列。返回参数是匹配的个数。

function new(string name = ""); 用于收集命令行传来的参数,并保存到对应的队列里面

string s;

string sub;

int doInit=1;

super.new(name);

do begin

s = uvm_dpi_get_next_arg(doInit);

doInit=0;

if(s!="") begin

m_argv.push_back(s);

if(s[0] == "+") begin

m_plus_argv.push_back(s);

end

if(s.len() >= 4 && (s[0]=="-" || s[0]=="+")) begin

sub = s.substr(1,3);

sub = sub.toupper();

if(sub == "UVM")

m_uvm_argv.push_back(s);

end

end

end while(s!="");

命令行调试:

1. +UVM_DUMP_CMDLINE_ARGS,允许用户dump所有的命令行参数发给report机制,在uvm_root里面实现

2. +UVM_TESTNAME= 指定需要从工厂里面创建的test,如果指定很多,则使用第一个。在uvm_root实现,通过run_test调用

3.+UVM_VERBOSITY= 指定message的冗余程度,在uvm_root实现,通过uvm_root:new()调用

4. +uvm_set_verbosity 允许用户在特定的phase对特定的message的冗余度进行调整

// ~+uvm_set_verbosity=<comp>,<id>,<verbosity>,<phase>~ and

// ~+uvm_set_verbosity=<comp>,<id>,<verbosity>,time,<time>~

+uvm_set_verbosity=uvm_test_top.env0.agent1.*,_ALL_,UVM_FULL,time,800

5. +uvm_set_action:指定对应的message的动作

+uvm_set_action=uvm_test_top.env0.*,_ALL_,UVM_ERROR,UVM_NO_ACTION

6. +uvm_set_severity : 指定对应message的严重等级:

7. +UVM_TIMEOUT=

8. +UVM_MAX_QUIT_COUNT 用于指定当出现几个ERROR就退出仿真

    9. +UVM_PHASE_TRACE

   10. +UVM_OBJECTION_TRACE

   11. +UVM_RESOURCE_DB_TRACE

   12. +UVM_CONFIG_DB_TRACE

13. 工厂替换参数:

// Variable: +uvm_set_inst_override

// Variable: +uvm_set_type_override

// ~+uvm_set_inst_override=<req_type>,<override_type>,<full_inst_path>~ and

// ~+uvm_set_type_override=<req_type>,<override_type>[,<replace>]~

//| <sim command> +uvm_set_type_override=eth_packet,short_eth_packet

14. 设置变量参数:

// Variable: +uvm_set_config_int

// Variable: +uvm_set_config_string

// ~+uvm_set_config_int=<comp>,<field>,<value>~ and

// ~+uvm_set_config_string=<comp>,<field>,<value>~

来自为知笔记(Wiz)

时间: 2024-08-02 10:59:22

UVM基础之---Command-line Processor的相关文章

UVM基础之---------Reporting Classes

Reporting 类提供了一组工具用于格式化报告输出 report机制大概包括四个主要的类uvm_report_object,uvm_report_handler, uvm_report_server,uvm_report_catcher,UVM reporting主要的接口是uvm_report_object(这是一个接口类),这是uvm_components的父类.uvm_report_object通过内部的function调用uvm_report_handler的function来执行大

Mac OS X Command Line

关于 man 命令 虽然有上千条命令,每条命令还有许多可选参数和具体的使用方式,但是你却不需要记住这些命令.你只需要记住一个:man 大多数命令都会包含一个使用指南,会告诉你任何你需要知道的关于这个命令的所有细节,在命令行中输入 man command-name 即可获取.例如,你想知道ls这个命令怎么使用,输入man ls即可进入使用指南页面. 使用指南往往很长,所以你可以使用▲(上箭头)或▼(下箭头)来上下移动,使用 来翻页,输入/和关键字来按照关键字搜索,按Q来退出使用指南页面. 那么——

UVM基础之---------uvm report 机制分析

uvm 中的信息报告机制相对来说比较简单,功能上来说主要分为两部分: 第一通过ID对component的信息报告冗余级别进行控制,针对每个冗余级别进行不同的行为控制.这部分工作主要由uvm_report_hander来实现: 主要涉及到的方法有get_report_verbosity_level(severity, id)/get_report_action(severity,id) == uvm_action'(UVM_NO_ACTION) 第二是对message进行格式化的输出,这部分工作主

UVM基础之-------uvm report机制的使用

后面的例子我会继续补充: 1. 因为uvm默认定义的message格式比较长,非常不利于debug过程中的分析使用,一般情况下,开始使用uvm,都要利用uvm_report_server重新定义message输出的格式.下面给出一个例子:用于将name和ID限定在同一个width. class my_report_server extends uvm_report_server; int name_width = 20; int id_width   = 20; function string

(二)NS3如何编译、运行脚本和 Command Line命令行参数设置

二.编译.运行脚本和Command Line命令行参数设置 7. 编译和运行脚本主要步骤 1) 将编写的脚本复制到ns-3.22/scratch目录下(可以在ubuntu窗口界面直接复制) 进入ns3目录: /ns-3.22 $ cp examples/tutorial/first.cc  scratch/myfirst.cc将脚本复制到scratch目录下 2) 构建(编译) $ ./waf 3) 运行 $ ./waf --run scratch/myfirst (可能会有运行权限问题,可在r

Can&#39;t use Subversion command line client: svn

使用Intellij IDEA的svn时提示出错:Can't use Subversion command line client: svn. 当我在使用svn,Checkout一个项目后,然后将其导入到Intellij idea中,出现这样的报错!经过google后,发现了问题,我的问题是:我安装的TortoiseSVN工具,本身是带有command-line功能的(我没有安装)如图: 所以报这个错误.如果安装的TortoiseSVN工具,本身是不带有command-line功能的,必须要安装

解决MySQL5.6 Warning: Using a password on the command line interface can be insecure

MySQL5.6在使用名文的密码登陆时,会出现:Warning: Using a password on the command line interface can be insecure 当然这样对于平常的登陆会无所谓,如果在脚本里使用使用的话,就会有问题: 解决这种问题的方法是需要在my.cnf中配置即可: 在my.cnf中加入如下配置 [mysqladump] user=my_name password=my_pass 重启MySQL 即可 以后再使用mysqldump命令就不需要加上任

How to build .apk file from command line(转)

How to build .apk file from command line Created on Wednesday, 29 June 2011 14:32 If you don’t want to install a number of programs for building your Android project, this article is for you. You will need only JDK, the Android SDK platform tools and

Command line option syntax error.type Command /? for help

电脑装思维导图的时候,报错显示"Command line option syntax error.Type Command /? for help."就查了一下,原来是系统没有C++2005,需要安装,就上网下载了一个vcredist_x86.exe,但是双击安装,仍然出现这个错误. 没办法,接着上网查吧,是什么原因呢?网上说是因为该文件安装不支持中文安装路径,然后我就把文件夹改成了英文名称的,但是双击还是出现这个错误.可能有的人用这种方法成功了吧~本着没有解决不了的问题的思想,接着奋

How To use RHEVM Command Line?

本文简单的描述下如何连接rhev shell以及简单的使用.关于更详细的用法请参考官方文档. 1.如何连接到rhevm? 要想连接到rhevm,必须拥有一个有效的证书.此证书一般安装完rhevm后会自动产生.下面是如何获取到证书. [[email protected] ~]# wget -O rhevm.cer http://rhevm.xzxj.edu.cn/ca.crt --2014-05-02 09:29:34-- http://rhevm.xzxj.edu.cn/ca.crt Resol