Hi,
I have a top environment (top_env) which takes in unpacked parameters.
There is an agent (my_agent) array inside. The number of agent instances I need to instantiate is equal to the parameter value ‘NUM_INSTS’.
The agent however is also parameterized (agent and env code below)
class my_agent #(parameter int P1, parameter int P2) extends uvm_agent;
// Agent code
endclass
class top_env #(parameter int NUM_INSTS = 1,
parameter PARAM1 [NUM_INSTS-1:0] = '{NUM_INSTS{1}},
parameter PARAM2 [NUM_INSTS-1:0] = '{NUM_INSTS{1}},) extends uvm_env;
endclass
My requirement is instantiate ‘my_agent’ instances in the build phase of the env such that the parameters from the top_env are mapped to the agent_instance while creating.
For example, for parameter value NUM_INSTS = 2, Lets say I specify the value of PARAM1 as '{3,4} and PARAM2 as '{5,6}
For the above configuration, I would like to have instance 0 of the agent with parameters P1 and P2 as ‘3’ and ‘5’ respectively (i.e. PARAM1[0] and PARAM2[0] of the top env)
simlilarly,
instance 1 of the agent with parameters P1 and P2 as ‘4’ and ‘6’ respectively (i.e. PARAM1[1] and PARAM2[1] of the top env).
What is the correct way to dynamically create the agent components in the build phase of the top_env ?.
Thanks
Jayant