Tuesday, February 2, 2016

uvm_report_catcher - uvm msg management across multiple envs


Typically we tend to use the common bfms/envs/vkits in many of our unit level/sub level/full chip level benches. When we use the envs from other modules, they might print lot of messages which might be unnecessary for our module. So, in order to minimize or turn off those messages, uvm_report_catcher is very useful.

Here is an example.

This class is trying to mask all the uvm messages below UVM_MEDIUM verbosity.

class logbuster_c extends uvm_report_catcher;

  function new(string name="logbuster");
    super.new(name);
  endfunction

  function action_e catch();
    if (get_verbosity() < UVM_MEDIUM)
      set_action(UVM_NO_ACTION);

    return THROW;
  endfunction
endclass



class basic_test extends uvm_test;
......
logbuster_c logbuster;

.....
virtual function void end_of_elaboration_phase(uvm_phase phase);
...
//if we want to apply for our whole env, use null
 //uvm_report_cb::add(null, logbuster);
//else use for specific component or object
         uvm_report_cb::add(env.ncb_env.drvr, logbuster);
         uvm_report_cb::add(env.ncb_env.arb_rsp_credits, logbuster);

   endfunction : end_of_elaboration_phase

endclass : basic_test



1 comment: