Class constructor in OVM/UVM

Hi All,

I have a basic query about the class constructor in OVM/UVM:

I have a Psudeo code below to understand the query:

class a_component extends ovm_component;
  
  `ovm_component_utils(a_component)
  
  function new(string name = "a_component",ovm_component parent);
    super.new(name,parent);
  endfunction
endclass

class b_component extends ovm_component;
  
  `ovm_component_utils(b_component)
  
  function new(string name = "b_component",ovm_component parent = null);
    super.new(name,parent);
  endfunction
endclass

Here we have 2 OVM components a_component, b_component i have the below mentioned quires:

1 Why is that we are using super.new(name,parent) in both the component, is it that we are creating the hierarchy of the parent component? what is the necessity of doing this?
2. In the component b_inst we are declaring ovm_component parent = null, in this case as we are doing super.name(name,parent), what are we exactly doin here? what is the need of declaring the parent as null?

Thanks,
Nikhil

In reply to nchakravarthy:

Nikhil,
2 detailed posts for you to appreciate this:

HTH
Srini
www.verifworks.com