//Set with null context and "*" visible everywhere
uvm_config_db #(rx_agent_config)::set(null, "*", "db_rx_agent_config", m_rx_cfg)
//If you have delta delay/finite amount of delay before setting
//the config obj
//Wait till configuration object is modified by agent
//use null context again for module
uvm_config_db #(rx_agent_config)::wait_modified(null, "*", "db_rx_agent_config")
void'(uvm_config_db #(rx_agent_config)::get(null, "", "db_rx_agent_config", m_rx_cfg))
//Alternate way is to use small delay before getting the
//object in module initial block
initial
begin
#1;
if(!uvm_config_db #(rx_agent_config)::get(null, "", "db_rx_agent_config", m_rx_cfg))
`uvm_error("top", "rx_agent_config not found")
end
I set the rx_agent_config in the env. It should be with this, not null.
Regarding
//Alternate way is to use small delay before getting the
//object in module initial block
initial
begin
#1;
if(!uvm_config_db #(rx_agent_config)::get(this, "", "db_rx_agent_config", m_rx_cfg))
`uvm_error("top", "rx_agent_config not found")
end
// tx_fe forces and assignments
assign tx_vif.cyc_tic = dut.tx_fe.cyc_tic_internal;
initial begin
start_of_simulation_ph.wait_for_state(UVM_PHASE_STARTED);
if(!uvm_config_db #(tx_agent_config)::get(null, "uvm_test_top.env", "db_tx_agent_config", m_tx_cfg)) begin
`uvm_error("top", "tx_agent_config not found")
end//if
if (m_tx_cfg.is_active == UVM_ACTIVE) begin
force dut.tx_fe.xi_n = tx_vif.xi;
force dut.tx_fe.xq_n = tx_vif.xq;
end
end
// rx_fe forces and assignments
assign rx_vif.chind2 = dut.rx_fe.chind2;
initial begin
start_of_simulation_ph.wait_for_state(UVM_PHASE_STARTED);
if(!uvm_config_db #(rx_agent_config)::get(null, "uvm_test_top.env", "db_rx_agent_config", m_rx_cfg)) begin
`uvm_error("top", "rx_agent_config not found")
end//if
if (m_rx_cfg.is_active == UVM_ACTIVE) begin
force dut.rx_fe.x = rx_vif.x;
end
end
I got error when I try to run this:
UVM_ERROR …/sv/girobo2_tb_top.sv(175) @ 0: reporter [top] rx_agent_config not found
This is correct. You are in the top-level module of your UVM testbench. This module does not know anything about the path uvm_test_top.env.
Please try
get(null, “”, “db_rx_agent_config”, m_rx_cfg)
In reply to saritr:
You have to wait for certain time before issuing the get:
initial
begin #1;
if(!uvm_config_db #(rx_agent_config)::get(null, “”, “db_rx_agent_config”, m_rx_cfg))
`uvm_error(“top”, “rx_agent_config not found”)
end
For any beginners out there reading this thread, if you change code, then you need show what changes have been made. One can not debug code without seeing it. In this posting, one would have to see the current set & get lines of code and the error that they generated to determine why they are not working - this should be common sense for all UVM users. If you are unable to ‘get’, maybe the context & inst_name in ‘set’ are not correct (the poster says that they used ‘this’ as the context which would be incorrect, Mayur correctly posted how to use the ‘set’ in this case). It’s hard to tell if the user followed this suggestion without the code.
So the combination of this and “" means that all the objects which down in the hirerachy (down to env in my case) will “know” the config object, whereas the combination of null and "” means that all objects (up and down in the hirerachy)will “know” the config object?
this post has a link to a verilabs paper on the uvm_config_db. I would recommend reading it. For the ‘set’ method, ‘this’ is the starting point of accessibility, not the end.
In reply to chr_sue:
So the combination of this and “" means that all the objects which down in the hirerachy (down to env in my case) will “know” the config object, whereas the combination of null and "” means that all objects (up and down in the hirerachy)will “know” the config object?
Yes. That’s the intention.
If error persists there might be two reasons,
config_db get is being called before setting is done.