// check that type is registered with the factoryif(override_type==null)beginuvm_report_error("TYPNTF",{"Cannot register override for original type '",original_type_name,"' because the override type '",override_type_name,"' is not registered with the factory."},UVM_NONE);return;end// check that old and new are not the sameif(original_type_name==override_type_name)beginuvm_report_warning("TYPDUP",{"Requested and actual type name "," arguments are identical: ",original_type_name,". Ignoring this override."},UVM_NONE);return;endforeach(m_type_overrides[index])beginif(m_type_overrides[index].orig_type_name==original_type_name)beginif(!replace)begin
// check that type is registered with the factoryif(override_type==null)beginuvm_report_error("TYPNTF",{"Cannot register instance override with type name '",original_type_name,"' and instance path '",full_inst_path,"' because the type it's supposed ","to produce, '",override_type_name,"', is not registered with the factory."},UVM_NONE);return;endif(original_type==null)m_lookup_strs[original_type_name]=1;override=new(.full_inst_path(full_inst_path),.orig_type(original_type),.orig_type_name(original_type_name),.ovrd_type(override_type));if(original_type!=null)beginif(check_inst_override_exists(original_type,override_type,full_inst_path))
override=m_resolve_type_name_by_inst(lindex.ovrd.m_type_name,full_inst_path);endif(override==null)beginuvm_report_error("TYPNTF",{"Cannot resolve override for original type '",lindex.orig.m_type_name,"' because the override type '",lindex.ovrd.m_type_name,"' is not registered with the factory."},UVM_NONE);endreturnoverride;end// No override foundreturnnull;endfunction// find_override_by_type// ---------------------
override=m_resolve_type_name_by_inst(lindex.ovrd.m_type_name,full_inst_path);endif(override==null)beginuvm_report_error("TYPNTF",{"Cannot resolve override for original type '",lindex.orig.m_type_name,"' because the override type '",lindex.ovrd.m_type_name,"' is not registered with the factory."},UVM_NONE);endreturnoverride;end// No override foundreturnrequested_type;endfunction// print// -----