From environment , how to limit the scope of an agent configuration object, only to its corresponding agent ,if we have a dynamic array of agents in environment

Hi,
To get the knowledge on UVM , I am trying to create an AHB master sub environment , and this sub environment may contain multiple agents depending upon configuration (for example , ahb master sub environment contains only four ahb masters) , so i used a dynamic array inside the ahb master sub environment to store the ahb-master-agents.
I declared a dynamic array in “ahb-master-sub-env_config_object” to store individual “ahb_master_agent_config-objects” & these individual ahb_master_agent configuration is done within the test_base.
within the “ahb-master-sub-env”, i did some more configuration for “few ahb_master_agents” & i want to assign these “ahb-master-agent_config_objects” to its corresponding “ahb-master-agent” only
i.e the scope of “ahb-master_agent_config[0]” is limited to “ahb-master-agent[0]” only
ie. ahb-master_agent[1 … 3] cannot access " ahb-master_agent_config[0]" from database ,

Would anyone please say , how to acheive this.

I am unable to use uvm_config-db at the ahb-master-agent to get its configuration object from the database, so , within the build phase of ahb-master-sub-env , i directly assigned indivudal ahb-master-agent config objects to its corresponding ahb-master-agents.
But i want to use uvm-config-db method , would anyone please say, how to acheive this.
Thanks in advance.

Thanks
kamalesh

The uvm_config_db allows you to specify a scope for each item. So try something like this in your environment:


foreach (ahb-master_agent_config[i]) begin
  uvm_config_db#(ahb-master_agent_config)::set(this, $sformat("abh-master-agent[%0d]", i), "config_obj", ahb-master_agent_config[i]);
end

In reply to cgales:

Hi,
Thank you
Thanks for your reply.

I am trying to develop a virtual sequence & virtual sequencer for the above case, so I got one more question , how to start “N” number of sequences on “N” sequencers at a time , how to write the code , if “N” is a variable(we get this value form configuration object) ,
I am tried with the for/foreach loop , but if i use foreach/for loop , i think i will start the sequences on the sequencers in a series fashion , so in order to start all in parallel , can i use fork-join_none inside for/foreach loop or is there any alternative ,

Thanks
kamalesh

In reply to kamalesh:

To fork off sequences in a loop, you will need to use fork/join_none followed by a ‘wait fork’ statement. The SystemVerilog LRM section 9.6 discusses this construct.