# Passing parameters from test\_params\_pkg to driver

**URL:** <https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151>\
**Category:** UVM\
**Tags:** UVM, Parameters, uvm\_config\_db, constants\
**Created:** [October 8, 2018, 12:21pm UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151 "2018-10-08T12:21:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fipser](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@Fipser](https://verificationacademy.com/forums/u/Fipser)\
**Post date:** [October 8, 2018, 12:21pm UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/1 "2018-10-08T12:21:42Z")

</div>

Hello,

I have a test parameters package containing constants derived from parameters such as clock frequencies.  
I intend to use these constants within a driver. What is the recommended way to do that?

1. Directly import the test parameters package in the driver class?
2. Put the constants into uvm\_config\_db -set()- and read them within the driver class -get()-?
3. ?

Kind regards  
P.S.

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [October 8, 2018, 3:28pm UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/2 "2018-10-08T15:28:08Z")

</div>

_In reply to [Fipser@VA](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151):_

Your agent (and driver) should have a configuration object that contains all the parameters regarding the functionality of the agent. You should create this configuration at the test level, set the parameters as required, store it in the config\_db(), and retrieve it in the agent during the build() phase.

---

<div class="post-metadata">

**Author:** ![Fipser](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@Fipser](https://verificationacademy.com/forums/u/Fipser)\
**Post date:** [October 8, 2018, 3:56pm UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/3 "2018-10-08T15:56:58Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/2):_

> _In reply to [Fipser@VA](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/2):_  
> Your agent (and driver) should have a configuration object that contains all the parameters regarding the functionality of the agent. You should create this configuration at the test level, set the parameters as required, store it in the config\_db(), and retrieve it in the agent during the build() phase.

Thanks for your reply. Yes, I have the configuration objects set up as described in the cookbook, and they also get created at the test level (in the test base class xxx\_test\_base.svh) and retrieved in the agent’s build phase (as you described).  
The thing is that these constants/parameters I need to access in the driver are mainly used as DUT generics. So the test\_params\_pkg is imported into the top lvl testbench module, and that’s it. But from a hierarchical point of view, of course I do not have access to these constants/parameters as components/classes are included bottoms up (and the driver being at the lowest level).  
Do I still have to pass these constants/parameters via the configuration object now? I’m not sure at the moment how to achieve this.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [October 8, 2018, 4:06pm UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/4 "2018-10-08T16:06:57Z")

</div>

_In reply to [Fipser@VA](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/3):_

That’s a different situation. If you have parameters you want to be used by both DUT and testbench, the common package is the way to go. The config\_db is for per-test parameterization.

---

<div class="post-metadata">

**Author:** ![Fipser](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@Fipser](https://verificationacademy.com/forums/u/Fipser)\
**Post date:** [October 10, 2018, 8:36am UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/5 "2018-10-10T08:36:47Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/4):_

> _In reply to [Fipser@VA](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/4):_  
> That’s a different situation. If you have parameters you want to be used by both DUT and testbench, the common package is the way to go. The config\_db is for per-test parameterization.

Thanks for the clarification. So in order to be able to access the package from both the driver side and for the DUT generics I will have to import it at driver level (the corresponding agent package) as well? Meaning I have to push the test\_params\_pkg compilation to the front of the compilation order.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [October 10, 2018, 2:57pm UTC](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/6 "2018-10-10T14:57:03Z")

</div>

_In reply to [Fipser@VA](https://verificationacademy.com/forums/t/passing-parameters-from-test-params-pkg-to-driver/35151/5):_

Correct. Packages must be compiled before they can be imported.
