In reply to cgales:
Hello @cgales,
Thanks for going over the post and responding back.
-
Have like a two way mechanism, i.e. top_env_cfg gets created in the top_test, it also creates the block_env_cfgs. So, when the block_env_cfg gets created, during the new process I check if there is any “num_agts” being set via the config_db else it uses a default value using `NUM_AGTS set in the defines.
-
After getting the default value of num_agts while it gets created, I also call a function which configures the num_agts, then the agent_cfgs and its default setup on the fly. Code excerpts as given below.
class block_env_configuration;
...
function new();
...
if (!uvm_config_db#(int)::get(null, get_full_name(), "num_agt", num_agt))
begin
num_agt = `NUM_AGT;
`uvm_info($psprintf("%s_WARNING", get_type_name()), $psprintf("num_agt setting is not found in config_db! Setting default value of %0d\n", num_agt), UVM_HIGH);
end
...
// calling agt setup
cfg_agts(num_agt);
endfunction: new
function cfg_agts(num_agt);
blk_agt_cfg = new[num_agt];
...
endfunction: cfg_agts
...
endclass: block_env_configuration
- So that way, either the user can set the num_agts via config_db before the block_env_cfg is created or they can set the num_agts via the defines Or else, they can specifically call the cfg_agts function to set the num_agts and configure.
block_env_cfg.cfg_agts(2);
- Say if the block_env is being used at multiple places [i.e. within multiple sub_envs], then I can set different values via the config_db to the particular block_env_cfg instead of calling the function cfg_agts. That’s the reason why I was trying to get the num_agts via config_db.
But your recommendation is to individually set the variables in the test and configure them right? Let me know which would be the best way. Thanks again !