Uvm_component_utils with parameters

Dave,

Thank you for the response. I am a newbie to configuration tables, so please be patient with me :). I will need some spoon feeding.

In my top level, I put my virtual interfaces in the config table like this:
************** top.sv ********************

dut_if_client         difc[`NUM_MEM_CLIENTS] (.reset(reset), .clk(clk));
dut_if_client_wrapper vifc[`NUM_MEM_CLIENTS];  

  generate
    // Construct the virtual interfaces...
    for (genvar i = 0; i < `NUM_MEM_CLIENTS; i++)
      initial vifc [i] = new (difc[i]);
  endgenerate

  initial begin
    string my_vif_name; 
    for (integer i = 0; i < `NUM_MEM_CLIENTS; i++) begin
      my_vif_name = $sformatf("vif_c%0d", i);
      `ovm_info("top.sv; virtual interface name", my_vif_name, OVM_MEDIUM)
      set_config_object("*", my_vif_name, vifc[i], 0);
    end // for loop    
     run_test(); 
  end

Then in the environment I create the agents like this:
****************** env.sv ************************

virtual function void build;
    super.build(); 
    for (integer i = 0; i < `NUM_MEM_CLIENTS; i++) begin
      string my_agnt_name;
      my_agnt_name  = $sformatf("agnt_drv%0d", i);  
      $display("ENV:  Create Loop %0d", i);
      agnt_drv[i]   = tb_agent_mem_client::type_id::create(my_agnt_name, this);
    end // for loop
  endfunction

Then in each of the drivers, I connect to the virtual interface like this:
********************* tb_driver_mem_client.sv ****************************

class tb_driver_mem_client extends ovm_driver #(trans_item_mem_client);
  `ovm_component_utils(tb_driver_mem_client)

  static int id_static = 0;
  int id;
  
  virtual dut_if_client vif_client;


  function new (string name, ovm_component parent);
    super.new(name, parent);
    id = id_static++;
  endfunction


  function void build ();
    super.build();
    assign_vi;
  endfunction

  function void assign_vi;
    string my_vif_name;
    ovm_object     obj;
    dut_if_client_wrapper w;
    //---------------------------------------
    
    my_vif_name = $psprintf("vif_c%0d", id);
    assert (get_config_object(my_vif_name, obj, 0));
    assert ($cast(w, obj));
    vif_client = w.vif;
  endfunction
  
 // Other functions...
endclass

I currently use a static integer as a way to loop through the different virtual interface names “vif_cN”, where N is the ID number. It works, but it seems like what you are trying to explain to me in the last post is a much better technique.

When you said to use uvm_config_db, did you mean at the top level where the virtual interfaces are declared? If so, I still do not see how to do a “get_config” by name in the driver class (even though we named the agents). Can you please explain?

Again, thank you for the help!