Thursday, December 22, 2016

Change severity from UVM_ERROR to UVM_INFO

Sometimes if you will face situation where you need some of your components from your environment to don’t show error message. You want to disable error from some component.
of course you don’t change every uvm_error message to uvm_info..
It will take care by one awesome functionality of uvm_report_catcher class.

UVM_REPORT_CATCHER :
The uvm_report_catcher is used to catch messages issued by the uvm report server.
It means all four message of `uvm_info , `uvm_error , `uvm_warning , `uvm_fatal can be registered and controlled by this class.
It will catch messages using callbacks.
The uvm_callbacks#(<uvm_report_object>,uvm_report_catcher) class is aliased to “uvm_report_cb” to make it easier to use.

EXAMPLE :
class my_error_demoter extends uvm_report_catcher;
  function new(string name="my_error_demoter");
    super.new(name);
  endfunction
  //This example demotes "MY_ID" errors to an info message
  function action_e catch();
    if(get_severity() == UVM_ERROR && get_id() == "MY_ID")
      set_severity(UVM_INFO);
    return THROW;
  endfunction
endclass

my_error_demoter demoter = new;
initial begin
 // Catchers are callbacks on report objects (components are report
 // objects, so catchers can be attached to components).

 // To affect all reporters, use null for the object
 uvm_report_cb::add(null, demoter);

 // To affect some specific object use the specific reporter
 uvm_report_cb::add(mytest.myenv.myagent.mydriver, demoter);

 // To affect some set of components using the component name
 uvm_report_cb::add_by_name("*.*driver", demoter);
end

No comments:

Post a Comment