Today we will look into a very useful concept of UVM specially when we are doing any erroneous testing. Its all about modifying the severity, id, action, verbosity or the report string itself before the report is finally issued by the report server.
Normally in our test environment shout for error when any erroneous scenario like CRC error condition or generation of any error interrupt occurs. And we also write erroneous tests to test these scenarios where we end-up with error messages and tests fails.
The uvm_report_catcher is used to catch messages issued by the uvm report server. Upon catching a report, the catch method can modify the severity, id, action, verbosity or the report string itself before the report is finally issued by the report server. The report can be immediately issued from within the catcher class by calling the issue method.
The catcher maintains a count of all reports with FATAL, ERROR or WARNING severity and a count of all reports with FATAL, ERROR or WARNING severity whose severity was lowered. These statistics are reported in the summary of the uvm_report_server.
Report catcher class:
class error_report_catcher extends uvm_report_catcher;
virtual function action_e catch();
if(get_severity() == UVM_ERROR && get_id() == "MON_CHK_NOT_VALID") begin
endclass : error_report_catcher_c
Use of error catcher in testcase:
class erroneous_test extends base_test_class;
// report catcher to suppress errors
error_report_catcher error_catcher ;
/// \fn new_constructor
/// \fn build_phase
virtual function void build_phase(uvm_phase phase);
error_catcher = new();
// User configurations
uvm_config_db#(env_config_c)::set(this, "*" , “env_cfg", env_cfg);
// Calling the error sequence
endfunction : build_phase
endclass : erroneous_test