Agent configuration when using multiple instances of the same agent

I have a case where I want to use multiple instances of the same agent. My approach so far has been to have the agent get the agent configuration from uvm_config_db. But I don’t see how that can work when I have multiple instances of the same agent, each agent is going to need its own configuration, but the agent itself does not know which agent configuration instance he needs to get. How do I configure each instance of an agent?

In reply to RaulAguilarPA:

When you set() the configuration object in the config_db, you need to specify the correct agent hierarchy:


  uvm_config_db#(agent_cfg)::type_id::set(this, "agent0.*", "agent_cfg", agent0_cfg);
  uvm_config_db#(agent_cfg)::type_id::set(this, "agent1.*", "agent_cfg", agent1_cfg);

In reply to cgales:

That makes sense. Thank you very much!