在使用VIP时,出于对仿真性能和环境效率的考虑,可以关闭VIP中的一些检查和打印信息。当然,屏蔽的前提是确认过这些检查或打印信息是不被需要的或已实现的。
禁用特定的协议检查
针对VIP中特定的协议检查,如果频繁报warning或不需要的error时,可使用 disable_check() 方法来禁用该check。
可以在env组件内,当monitor等结构组件已被创建后(如在end_of_elaboration_phase中)调用该方法,例如:
function void end_of_elaboration_phase(uvm_phase phase);
// AXI VIP
axi_system_env.master[0].monitor.checks.disable_check(axi_system_env.master[0]
.monitor.checks.signal_valid_rdata_when_rvalid_high_check);
// UART VIP
uart0_agent.err_check.disable_check(uart0_agent.err_check.svt_err_chk_z_x_on_sout);
endfunction
类似地,也有 enable_check() 方法可以在调用时启用协议检查。
禁用Monitor的协议检查
在某些场景下,如果不需要协议检查,只需检查读/写数据正确性,或已IP级环境中对协议进行了验证,集成到chip级验证环境后,不需要再逐次循环检查协议。为了提高仿真性能,可以禁用整个Monitor的检查。默认情况下,总线monitor和端口monotir始终会检察协议并发出协议违规消息(error或warning)。VIP支持通过配置protected属性dw_vip_axi_system_model_configuration::m_blChkProt 来启用或禁用协议检查。由于此属性是protected类型,因此不能直接通过对象句柄访问。VIP 提供了一个单独的task来访问此属性:
task setChkProt (VMT_BOOL nChkProt, integer kind=-1);
下面是如何禁用它的示例:
dw_vip_axi_system_model_configuration vip_axi_sys_cfg;
dw_vip_axi_port_model_configuration vip_axi_slave_cfg;
vip_axi_sys_cfg = new (, 1, 1, VMT_BOOLEAN_FALSE);
vip_axi_sys_cfg.setChkProt(0, ); //禁用协议检查
vip_axi_slave_cfg = vip_axi_sys_cfg.createPortMdlCfg (`DW_VIP_AXI_SLAVE_PORT_CFG, 0);
vip_axi_slave_monitor = new ("AXI Port Monitor Slave",
slave_monitor_mp,
vip_axi_slave_cfg );
禁用消息打印
使用VIP时会产生很多打印信息,在仿真过程中不断打印信息或者读写文件对仿真速度影响非常大,因此在环境调试稳定后可以屏蔽掉一些不需要打印信息。VIP本身并未提供控制系统打印的配置,这里有两种方法来实现:
- 官方提供了其中一种方法。通过派生uvm_report_catcher创建一个降级类,然后在env或base test中构建它并注册回调:
class my_demoter extends uvm_report_catcher;
function action_e catch();
if(get_severity() == UVM_INFO && get_id() == "process_internal_messages") begin
set_verbosity(UVM_DEBUG);
set_action(UVM_NO_ACTION);
end
if(get_severity() inside {UVM_ERROR} && (!uvm_re_match("mapping failed", get_message()))) begin
set_severity(UVM_INFO);
set_verbosity(UVM_DEBUG);
end
return THROW;
//THROW, report will continue to be processed by server;
//CAUGHT, report will not continue to be processed by server;
endfunction
endclass
class base_test extends uvm_test;
my_demoter demoter;
...
virtual function void build_phase(uvm_phase phase);
demoter = new();
super.build_phase(phase);
uvm_report_cb::add(null,demoter);
...
endfunction: build_phase
...
endclass
- 另一种方法是直接采用UVM中的打印控制函数,推荐采用这种方法更简单,同样可以在end_of_elaboration_phase中控制,例如:
function void end_of_elaboration_phase(uvm_phase phase);
// disbale VIP log print
axi_env.axi_system_env.slave[0].set_report_severity_action(UVM_INFO, UVM_NO_ACTION);
uvm_top.set_report_id_action("TEST_DONE", UVM_NO_ACTION);
endfunction
最后,总结下UVM中的一些打印消息控制方法,参考下节。
UVM的打印信息控制方法
- 设置特定component的默认冗余度阈值
set_report_verbosity_level (int verbosity_level)
- 根据ID和严重性设置打印信息的冗余度阈值
set_report_id_verbosity (string id, int verbosity)
set_report_severity_id_verbosity (uvm_severity severity, string id, int verbosity)
还有两个类似的递归设置函数,set_report_id_verbosity_hier和set_report_severity_id_verbosity_hier,可设置component及其下所有component。
- 根据ID和严重性控制打印信息的行为
set_report_severity_action (uvm_severity severity, uvm_action action)
set_report_id_action (string id, uvm_action action)
set_report_severity_id_action (uvm_severity severity, string id, uvm_action action)
还有三个类似的递归设置函数,set_report_severity_action_hier,set_report_id_action_hier,和set_report_severity_id_action_hier。
- 重载打印信息的严重性
set_report_severity_override (uvm_severity cur_severity, uvm_severity new_severity)
set_report_severity_id_override (uvm_severity cur_severity, string id, uvm_severity new_severity)