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.

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.

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

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

No comments:

Post a Comment