Wait_modified is working only in main_phase()?

Hi,
My requirement is when driver sets a variable(num3), testcase has to get the updated value.
I have used wait_modified() in testcase to wait for the update on the variable num3 and get it using get method.

a) I am setting the variable (int num3) in driver, using uvm_config_db#(int):set(this,"", "num3", 500); inside run_phase();
b)  I am waiting for "num3" update in testcase (in run_phase()) using
    uvm_config_db#(int)::wait_modified(this,"env_h.agent_h.driver_h", "num3");
    uvm_config_db#(int)::get(this,"env_h.agent_h.driver_h", "num3", num3);

   Result: Test is hanging i.e it is waiting for the variable to get updated.

   But if i use the same code in main_phase() it is working fine, i am getting the updated variable in testcase.

can i kow what is the reason…? why it is working in main_phase() not in run_phase().

Without seeing any of your source code, I would venture to say that you have a race condition causing this problem which doesn’t appear when using the main_phase() in your test. This is because run_phase() will execute before the main_phase().

The config_db is not really designed to be used as a blocking mechanism to control test execution. You should be utilizing sequences to do this. Is there a specific reason you are doing this?

Thanks for your reply,
In both run_phase() and main_phase() i am calling at the start of the phase only, but it is working only in main_phase().

From sequence to test it is working fine in run_phase() also.

To add one more question to my previous one is…

From main_phase()…

a) I am setting the variable (int num3) in driver, using uvm_config_db#(int):set(this,“”, “num3”, 500); inside main_phase();
b) I am waiting for “num3” update in testcase (in main_phase()) using
uvm_config_db#(int)::wait_modified(this,“env_h.agent_h.driver_h”, “num3”);
uvm_config_db#(int)::get(this,“env_h.agent_h.driver_h”, “num3”, num3);

If use the inst path like above i.e complete hierarchical path… i am able to get the variable…

else if i use wildcards… i am not getting the variable update:

uvm_config_db#(int)::wait_modified(this,“.driver_h", “num3”);
uvm_config_db#(int)::get(this,"
.driver_h”, “num3”, num3);