# Is it valid to pass uvm\_component parameter while creating instance of a sequence?

**URL:** <https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616>\
**Category:** UVM\
**Tags:** seq, uvm\_sequence\
**Created:** [March 28, 2024, 8:40pm UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616 "2024-03-28T20:40:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/b4bc9f/32.png) [@rajt](https://verificationacademy.com/forums/u/rajt)\
**Post date:** [March 28, 2024, 8:40pm UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/1 "2024-03-28T20:40:21Z")

</div>

Hi,

In our code base, when creating an instance of a sequence inside an environment, we pass two parameters to create() which are string name and parent. But I don’t understand the reasoning behind it and also UVM doesn’t complain about it.

Here is an example code:

```auto
class test_magic_seq_c extends uvm_sequence#(magic_word);

class magic_env_c extends uvm_env;

test_magic_seq_c test_magic_seq;
test_magic_seq = test_magic_seq_c::type_id::create("test_magic_seq", this);

endclass: magic_env

```

I would appreciate if someone can provide me a reason how this is valid as sequence is uvm\_object.

Thanks in advance.

---

<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:** [March 29, 2024, 12:16am UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/2 "2024-03-29T00:16:49Z")

</div>

The name gets used for reporting and debugging. If this sequence creates sub-sequences, it creates a pathname similar to call stack.

The parent get used as a context for controlling factory overrides.

---

<div class="post-metadata">

**Author:** ![rajt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/b4bc9f/32.png) [@rajt](https://verificationacademy.com/forums/u/rajt)\
**Post date:** [March 29, 2024, 4:32pm UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/3 "2024-03-29T16:32:09Z")

</div>

Could you please elaborate on this as generally ‘parent’ is passed for uvm\_component and not for uvm\_object. Also, as sequence class gets extended from uvm\_object, why do we pass parent when creating a sequence. (constructor of uvm\_object/uvm\_sequence class also has a single parameter of ‘name’)

```auto
function new (	string name = "uvm_sequence"	)

```

Is it that if we don’t pass parent parameter, it’s not possible to instance override?

Appreciate your response!

---

<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:** [March 29, 2024, 6:25pm UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/4 "2024-03-29T18:25:24Z")

</div>

> [@rajt](#):
>
> Is it that if we don’t pass parent parameter, it’s not possible to instance override?

Correct. You will only be able to factory override the sequence by type.

---

<div class="post-metadata">

**Author:** ![rajt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/b4bc9f/32.png) [@rajt](https://verificationacademy.com/forums/u/rajt)\
**Post date:** [March 29, 2024, 7:14pm UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/5 "2024-03-29T19:14:09Z")

</div>

Thanks Dave!

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [March 29, 2024, 8:04pm UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/6 "2024-03-29T20:04:46Z")

</div>

Hi Dave ,

> [@dave\_59](#):
>
> > [@rajt](#):
> >
> > Is it that **if we don’t pass parent parameter, it’s not possible to instance override?**
> 
> Correct. You will only be able to factory override the sequence by type.

**Isn’t this partially true ?**  
As we discussed in [thread](https://verificationacademy.com/forums/t/significance-of-contxt-argument-for-create-functions-of-uvm-component-registry-n-uvm-object-registry/38719) the 3rd argument ‘contxt’ to create function also enables instance override for both uvm\_object and uvm\_components **irrespective of whether an actual was passed to 2nd argument ‘parent’ of type uvm\_component.**  
From what I am able to recollect from all examples that I have tried in the past,  
**if all 3 arguments are passed to create , the ‘contxt’ argument takes precedence over ‘parent’ and the instance override should be set using the ‘contxt’ argument.**  
I found a [blog](https://sagar5258.blogspot.com/2016/04/override-in-uvm-using-factory.html) which has examples of instance override using ‘contxt’ argument and without passing an actual to parent argument.

---

<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:** [March 30, 2024, 1:10am UTC](https://verificationacademy.com/forums/t/is-it-valid-to-pass-uvm-component-parameter-while-creating-instance-of-a-sequence/46616/7 "2024-03-30T01:10:58Z")

</div>

Yes, I forgot about the third argument. The context is ultimately just a string name.
