uvm report机制-uvm report info冗余度(设置与重载)与uvm_report_catcher(使用了callback机制)

资料来源

(1) 《Practical UVM Step by Step with IEEE》

注1: 在打印信息之前,UVM会比较要显示信息的冗余度级别与默认的冗余度阈值。如果小于等于阈值,就会显示,否则不会显示.

1.冗余度阈值(概念与设置)

1.1冗余度阈值相关函数

tb里面可以调用下面函数动态修改或获取冗余度等级,相比plusargs在0时刻之前配置,更加灵活;

(1) get_report_verbosity_level: 得到某个component的冗余度阈值;

(2) set_report_verbosity_level: 设置某个component的冗余度阈值;

注1:冗余度阈值的设置可以放在build_phase之后run_phase之前的任意phase;

(3) set_report_verbosity_level_hier: 递归的设置某个component及其下所有component的冗余度阈值.

(4) set_report_id_verbosity

(5) set_report_id_verbosity_hier

1.2命令行设置冗余度阈值

<sim command> +UVM_VERBOSITY=UVM_HIGH或者<sim command> +UVM_VERBOSITY=HIGH等同于在base_test中调用set_report_verbosity_level_hier函数.

注1:补充line3中time的含义以及uvm_report_enabled()的使用;

(1) $test$plusargs UVM_VERBOSITY是在仿真刚开始但RTL时间还未推进之前就解析并执行的(0时刻之前);

(2) 如果$test$plusargs指定了多次,会按最低的冗余度来执行; 如仿真参数为+UVM_VERBOSITY=UVM_LOW +UVM_VERBOSITY=UVM_HIGH,最终按照UVM_LOW来过滤信息;

(3) +uvm_set_verbosity设置中打印信息的冗余度采用+uvm_set_verbosity的设置,而忽视+UVM_VERBOSITY的设置;

2.重载打印信息的严重性及应用场景

2.1重载打印信息严重性相关函数(如set_report_severity_override与set_report_severity_id_override)

利用该函数可以使重载严重性只针对某个component内的某个特定的ID起作用;

2.2命令行重载

2.3应用场景(jerryIC验证)

(1) 专门进行异常测试时,由于施加的激励本身就是错误的,难免会出发TB里面原先定义好的uvm_error或者uvm_fatal,导致测试提前终结;这种情况下,需要将UVM_ERROR降级为UVM_INFO;

3.uvm_report_catcher(使用了callback机制)

3.1背景

(1) 在一些特殊case中,遇到VIP报uvm_error导致仿真退出,这时,可以使用uvm_report_catcher捕获到它特定的message,并将其降级为UVM_INFO.

(2) 比较粗糙的将UVM_ERROR disable的方法有使用uvm打印信息重载方法对UVM_ERROR降级或使用set_report_severity_actiion方法;

3.2示例与补充

(1) uvm_report_catcher与uvm_re_match函数的配合使用;   

https://blog.csdn.net/W1Z1Q/article/details/122814437

(2) 枚举变量action_e的值为THROW表示report will continue to be processed by server; 值为CAUGHT表示 report will not continue to be processed by server;  

 

https://blog.csdn.net/HelloQili/article/details/113863561

 

 1 typedef uvm_callbacks    #(uvm_report_object, uvm_report_catcher) uvm_report_cb;
 2 
 3 virtual class uvm_report_catcher extends uvm_callback;
 4   `uvm_register_cb(uvm_report_object,uvm_report_catcher)
 5   typedef enum { UNKNOWN_ACTION, THROW, CAUGHT} action_e;
 6     ...    
 7   pure virtual function action_e catch();
 8   ...
 9 endclass
10 
11 //示例
12 class message_promoter extends uvm_report_catcher;
13     function new(string name="message_promoter");
14         super.new(name);
15     endfunction
16 
17     function action_e catch();
18         if(get_severity()==UVM_INFO && get_id()=="SLAVE_DRIVER")
19             set_severity(UVM_ERROR);
20         return THROW;    
21     endfunction
22 endclass
23 
24 class wb_conmax_alter_verbosity_specific_component_test extends wb_conmax_base_test;
25     `uvm_component_utils(wb_conmax_alter_verbosity_specific_component_test)
26     measage_promoter promoter=new();
27     
28     function new(string name, uvm_component parent);
29         super.new(name,parent);
30     endfunction
31 
32     virtual function void build_phase(uvm_phase phase);
33         super.build_phase(phase);
34       uvm_config_db#(uvm_object_wrapper)::set(this,"env.wb_conmax_virt_seqr.main_phase","default_sequence",wb_conmax_virtual_sequence::get_type());
35 
36         uvm_report_cb::add(null, promoter);
37     endfunction
38 
39     function void end_of_elaboration_phase(uvm_phasep phase);
40 
41         uvm_report_cb::add(this.env.slave_agent[0].slv_drv,promoter);
42     endfunction
43 
44 endclass

 

posted on 2021-11-18 11:16  知北游。。  阅读(1954)  评论(0编辑  收藏  举报

导航