User-defined verbosity using uvm_config_db

Hi Forum,

In the UVC used in our testbench I observe

class driver `PARAM_DECL extends uvm_driver#(axi4_txn);
  
  vif_proxy_comp `PARAM_ORDER  vif_proxy; 
  protected int verbosity = UVM_HIGH;
  protected string    ID  = "AXI4_DRIVER"
  int unsigned  transaction_depth = 100;

 `uvm_component_param_utils_begin( driver `PARAM_ORDER )
    `uvm_field_object(vif_proxy,UVM_ALL_ON)
    `uvm_field_int(verbosity, UVM_ALL_ON|UVM_DEC)
    `uvm_field_int(transaction_depth, UVM_ALL_ON|UVM_DEC)
    `uvm_field_string(ID, UVM_ALL_ON) 
    // .....
 `uvm_component_utils_end

  function new( string name = "axi4_driver",uvm_component parent = null);
    super.new(name,parent);
    // ...
  endfunction

  function void build_phase( uvm_phase phase);
    uvm_object  dummy;

    super.build_phase(phase);
    void'( uvm_config_db#(string)::get(this,"","ID",ID) );
    if(!uvm_config_db#(uvm_object)::get(this,"","vif_proxy",dummy)) begin
      `uvm_fatal(ID,"No virtual interface available for driver")
    end 
    else begin
      if(!$cast(this.vif_proxy, dummy)) begin
        `uvm_fatal(ID,"Supplied object is not the correct type")
      end
      else begin
       `uvm_info(ID,"Interface successfully retrieved",verbosity)
      end
    end    
  endfunction

  // In remaining code all `uvm_info use 1st arg. as ID and 3rd arg. as verbosity
  // Eg: `uvm_info(ID,$sformatf("..."),verbosity)

Within UVM BCL the enumeration type is defined as

typedef enum
{
  UVM_NONE   = 0,
  UVM_LOW    = 100,
  UVM_MEDIUM = 200,
  UVM_HIGH   = 300,
  UVM_FULL   = 400,
  UVM_DEBUG  = 500
} uvm_verbosity;

Assume that user performs a uvm_config_db::set for verbosity to integer (2-state) value of

140 / 150 / 160 ( either one of the three )

As these values are between UVM_LOW and UVM_MEDIUM,

what would the actual verbosity used ?

Thanks in advance

UVM verbosity gets filters with a simple greater than operator (>). If a report (`uvm_info) is given a verbosity greater than the set level, the report is ignored.

1 Like

Thanks Dave.

Two quick questions

As the UVC calls super.build_phase(phase), one can set values for `uvm_field_* macros

(1) Do the macros call uvm_config_db internally ?

One observation is that if there is no setting, I observe the values specified during initialization are used

(2) For `uvm_field_int types what all are legal specializations ?

I observe success with uvm_config_db#(uvm_bitstream_t)::set and

uvm_config_db#(int)::set.

Are there any further possible ways ?

The UVM field macros enclosed within the _utils_begin/end block define sections of a function that is invoked by apply_config_settings(), which in turn calls uvm_config_db#(type)::get(), which is subsequently called by uvm_component::build_phase(). See Comprehension question: apply_config_settings, config_db,.

uvm_config_db#(uvm_bitstream_t) and uvm_config_db#(int) map to different databases. See Difference between set_config_object and uvm_config_db #(...)::set(); - #2 by dave_59