Is there an easy way to create a base environment with an arbitrary number of agents that can be reused? I have several blocks in a large design that all have some common interfaces: AHB, AXI, APB, SPI, proprietary, etc. Each block may contain one or more of these interfaces, and I want to use a base environment that can be extended and customized for each block.
One possible solution that is not available to me is use the Questa VIP library and the mvc_env as the base environment (management has decided to use homegrown VIP and VIP from other vendors). Creating something similar to the mvc base environment seems like it would be a lot of time and effort (no point reinventing the wheel).
Any other ways to do this?

Will the following approach be sufficient?
import test_params_pkg::*;
class my_base_env extends uvm_env;
my_agent my_agents_h[];
your_agent your_agents_h[];
our_agent our_agents_h[];
their_agent their_agents_h[];
function void build_phase(uvm_phase phase);
for (int i=0;i
For some reason my previous reply didn't contain all of the example code. Repeating for benefit of others:
class my_base_env extends uvm_env;
my_agent m_my_agent[];
my_base_env_config m_base_env_cfg;
:
virtual function void build_phase(uvm_phase phase);
if(!uvm_config_db #(my_base_env_config)::get(this, "", "my_base_env_config", m__base_env_cfg)) begin
`uvm_error("build_phase", "my_base_env_config configuration object not found")
end
m_my_agent = new[m_base_env_cfg.num_my_agents];
foreach (m_base_env_cfg.m_my_agent_cfg[i]) begin
m_my_agent[i] = my_agent::type_id::create($sformatf("m_my_agent_%0d",i),this);
uvm_config_db #(my_agent_config)::set(this, $sformatf("m_my_agent_%0d",i), "my_agent_config", m_base_env_cfg.m_my_agent_cfg[i])
:
endclass
class my_base_env_config extends uvm_object;
:
my_agent_config m_my_agent_cfg[];
rand int num_my_agents;
:
endclass
class my_test_base extends uvm_test;
my_base_env_config m_base_env_cfg;
my_agent_config m_my_agent_cfg[];
:
virtual function void build_phase(uvm_phase phase);
m_base_env_cfg = my_base_env_config::type_id::create("m_base_env_cfg");
m_base_env_cfg.num_my_agents = 3;
// critical step here
m_base_env_cfg.m_my_agent_cfg = new[num_my_agents];
foreach (m_base_env_cfg[i]) begin
m_my_agent_cfg[i] = my_agent_config::type_id::create($sformatf("m_my_agent_cfg+%0d",i));
:
m_base_env_cfg.m_my_agent_cfg[i] = m_my_agent_cfg[i];
end
The critical step is to create the arrary of configs in the base_env_config class before assigning a handle to them.