How to override uvm_object from test

I have multiple agents in my env ,all of the same type ,AXI slave.

class my_env extends uvm_env;

axi_slave agent_A;
axi_slave agent_B;
axi_slave agent_C;


In the base_sequence,which is common for all the agents, I have an object,read_q_manager, extended from uvm_object.I want to override the read_q_manager definition for only agent_A.
I defined another class extending read_q_manager:

class my_read_q_manager extends read_q_manger;



In my test build phase, I’m trying to override read_q_manager with my_read_q_manager:

class my_test extends my_base_test;
slave_sequence seq_A;
slave_sequence seq_B;
slave_sequence seq_C;

function void build_phase(uvm_phase phase);



When I use set_type_override, it overrides for all the agents ie., in seq_A,seq_B and seq_C.
But,I want only for seq_A.
set_inst_override doesnt override at all.Probably because its a uvm_object and cannot be referenced through hierarchical path.
How can I override this object? I cannot modify the creation of read_q_manager object in slave_sequence as it is an external VIP

The set_inst_override method is set_inst_override(string relative_inst_path
string orignal_type_name,
string override_type_name);
so you can try it again!

In reply to kartavya:

I think you are saying that read_q_manager is instanced in slave_sequence and you want to override it for only one instance.

In that case you should give full path to “read_q_manager” instance. ie: seq_A.inst_name

I am not sure whether there is any way to override all instances only blow certain hierarchy.

In reply to Naven8:

The full hier path for the “read_q_manager” instance is seq_A.get_full_name().inst_name ?

In reply to yaohe:

I don’t think that the uvm override method can override the uvm_object, I just know it can override the uvm_component type or instance,
and I think the get_full_name() just apply to uvm_component, because only the uvm_componnet has the hierarchical name, if you use uvm_object.get_full_name just
get the name you give when you create.
I think it’s a good way by using uvm_callback taking the place of overided uvm_object!

I have overridden uvm_objects by instanceby using the path of the component instantiating the object and a wildcard as a path (not sure if the wildcard is really required).

Something like if I remember correctly:

  read_q_manger::get_type(), my_read_q_manager::get_type());

This should override any read_q_managers instantianted under agent A with my_read_q_managers.

In reply to Tudor Timi:

if the override type is uvm_object, you should use one of below methods

  1. read_q_manager::type_id::set_inst_override(my_read_q_manager::get_type,“full_inst_path”);
  2. factory.set_inst_override_by_type(read_q_manager::get_type, my_read_q_manager::get_type, “full_inst_path”);

In reply to haitao73:

There cannot be any instance path for uvm_object, as an uvm_object doesnt have any parent.Only components can have hierarchical path

In reply to kartavya:


There is a way to override a particular instance of the uvm_object given that you update the creation of that object by having some dummy path and using the same dummy path while doing set_inst_override. But you said, you can’t update the external VIP.

Did you try any of the following methods suggested by “haitao73” & “tudor.timi” above?
So how did you solve this? Just curious to know the solution for this.

In reply to S.P.Rajkumar.V:

Try this one


here env is object of my_env. You have to give path of the component in which your object is created and then put wildcard(.*)