# uvm\_config\_db#(T)::set(,string inst,,) string argument context with respect to new/create name argument

**URL:** <https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305>\
**Category:** UVM\
**Tags:** UVM, uvm-uvm\_config\_db\
**Created:** [April 23, 2022, 1:28pm UTC](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305 "2022-04-23T13:28:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkpatel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@jkpatel](https://verificationacademy.com/forums/u/jkpatel)\
**Post date:** [April 23, 2022, 1:28pm UTC](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305/1 "2022-04-23T13:28:00Z")

</div>

_uvm\_config\_db#(T)::set(top.env,"agent",“var”,var)_\*

Above line decides scope of getting var at anywhere inside agent and any sub instances of agents.

Let’s say by mistakenly we have used different string while creating agent like below in env

**agent = AGENT :: type\_id :: create(“myagent”,this);**

So the name “agent” mentioned in the scope also has to be updated to myagent or it will take as per instance name and not the argument passed ?

I actually got this doubt mainly due to first argument is of type uvm\_component context and second is of string. And I also understand it will concatenate both to decide scope.

Please clarify.

---

<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:** [April 23, 2022, 3:36pm UTC](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305/2 "2022-04-23T15:36:23Z")

</div>

_In reply to [jkpatel](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305):_

This line  
agent = AGENT :: type\_id :: create(“myagent”,this);  
is really bad coding style, because it makes the debugging totally complicated. You’ll use the object name ‘agent’ but relly it takes ‘myagent’.  
With respect to the scope you are right, but it is does not follow a good coding practice.  
In most of all cases you are using as the 1st argument in the set/get command #null’ or ‘this’. If you are using null the path defined in the 2nd argument is considered as an absolute path. If you are using ‘this’ the path is considered a a realtive path, starting from the actual object.

---

<div class="post-metadata">

**Author:** ![jkpatel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@jkpatel](https://verificationacademy.com/forums/u/jkpatel)\
**Post date:** [April 23, 2022, 6:04pm UTC](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305/3 "2022-04-23T18:04:13Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305/2):_

Thanks , I understand it is bad practice and must be avoided but this is just to understand hierarchical way of how scope will get it’s details.

so, which scope will be taken from below 2.

scope1 : top.env.agent  
scope2 : top.env.myagent

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:** [April 24, 2022, 9:18am UTC](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305/4 "2022-04-24T09:18:42Z")

</div>

_In reply to [jkpatel](https://verificationacademy.com/forums/t/uvm-config-db-t-set-string-inst-string-argument-context-with-respect-to-new-create-name-argument/40305/3):_

It uses scope 2:

```verilog
top.env.myagent

```
