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.