Setting the Config from TOP module

Hello, I want to set a certain variables in test which control my sequence behavior when the test is executed. Now if i want to configure that variables from top module using the config_db how can i do that?

The path to the top of your UVM hierarchy is always “uvm_test_top” so you can pass information into UVM from the top-level module, you’d do something like


uvm_config_db #(<type>)::set(null, “uvm_test_top”, “name”, var);

The easiest thing is to create a configuration object that will contain all the variables you want to set. Then your test can get the object

if(!uvm_config_db #(my_config_obj_t)::get(this, “”, “cfg”, cfg))     
  begin `uvm_error(…) end

After that, you can pass the appropriate variables from the config object down into your sequence. See the Cookbook for more details on that.

Yes sir, i did exactly like that but the point is i have to change the top_module everytime whenever i need to change the variable value. so for that i will need to recompile the module again and again.

is there any way in which i can extend my base test which supplies all the config info and change it?