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 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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM