Facing problem while using uvm container

Hello ,

i am seeing below error in my uvm environment , please guide me to resolve the issue .
1, below error pointing in driver file when calling get function of container . we are using set function in container also. is it required to set any where(means in top file), if its required how to set and where to set.
2. in driver he is getting the virtual interface using uvm_config_object but i am not able to set virtual interface using uvm_config_object set , i tried with setting uvm_config_db, but still its giving the below error. is it possible to set virtual interface using uvm_config_object set method in top. if its possible how to set or how to pass virtual interface uvm_config_object

ERROR:
Error-[NOA] Null object access

The object at dereference depth 0 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.

top file:


  uvm_config_db#(virtual JtagBfmIntf)::set(null, ".*" , "V_JTAGBFM_PIN_IF", dfx_if);

driver file code:


super.connect_phase (phase);

        $swrite (msg, "Getting the virtual JtagBfmPinIf interface");
        `uvm_info (get_full_name(), msg, UVM_MEDIUM);
        // Assigning virtual interface
      if(uvm_config_object::get(this, "","V_JTAGBFM_PIN_IF", temp)) 
        begin
           if(!$cast(vif_container, temp))
          `uvm_fatal(get_full_name(),"Agent fail to connect to TI. Search for string << active agent exists at this hierarchy >> to get the list of all active agents in your SoC");
        end
        PinIf = vif_container.get_v_if (); 

container class file:


//--------------------------------
   // Set Virtual Interface Function
   //--------------------------------
`ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
   virtual function void set_v_if (T virt_if);
`else    
   virtual function void set_v_if (virtual JtagBfmIntf virt_if);
`endif
     v_if = virt_if;
   endfunction : set_v_if

   //------------------------------------
   // Get Virtual Interface Function
   //------------------------------------
`ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
   virtual function T get_v_if ();
`else    
   virtual function virtual JtagBfmIntf get_v_if ();
`endif
      return (v_if);
   endfunction : get_v_if

   //----------------
   // Clone Function
   //----------------
   virtual function uvm_object clone ();
   `ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
      JtagBfmIfContainer #(T) temp = new this;
   `else    
      JtagBfmIfContainer temp = new this;
   `endif
      clone = temp; //return(temp);
   endfunction : clone

In reply to Abhilash c h:

Why you are using get on the config_object? You should make a get on the config_db in your driver.
BTW use the uvm reporting Marcos instead of $swrit.

Why you are using get on the config_object? You should make a get on the config_db in your driver.
BTW use the uvm reporting Marcos instead of $swrit.
[/quote]

1.i can get using config_db. but in this case i can’t able to container class implemented function
2.actually this is standalone vip ,i am integrating into my subsystem environment.in this vip they are getting virtual interface like below
if(uvm_config_object::get(this, “”,“V_JTAGBFM_PIN_IF”, temp))
they declared temp as uvm_object temp; and casting into vif_container. they declared vif_container as handle for vif_container class. when calling container function i am facing above error.
if(!$cast(vif_container, temp))
PinIf = vif_container.get_v_if ();// here its pointing error.

  1. how to set or handle config_object for above uvm_config_object::get function using virtual interface

In reply to Abhilash c h:

Again, you are mixing the container approach with the config_db.
Could you please show the whole container class code.

In reply to chr_sue:

In reply to Abhilash c h:
Again, you are mixing the container approach with the config_db.
Could you please show the whole container class code.

class JtagBfmIfContainer #(type T = int) extends uvm_object;
`else    
class JtagBfmIfContainer extends uvm_object;
`endif
   
  
   `uvm_object_utils(JtagBfmIfContainer)
   //--------------------------------------------
   // The virtual interface to drive DUT signals
   //--------------------------------------------
`ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
   protected T v_if;
`else    
   protected virtual JtagBfmIntf v_if;
`endif

   //----------------------
   // Constructor Function
   //----------------------
   function new (string name="JtagBfmIfContainer");
      super.new (name);
   endfunction : new

   //--------------------------------
   // Set Virtual Interface Function
   //--------------------------------
`ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
   virtual function void set_v_if (T virt_if);
`else    
   virtual function void set_v_if (virtual JtagBfmIntf virt_if);
`endif
     v_if = virt_if;
   endfunction : set_v_if

   //------------------------------------
   // Get Virtual Interface Function
   //------------------------------------
`ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
   virtual function T get_v_if ();
`else    
   virtual function virtual JtagBfmIntf get_v_if ();
`endif
      return (v_if);
   endfunction : get_v_if

   //----------------
   // Clone Function
   //----------------
   virtual function uvm_object clone ();
   `ifdef CHASSIS_JTAGBFM_USE_PARAMETERIZED_CLASS    
      JtagBfmIfContainer #(T) temp = new this;
   `else    
      JtagBfmIfContainer temp = new this;
   `endif
      clone = temp; //return(temp);
   endfunction : clone

endclass : JtagBfmIfContainer


In reply to Abhilash c h:
The UVM base class librry does not know a class ‘uvm_container’. In your implementation you are using a conffiguration object which is defined by your own.
A configuration object and the configuration_db are completely different things. The configuration opbject is a class which is used to configure any uvm_component or tarnsient object like seq_items ot uvm_sequemces.
The config_db is a data base where we can store any type of objects. These can be set in a component and they cam be retrieved in any other component across the hierarchy. This is a very powerful approch. We use this approach to perfrom the connections through the vortual interface, by passing it to the config_db from the toplevel module (ste) and retrieving it in any of the transactors like uvm_driver or uvm_monitor.
We can also add the virtual interface to a configuration object and passing this object to the config_db and retrieving this from there.
This is the common and recommended approach.
You are mixing both approaches and this is your problem.
Additionally in your JtagBfmIfContainer you are things wrong, because you are differentiating between a parameterized version ad a version without parameter. The parameterized version needs a differnt registration macro than the version without a parameter.
Try to clean-up your code and follow the recommendations.
For details see the chapetr ‘DUT-Testbench Connections’ in the UVM-Cookbook (UVM | Verification Academy).