In reply to smarconi:
As far as I see, set_type_override is just useful for modifying class task/functions behaviour, but variables (and for this reason also uvm_analysis_export/ports) cannot be referred.
This isn’t necessarily true. What you need to do in that case is use a cast statement:
class a_custom_env;
function void connect_phase(uvm_phase phase);
a_custom_ref_model custom_ref_model;
// I assume the ref model instance is called "ref_model")
if(!$cast(custom_ref_model, ref_model)
`uvm_fatal("CASTERR", "You forgot to set a type override on a_ref_model");
// same for the monitor
// ...
custom_monitor.aport2.connect(custom_ref_model.monitor3_export);
end
endclass
The reason you get the compile error is because, even though the instance is of type a_custom_ref_model, the compiler doesn’t know that. You have to tell it this using a cast statement. After telling it that you’re actually working with an instance of type “a_custom_ref_model”, you can access the new fields/functions/etc. defined in the extended class.