I’ve some `uvm_error messages inside a module (checker), which is instantiated at hdl_top module.
I want to change the severity of checker module from UVM_ERROR to UVM_WARNING for certain test-case
`include "uvm_macros.svh"
module checker();
...
intr_assert: assert property (intr_prop) else `uvm_error ("CHECKER", "intr_assert failed")
endmodule
So far I’ve tried following as a workaround, but severity didn’t change.
`include "uvm_macros.svh"
import uvm_pkg::*;
module checker();
...
uvm_report_handler m_rh; //report handler instance
intr_assert: assert property (intr_prop) else `uvm_error ("CHECKER", "intr_assert failed")
endmodule
class test_top extends uvm_test;
...
virtual task run_phase(uvm_phase phase);
if (uvm_top.top_levels[0].get_type_name() == "invalid_mode_test") begin
hdl_top.checker.m_rh = new();
hdl_top.checker.m_rh.set_severity_id_override(UVM_ERROR, "CHECKER", UVM_WARNING);
end
endclass
I’ve used severity override on a number of occasions for class, worked fine. Does this work for class only? If not then can anyone suggest to me a way?
In reply to Asraful_21:
The `uvm_info/warning/error/fatal macros call the functions uvm_report_info/warning/error/fatal. These functions are defined as methods in the uvm_report_object and uvm_sequence_item classes as well as globally defined in the uvm_pkg. When calling these functions outside a derived class where these methods are not defined, it picks up the global definition. That global definition uses the report handler in uvm_top(uvm_root).
So you can either apply the report setting globally to uvm_top, or construct a log class inside the module for each module instance.
module my_checker;
`include "uvm_macros.svh"
import uvm_pkg::*;
initial #1
`uvm_error ("CHECKER", "intr_assert failed")
uvm_report_object log = new($sformatf("%m"));
initial #2
`uvm_error_context ("CHECKER", "intr_assert failed",log)
endmodule
module top;
import uvm_pkg::*;
my_checker c1();
my_checker c2();
initial begin
uvm_top.set_report_severity_id_override(UVM_ERROR, "CHECKER", UVM_WARNING);
c1.log.set_report_severity_id_override(UVM_ERROR, "CHECKER", UVM_WARNING);
end
endmodule
In reply to dave_59:
Thanks, Dave.
I’ve tried the following and it worked!
uvm_top.set_report_severity_override(UVM_ERROR, UVM_WARNING);
Even though this works only for reports that have formats like
UVM_WARNING @ 0.470ns: reporter [CHECKER] intr_assert has failed
But doesn’t work for reports from testbench components. For instance, Scoreboard
UVM_ERROR @ 0.142ns: uvm_test_top.environment.scoreboard [SCBD::FAIL] FAILED
Had to provide hierarchical path to demote severity.
Thanks, it was super useful and simple.
By the way, report catcher also works in this case as well.
class report_catcher extends uvm_report_catcher;
function new (string name = "");
super.new(name);
endfunction
function action_e catch;
uvm_severity severity = get_severity();
string id = get_id();
uvm_action action = get_action();
string message = get_message();
int verbosity = get_verbosity();
if (severity == UVM_ERROR)
set_severity(UVM_WARNING);
return THROW;
endfunction
endclass
class test_top extends uvm_test;
...
report_catcher catcher_h; //report catcher insatance
function void end_of_elaboration_phase(uvm_phase phase);
catcher_h = new("catcher_h");
uvm_report_cb::add(null, catcher_h);
endfunction
endclass