UVM Instance override for UVM objects

*In reply to rag123:*A couple of problems with your code.

When calling
trans = transaction::type_id::create(“trans”);
with just one argument, there is no context for an instance override. You can provide a context by adding second argument this, which uses the current components path, or provide a third argument which defines an absolute path string.

In your base_test, you call set_inst_override_by_type(), which is a method of uvm_component. It is expecting to see a relative path from the current component, and the top level test is always "uvm_test_top.

So you need to coordinate your overrides by whether you want to be setting instances overrides using the existing testbench hierarchy, or some arbitrary path names

Using existing hierarchy:

trans = transaction::type_id::create("trans",this);
...
set_inst_override_by_type ("env.trans",transaction::get_type(),extended_transaction::get_type());

Using absolute path strings:

trans = transaction::type_id::create("trans",,"hola");
...
transaction::type_id::set_inst_override(extended_transaction::get_type(),"hola.trans");

1 Like