Setting and getting config class objects

Hi chr_sue,

Thanks for the reply.

My config_class looks like this




class master_agent_cfg extends uvm_object;
    
  `uvm_object_utils(master_agent_cfg)
  
  virtual connect_if vif; //interface,name changed
  
  uvm_active_passive_enum active=UVM_ACTIVE; //agent status
  
  bit has_functional_coverage=0;
  
  
  extern function new();
  extern function void build_phase();  
  
endclass


Yes ,i need only two config objects in this case.One for master & one for slave.
What if i am having multiple agents ?
My intention over here is ,its better to have more flexibility if in case in future any
more agents are added.
Is no of agents proportional to no of agent_cfg ?
As we can set the status of an agent .i.e active or passive by the help of m_cfg handle.
So in that way ,if i am having dynamic array of m_cfg ,then it will be flexible right ?

FYI,

env_cfg looks like this



 class master_env_cfg extends uvm_object;

  `uvm_object_utils(master_env_config)
  
  
  bit has_scoreboard=1;
  bit has_m_agent=1;
  bit has_s_agent=1;
  bit has_m_top=1;
  bit has_s_top=1;
  
  
  
  master_agent_cfg m_cfg[]; //config_object is dynamic,as config info for particular agent might change
  
  
  
  //These are the flexible parameters,when declared can be reused accordingly
  int no_of_scoreboard=1;
  int no_of_m_agent=1;
  int no_of_s_agent=1;
  int no_of_m_top=1;
  int no_of_s_top=1;


  extern function new(string name="master_env_cfg");
 
 endclass
    

 

With respect to the error message ,error line is not pointing to get method of config_db.
If there was some sort of argument mismatch in get method ,ten it will point to it right ?

Its just that i am not getting the m_cfg handle into my agent,by which i can make my agent
or passive.

Any simple example pointed w.r.t to set and get handle would also be great.
I had explored the forum and i had found info about setting the handles ,but not how to get
the handles .

Can you please help me on this ?

Thanks & regards,
Shubham