uvm_info信息定制
2014-11-19 21:44
267 查看
1,uvm自带的打印信息国语繁重,不利于debug
`uvm_info("TESTCASE",$sformatf("my_case0 new"),UVM_DEBUG);
UVM_INFO /home/zl/Desktop/uvm_study/template/sim/tests/my_case0.sv(29) @ 0: uvm_test_top [TEST_CASE] my_case0 new
修改目标:
UVM_INFO @ 102.2ns uvm_test_top [TEST_CASE] my_case0 new
取消打印文件路径,修改打印时间格式
源代码分析:
uvm_message_defines.svh
// MACRO: `uvm_info
//
//| `uvm_info(ID,MSG,VERBOSITY)
//
// Calls uvm_report_info if ~VERBOSITY~ is lower than the configured verbosity of
// the associated reporter. ~ID~ is given as the message tag and ~MSG~ is given as
// the message text. The file and line are also sent to the uvm_report_info call.
//
`define uvm_info(ID,MSG,VERBOSITY) \
begin \
if (uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \
uvm_report_info (ID, MSG, VERBOSITY, `uvm_file, `uvm_line); \
end
uvm_report_catcher.svh
protected function void uvm_report_info(string id, string message, int verbosity, string fname = "", int line = 0 );
string m;
uvm_action a;
UVM_FILE f;
uvm_report_handler rh;
rh = this.m_client.get_report_handler();
a = rh.get_action(UVM_INFO,id);
f = rh.get_file_handle(UVM_INFO,id);
m = this.m_server.compose_message(UVM_INFO,this.m_name, id, message, fname, line);
this.m_server.process_report(UVM_INFO, this.m_name, id, message, a, f, fname, line,
m, verbosity, this.m_client);
endfunction // uvm_report_info
uvm_report_server.svh
virtual function void process_report(
uvm_severity severity,
string name,
string id,
string message,
uvm_action action,
UVM_FILE file,
string filename,
int line,
string composed_message,
int verbosity_level,
uvm_report_object client
);
uvm_cmdline_processor clp;
string stack_args[$];
string split_vals[$];
static int debug, info, warn, error, fatal;
static bit first = 1;
if(first) begin
clp = uvm_cmdline_processor::get_inst();
void'(clp.get_arg_matches("+UVM_STACKTRACE", stack_args));
//Take into account if option is specified multiple times.
foreach(stack_args[i]) begin
string temp;
temp = stack_args[i].substr(16, stack_args[i].len()-1);
// In case no additinal argument is specified
if(temp == "") begin
error = 1; fatal = 1;
end
uvm_split_string(temp, ",", split_vals);
//For all the comma sepearted options
foreach(split_vals[i]) begin
case(split_vals[i])
"default" : begin error = 1; fatal = 1; end
"debug" : begin debug = 1; end
"info" : begin info = 1; end
"warn" : begin warn = 1; end
"error" : begin error = 1; end
"fatal" : begin fatal = 1; end
"all" : begin debug = 1; info = 1; warn = 1; error = 1; fatal = 1; end
default : $display("UVM_WARNING::INVLCMDARGS::Invalid argument specified for command line, +UVM_STACKTRACE=%0s", split_vals[i]);
endcase
end
end
first = 0;
end
// update counts
incr_severity_count(severity);
incr_id_count(id);
if(action & UVM_DISPLAY) begin
case (severity)
UVM_DEBUG : if(debug) $stack;
UVM_INFO : if(info) $stack;
UVM_WARNING: if(warn) $stack;
UVM_ERROR : if(error) $stack;
UVM_FATAL : if(fatal) $stack;
endcase
$display("%s",composed_message);
end
// if log is set we need to send to the file but not resend to the
// display. So, we need to mask off stdout for an mcd or we need
// to ignore the stdout file handle for a file handle.
if(action & UVM_LOG)
if( (file == 0) || (file != 32'h8000_0001) ) //ignore stdout handle
begin
UVM_FILE tmp_file = file;
if( (file&32'h8000_0000) == 0) //is an mcd so mask off stdout
begin
tmp_file = file & 32'hffff_fffe;
end
f_display(tmp_file,composed_message);
end
if(action & UVM_EXIT) client.die();
if(action & UVM_COUNT) begin
if(get_max_quit_count() != 0) begin
incr_quit_count();
if(is_quit_count_reached()) begin
client.die();
end
end
end
if (action & UVM_STOP) $stop;
endfunction
`uvm_info("TESTCASE",$sformatf("my_case0 new"),UVM_DEBUG);
UVM_INFO /home/zl/Desktop/uvm_study/template/sim/tests/my_case0.sv(29) @ 0: uvm_test_top [TEST_CASE] my_case0 new
修改目标:
UVM_INFO @ 102.2ns uvm_test_top [TEST_CASE] my_case0 new
取消打印文件路径,修改打印时间格式
源代码分析:
uvm_message_defines.svh
// MACRO: `uvm_info
//
//| `uvm_info(ID,MSG,VERBOSITY)
//
// Calls uvm_report_info if ~VERBOSITY~ is lower than the configured verbosity of
// the associated reporter. ~ID~ is given as the message tag and ~MSG~ is given as
// the message text. The file and line are also sent to the uvm_report_info call.
//
`define uvm_info(ID,MSG,VERBOSITY) \
begin \
if (uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \
uvm_report_info (ID, MSG, VERBOSITY, `uvm_file, `uvm_line); \
end
uvm_report_catcher.svh
protected function void uvm_report_info(string id, string message, int verbosity, string fname = "", int line = 0 );
string m;
uvm_action a;
UVM_FILE f;
uvm_report_handler rh;
rh = this.m_client.get_report_handler();
a = rh.get_action(UVM_INFO,id);
f = rh.get_file_handle(UVM_INFO,id);
m = this.m_server.compose_message(UVM_INFO,this.m_name, id, message, fname, line);
this.m_server.process_report(UVM_INFO, this.m_name, id, message, a, f, fname, line,
m, verbosity, this.m_client);
endfunction // uvm_report_info
uvm_report_server.svh
virtual function void process_report(
uvm_severity severity,
string name,
string id,
string message,
uvm_action action,
UVM_FILE file,
string filename,
int line,
string composed_message,
int verbosity_level,
uvm_report_object client
);
uvm_cmdline_processor clp;
string stack_args[$];
string split_vals[$];
static int debug, info, warn, error, fatal;
static bit first = 1;
if(first) begin
clp = uvm_cmdline_processor::get_inst();
void'(clp.get_arg_matches("+UVM_STACKTRACE", stack_args));
//Take into account if option is specified multiple times.
foreach(stack_args[i]) begin
string temp;
temp = stack_args[i].substr(16, stack_args[i].len()-1);
// In case no additinal argument is specified
if(temp == "") begin
error = 1; fatal = 1;
end
uvm_split_string(temp, ",", split_vals);
//For all the comma sepearted options
foreach(split_vals[i]) begin
case(split_vals[i])
"default" : begin error = 1; fatal = 1; end
"debug" : begin debug = 1; end
"info" : begin info = 1; end
"warn" : begin warn = 1; end
"error" : begin error = 1; end
"fatal" : begin fatal = 1; end
"all" : begin debug = 1; info = 1; warn = 1; error = 1; fatal = 1; end
default : $display("UVM_WARNING::INVLCMDARGS::Invalid argument specified for command line, +UVM_STACKTRACE=%0s", split_vals[i]);
endcase
end
end
first = 0;
end
// update counts
incr_severity_count(severity);
incr_id_count(id);
if(action & UVM_DISPLAY) begin
case (severity)
UVM_DEBUG : if(debug) $stack;
UVM_INFO : if(info) $stack;
UVM_WARNING: if(warn) $stack;
UVM_ERROR : if(error) $stack;
UVM_FATAL : if(fatal) $stack;
endcase
$display("%s",composed_message);
end
// if log is set we need to send to the file but not resend to the
// display. So, we need to mask off stdout for an mcd or we need
// to ignore the stdout file handle for a file handle.
if(action & UVM_LOG)
if( (file == 0) || (file != 32'h8000_0001) ) //ignore stdout handle
begin
UVM_FILE tmp_file = file;
if( (file&32'h8000_0000) == 0) //is an mcd so mask off stdout
begin
tmp_file = file & 32'hffff_fffe;
end
f_display(tmp_file,composed_message);
end
if(action & UVM_EXIT) client.die();
if(action & UVM_COUNT) begin
if(get_max_quit_count() != 0) begin
incr_quit_count();
if(is_quit_count_reached()) begin
client.die();
end
end
end
if (action & UVM_STOP) $stop;
endfunction
相关文章推荐
- 使用Acctinfo.dll了解更多AD用户帐号信息
- Android开发之获取手机中已安装apk文件信息(PackageInfo、ResolveInfo)(应用图片、应用名、包名等)
- 【Android Training - UserInfo】记住登入用户的信息[Lesson 2 - 使用OAuth2来进行身份鉴定]
- C++ 中通过GetAdaptersInfo获取网卡配置和Ip地址信息
- 【Using Infographics】使用信息图表
- 【Google Chart Tools: Infographics】谷歌图表工具:信息图表
- 定制“Server Too Busy”错误信息
- 使用ttXactAdmin、ttSQLCmdCacheInfo、ttSQLCmdQueryPlan获取SQL相关具体信息[TimesTen运维]
- Scripts:报告数据库中表信息汇总dba_table_info.sql
- [C#] 获取计算机内部信息 - ComputerInfoHelper
- /proc/cpuinfo保存机器的CPU架构相关信息
- wx.userinfo获取不到信息
- .NET Interop: 从IErrorInfo错误对象获得托管代码的异常信息
- ios 访问隐私信息 info.plist 中的字段
- 创建一个目录info,并在目录中创建一个文件test.txt,把该文件的信息读取出来,并显示出来
- ThinkPHP第八天(U函数放置在外部JS不会被解析,错误界面定制,错误信息变量)
- WMS GetFeatureInfo (Layers)——WMS获取要素信息(图层)
- 调用Android系统“应用程序信息(Application Info)”界面
- info查看redis服务端信息详解
- 微信小程序wx.getImageInfo()如何获取图片信息