In reply to mseyunni:
Hi Madhu,
Sorry for the delay. In answer to your questions, yes I put a copy of or handle to the config object in agent sequencers and in the top-level environment virtual sequencer. Since sequencers are part of the “static” hierarchy, in their build_phase I usually have something like:
if( !uvm_config_db#(my_config_class)::get(this, "*", "config", m_config)) begin
`uvm_fatal("CONFIG", "Failed to fetch config object from ConfigDB");
end
For agents, the config object would normally be created and put into the ConfigDB by the environment (in it’s build_phase). For the environment, it’s config object would be created and inserted into the ConfigDB during the build_phase of the test (which creates and instances the environment). These would look something like:
In environment build_phase:
my_agent_config=my_agent_config_class::type_id::create("my_agent_config");
uvm_config_db#(my_agent_config_class)::set(this,"my_agent*","config",my_agent_config);
my_agent=my_agent_class::type_id::create("my_agent", this);
In test build_phase:
my_env_config=my_env_config_class::type_id::create("my_env_config");
uvm_config_db#(my_env_config_class)::set(this,"my_env*","config",my_env_config);
my_env=my_env_class::type_id::create("my_env", this);
Inside sequence running on an agent:
my_agent_config m_config = p_sequencer.m_config;
Inside virtual sequence running on virtual sequencer:
m_env_config = p_sequencer.m_config;
You could, of course, create different config objects (of different types) that might be required by specific sequences and put them into the ConfigDB in the same way.
Another way is to have sequences pick up the hierarchical path to their sequencer and pull config objects out of the ConfigDB directly - this is detailed at Config/ConfiguringSequences | Verification Academy.
However, since multiple sequences will be created many times in a test, and since ConfigDB access is quite slow, I prefer to put them into the sequencer and get the sequences to use them directly from there. There is a slight loss of flexibility perhaps, but I generally find sequences of a particular type tend to be tied to the same sequencer type each time so I’ve never had a problem yet.
Hope that helps.
James