# Get uvm\_config\_db from uvm\_sequence\_item

**URL:** <https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342>\
**Category:** UVM\
**Tags:** uvm-agent, UVM, uvm-config\_db, uvm\_sequence\_item, uvm\_config\_db-get\
**Created:** [November 13, 2020, 12:56pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342 "2020-11-13T12:56:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doron\_Salama](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9d8465/32.png) [@Doron\_Salama](https://verificationacademy.com/forums/u/Doron_Salama)\
**Post date:** [November 13, 2020, 12:56pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/1 "2020-11-13T12:56:12Z")

</div>

Hi All,

I have to pass a variable from the ENV via uvm\_config\_db to an agent’s item(uvm\_sequence\_item).  
Since the item is a uvm\_object, when i am using the uvm\_config\_db get\_method i got the following error:  
_“Illegal assignment to class mtiUvm.uvm\_pkg::uvm\_component”_

can you please advise, how can I properly get the variable.

Regards,  
David.

---

<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:** [November 13, 2020, 2:03pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/2 "2020-11-13T14:03:12Z")

</div>

_In reply to [D\_S](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342):_

It looks like one of the variables involved is extended from a uvm\_component. Please post the relevant code so someone can provide further guidance.

---

<div class="post-metadata">

**Author:** ![logie](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/74df32/32.png) [@logie](https://verificationacademy.com/forums/u/logie)\
**Post date:** [November 14, 2020, 9:42am UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/3 "2020-11-14T09:42:07Z")

</div>

Difficult to say without looking at the code… but you may want to check if you are trying to use a variable derived from uvm\_component to retrieve a uvm\_sequence\_item. from the config db.

---

<div class="post-metadata">

**Author:** ![Doron\_Salama](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9d8465/32.png) [@Doron\_Salama](https://verificationacademy.com/forums/u/Doron_Salama)\
**Post date:** [November 14, 2020, 4:28pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/4 "2020-11-14T16:28:29Z")

</div>

Actually, I am trying to get the agent config class. which is set by the environment.

uvm\_config\_db #(axi4\_agt\_config#(DATA\_WIDTH, USER\_WIDTH, ID\_WIDTH, DEST\_WIDTH))::get(this, “”, “AXI4\_AGNT\_CONFIG”, m\_cfg))

Thanks,

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [November 14, 2020, 5:35pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/5 "2020-11-14T17:35:19Z")

</div>

_In reply to [D\_S](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/4):_

And how does your set command look like?

---

<div class="post-metadata">

**Author:** ![Doron\_Salama](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9d8465/32.png) [@Doron\_Salama](https://verificationacademy.com/forums/u/Doron_Salama)\
**Post date:** [November 14, 2020, 7:56pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/6 "2020-11-14T19:56:24Z")

</div>

**Set from env class: (for multi agent instances)**

uvm\_config\_db #(axi4\_agent\_config#(.DATA\_WIDTH(DATA\_WIDTH), .USER\_WIDTH(2), .ID\_WIDTH(0), .DEST\_WIDTH(0)) )::set(this, “axi\_agent\_num\_1\*”, “AXI4\_STREAM\_CONFIG”, m\_config.m\_axi4\_stream\_data\_in\_1\_config);

**in the agent item** (using typdef)

typedef axi4\_agent\_config;

class axi4\_agent\_item#(uint DATA\_WIDTH = 32, uint USER\_WIDTH = 32, uint ID\_WIDTH = 4, uint DEST\_WIDTH = 32) extends uvm\_sequence\_item;  
.  
.  
.  
axi4\_agent\_config#(DATA\_WIDTH, USER\_WIDTH, ID\_WIDTH, DEST\_WIDTH) m\_cfg;  
.  
.  
.  
uvm\_config\_db #(axi4\_agent\_config#(DATA\_WIDTH, USER\_WIDTH, ID\_WIDTH, DEST\_WIDTH))::get(this, “”, “AXI4\_AGENT\_CONFIG”, m\_cfg))

**And the error from the simulator:**  
\*\* Error: (vsim-7065) Illegal assignment to class mtiUvm.uvm\_pkg::uvm\_component from class tb\_lib.axi4\_agent\_uvc\_pkg::axi4\_agent\_item #(32, 2, 0, 0)

# \*\* Error: (vsim-8754) Actual input arg. of type ‘class tb\_lib.axi4\_stream\_uvc\_pkg::axi4\_agent\_item #(32, 2, 0, 0)’ for formal ‘cntxt’ of ‘get’ is not compatible with the formal’s type ‘class mtiUvm.uvm\_pkg::uvm\_component’.

I used typedef since in compilation the simulator doesn’t recognize the env config class.  
and some issue since it’s a parametrized anent

thank you for the help

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [November 15, 2020, 8:08am UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/7 "2020-11-15T08:08:49Z")

</div>

_In reply to [D\_S](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/6):_

In the set command you are restricting the usage of your config to your agent (axi\_agent\_num\_1\*).  
But the seqauence is not the agent. Please try to use a wildcard instead.  
And something is wrong with your forward typedef.  
It should be

```verilog
typedef class axi4_agent_config;

```

---

<div class="post-metadata">

**Author:** ![abhishek.khule.seagate.com](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@abhishek.khule.seagate.com](https://verificationacademy.com/forums/u/abhishek.khule.seagate.com)\
**Post date:** [November 16, 2020, 7:10pm UTC](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/8 "2020-11-16T19:10:57Z")

</div>

_In reply to [D\_S](https://verificationacademy.com/forums/t/get-uvm-config-db-from-uvm-sequence-item/38342/7):_

Hi David,

I see few error in you code:

1. In the get method you cannot use ::get(this,…). Since the config\_db get method expects a component instance here. You are using get method in object\_class so you can mention null here.

You can first try sending a value and then try with class. Following is an example:

```verilog

//env class
int count;
uvm_config_db #(int)::set(this, "*", "count", 4);

// seq class

int repeat_count;

//inside body task

uvm_config_db #(int)::get(get_sequencer(), "", "count", repeat_count);

```
