Function new constructor parent=null

what is the exact change in the uvm framework if we pass null at the constructor in function new ?

without null

class my_agent extends uvm_agent;

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

endclass

if we did the constructor without null the uvm topology for the agent will be like this

uvm_root
|
uvm_object
|
uvm_report_object
|
uvm_component
|
uvm_agent

if i make the difference with null (below mentioned ) . what will happen to the topology of uvm .
how i can see the change ? using any print or api is there to see the full topology of the component .

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

You seem to be confusing inheritance and hierarchy/topology.

The uvm_component class extends the uvm_report_object class, and the uvm_agent class extends the uvm_component class. An extended class inherits all the properties of the base class, and may or may not add additional elements.

The ‘parent’ argument provided to the constructor of a uvm_agent class has nothing to do with the uvm_agent inheritance. What it does do is place the agent within the topology of the testbench environment. The typical environment topology starts with a uvm_test component at the top, with typically an environment below it, and then one or more agents. When the environment creates the agents, it will specify itself as the agent’s parent.

The topology is traversed when running all of the phases in the UVM.

This is clear for me now . if we pass null at the create method then the hierarchy/topology will change right ?

inside the env i am creating the agent with null .

class env extends uvm_env;

my_agent my_agent_h;

// build_phase
my_agent_h=my_agent::type_id::create(“my_agent_h”,null); // instead of this using null .

endclass

this will change the topology for the uvm_agent right ? now as per my understanding uvm_agent is the child of uvm_component if we pass this . if we pass null uvm_agent become the child of uvm_root . please tell me if i am wrong .

The parent argument of create() sets the location of the component in the testbench topology. You can use the uvm_top.print_topology() to see the completed topology.

This argument can also be used as the context for instance specific factory overrides.

print_topology is showing the topology from the test only . is that any way to see the full uvm_toplogy from starting from uvm_object.

“topology” is for “has-a” relationships. uvm_component is the only UVM base class that creates a database that can traverse that.

If you are looking to see inheritance hierachy (“is-a” relationships), you need a debugging tool like Questa Visualizer to see that.