UVM component parent = null

Hi All,

Can someone please answer what mean by “uvm_component parent = null” in below snippet of code?
What could be the other possible assignment except “null”?

function new (string name = “count_drv”, uvm_component parent = null); super.new(name, parent); endfunction


Thanks,
Harshad

In reply to Harshad:

See if this thread answers your question: Difference Between UVM_OBJECT and UVM_COMPONENT | Verification Academy

In reply to Harshad:

Hi Harshad,
Here from your question, this is constructor method for new derived class property from parent class. This process is called factory registration.
If you place component then depending on component, in constructor method you have to place two argument one string other parent as you place component from parent class. string name as class (derived) name and component as parent. In super new method same argument should be supply!
If you use transaction object then it should be one argument in method.

Regards,
Amrish

In reply to Amrish Kaklottar:

In reply to Harshad:
Hi Harshad,
Here from your question, this is constructor method for new derived class property from parent class. This process is called factory registration.
If you place component then depending on component, in constructor method you have to place two argument one string other parent as you place component from parent class. string name as class (derived) name and component as parent. In super new method same argument should be supply!
If you use transaction object then it should be one argument in method.
Regards,
Amrish

Thanks Amrish but i didn’t undergrad what “uvm_component parent = null” is exactly mean ?

In reply to Harshad:

In reply to Amrish Kaklottar:
Thanks Amrish but i didn’t undergrad what “uvm_component parent = null” is exactly mean ?

In TB infrastructure, all the components like agent, sequencer, driver, monitor, etc. are created and all are child from uvm_component (parent).
In case of sequence like sequence_item, transaction, etc all object are created those are uvm_object

In reply to Harshad:

I think we may be misunderstanding the point of your question. Is it specifically what the ‘=null’ is for? If so, specifying a default argument value means that argument is option when calling new().

Instead of writing:

mycomponent c = new("c", null);

you can write:

mycomponent c = new("c");

This is useful in some places where the code is unaware if they are creating a uvm_object which only requires the one “name” argument, or a uvm_component which has two arguments. For uvm_component, a null parent argument just means the component has no parent, it is at the top-level of the hierarchy. There is no other meaningful default for the class uvm_component.