# Setting the Config from TOP module

**URL:** <https://verificationacademy.com/forums/t/setting-the-config-from-top-module/29239>\
**Category:** UVM\
**Tags:** UVM, config\_db\
**Created:** [March 11, 2014, 9:10am UTC](https://verificationacademy.com/forums/t/setting-the-config-from-top-module/29239 "2014-03-11T09:10:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauliksuthar123](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/34f0e0/32.png) [@mauliksuthar123](https://verificationacademy.com/forums/u/mauliksuthar123)\
**Post date:** [March 11, 2014, 9:10am UTC](https://verificationacademy.com/forums/t/setting-the-config-from-top-module/29239/1 "2014-03-11T09:10:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tfitz](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tfitz/32/3025_2.png) [@tfitz](https://verificationacademy.com/forums/u/tfitz)\
**Post date:** [March 11, 2014, 1:07pm UTC](https://verificationacademy.com/forums/t/setting-the-config-from-top-module/29239/2 "2014-03-11T13:07:42Z")

</div>

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

```verilog

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

```verilog
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](https://verificationacademy.com/cookbook/config/configuringsequences) for more details on that.

---

<div class="post-metadata">

**Author:** ![mauliksuthar123](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/34f0e0/32.png) [@mauliksuthar123](https://verificationacademy.com/forums/u/mauliksuthar123)\
**Post date:** [March 11, 2014, 1:49pm UTC](https://verificationacademy.com/forums/t/setting-the-config-from-top-module/29239/3 "2014-03-11T13:49:20Z")

</div>

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?
