# Can I use config\_db set() in a sequence\_item

**URL:** <https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080>\
**Category:** UVM\
**Tags:** UVM, uvm-config\_db, UVM-Coverage-configuration-object\
**Created:** [September 15, 2020, 4:19pm UTC](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080 "2020-09-15T16:19:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariam\_triki](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/mariam_triki/32/2528_2.png) [@mariam\_triki](https://verificationacademy.com/forums/u/mariam_triki)\
**Post date:** [September 15, 2020, 4:19pm UTC](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/1 "2020-09-15T16:19:29Z")

</div>

Hi all ,  
I have a situation where the configuration of my environment depends on the packet:  
Let’s say in my header I have a field of 3 bits if the value of that field vary from 0 to 5 we will work in REVERTED mode ( the environment should be in REVERTED mode)  
and if the said field is from (5 to 7) the environment should be in NORMAL mode.  
I am trying to randomize the field of my packet so I was thinking to set a variable “env\_mode” in the body phase of my packet then use the get method in the top environment.  
However, the environment is only set once and even if we change the header field the configuration of the environment won’t change.  
To be honest I was not so eager to use the config\_db set method : since the seq\_item is a dynamic object I am not sure if it can set things in the config\_db.  
So my question is it possible to use the config\_db set method in the seq\_item ? is it possible to change the config of my env from the seq\_item ?

---

<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:** [September 15, 2020, 4:23pm UTC](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/2 "2020-09-15T16:23:10Z")

</div>

_In reply to [mariam triki](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080):_

See [Config/ConfiguringSequences | Verification Academy](https://verificationacademy.com/cookbook/config/configuringsequences)

---

<div class="post-metadata">

**Author:** ![VE1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/54ee81/32.png) [@VE1](https://verificationacademy.com/forums/u/VE1)\
**Post date:** [September 15, 2020, 5:15pm UTC](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/3 "2020-09-15T17:15:47Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/2):_

> _In reply to [mariam triki](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/2):_  
> See [Configuring Sequences | UVM Cookbook](https://verificationacademy.com/cookbook/config/configuringsequences)

Hi Dave.  
In the link, you used main\_phase() instead of run\_phase(), what is your recommendation of sub-task phases or using run\_phase() for UVM IEEE ?

Thanks

---

<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:** [September 15, 2020, 5:45pm UTC](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/4 "2020-09-15T17:45:11Z")

</div>

_In reply to [VE](https://verificationacademy.com/forums/t/can-i-use-config-db-set-in-a-sequence-item/38080/3):_

We continue recommending the run\_phase() over any of the sub-task phases. In this case it’s irrelevant to the example which is probably why it wasn’t caught.
