How to get config object from config db to the tb_top

In reply to saritr:

Hi saritr,

Inside testbench environment/agent component it is required to set configuration object as

uvm_config_db #(rx_agent_config)::set(null, “", “db_rx_agent_config”, m_cfg.m_rx_agent_cfg);
–>Context argument is set to null and instance name is set to "

Which makes configuration object available to entire TB hierarchy starting from TOP module.

For getting this object inside TOP it is required to use,

// rx_fe forces and assignments
rx_config_c m_rx_cfg;
assign rx_vif.chinl2 = dut.rx_fe.child2;
initial begin
start_of_simulation_ph.wait_for_state(UVM_PHASE_STARTED);
#1;
if(!uvm_config_db #(rx_agent_config)::get(null, “”, “db_rx_agent_config”, m_rx_cfg))
begin
`uvm_fatal(“top”, “rx_agent_config not found”)
end
else begin
if (m_rx_cfg.is_active == UVM_ACTIVE)
force dut.rx_fe.x = rx_vif.x;
end
end

Please make a note of #1 delay inside initial procedural block.
Delay is required as Environment/Agent Component will set config_object in its build_phase
and for all TB components hierarchy build_phase gets executed in Top to Down order.