Hello All,
Have a scenario where I wanted to create muti-level environment and wanted a cleaner/better way of sharing the configs using the uvm_config_db.
a. Say have a top level environment eatable_env and a top level environment configs say eatable_env_cfg.
b. The top level environment has multiple sub-level environments, say rice_env, fruits_env, etc. and each has their corresponding env configs like rice_env_cfg , fruits_env_cfg etc.
c. The top level eatable_env_cfg has the hooks for the sub level envs.
class eatable_env_cfg extends uvm_object;
rice_env_cfg rice_cfg;
fruits_env_cfg fruits_cfg;
endclass
d. And at each sub level env configs, have the required configs to control the environment creation, for eg:
class fruits_env_cfg;
rand uvm_active_passive_enum fruits_env_is_active = UVM_ACTIVE;
rand bit enable_fruits_scb;
rand bit num_fruit_agent;
...
endclass
e. So at the base test we create the top level eatable_env and the required eatable_env_cfg. So at the top level base test if I wanted to configure and access the leaf level variable one way is to hierarchical access them, for eg: to assign the interface.
for (int i = 0; i < eatable_cfg.fruits_cfg.num_fruit_agent; i++) begin
if (!uvm_config_db#(virtual eatable_fruit_apple_if)::get(this, "*", "eatable_fruit_apple_vif", eatable_fruit_apple_vif)) `uvm_error ("error...")
else eatable_cfg.fruits_cfg.apple_ecfg[i].eatable_fruit_apple_vif = eatable_Fruit_apple_vif;
end
f. So its like hierarchically can access the leaf level variables and do the configs or access for other purpose [eg:eatable_cfg.fruits_cfg.num_fruit_agent].
BUT, is there a better approach to use rather than hierarchically use/access them ? Like creating hooks/variables used in the leaf level at the top level configs and assign them values from the leaf level configs, so that i can do like eatable_cfg.num_fruit_agent ? rather than hierarchically access them ? OR any other better approach ? share your comments please ! Thanks !