Difference between set_type_override_by_type and set_type_override_by_name

Hi All,

May i knaw the “Difference between set_type_override_by_type and set_type_override_by_name”.
Is there any difference in the registration time of the factory.

can anyone explain the difference in detail.

-Thanks
-sravan

When you use ovm_component_utils(arg) or ovm_object_utils(arg) macros, both a class type (arg) and a string name “arg” are registered with the factory. If the class is parameterized, those macros try to register all specializations of that class with the same string name and that produces an error. In that case, you must use the ovm_component_param_utils or ovm_object_param_utils macros instead. Those macros only register the class by type. You could register the class with the factory without using the macros to give each specialization of the class a unique string name, but I would leave that for more advanced usage.

Using the types instead of the string names has a benefit that more checking can be done at compile time rather than waiting for run-time checking of string names.

In reply to dave_59:

Hi Dave,

I have a large environment at TOP (envTOP) which instantiates two small environments (say envA, envB). envA and envB both try to override the same object (say abc_obj) in the build phase.

envA build phase:
set_type_override_by_type (abc_obj::get_type(), Atype::get_type(), 0);

envB build phase:
set_type_override_by_type (abc_obj::get_type(), Btype::get_type(), 0);

I want that at envTOP, abc_obj should NOT be overridden.
In the hierarchy envA and below, abc_obj should be overridden to Atype
In the hierarchy envB and below, abc_obj should be overridden to Btype

Any way to resolve this? Is the Env the best place to override ?

Many Thanks,

In reply to kanishk.sugand:

Looks to me like you should be using set_inst_override_by_type

Srini
www.verifworks.com

In reply to Srini @ CVCblr.com:

Hi Srini,

Thanks for your reply.

Is Test the best place to do this, or envTOP? I am reusing envA, envB, so cannot change much there.

Regards,
Kanishk

In reply to kanishk.sugand:
Looks to me like you should be using set_inst_override_by_type
Srini
www.verifworks.com

In reply to kanishk.sugand:
During the build phase, a set in a context higher up the component hierarchy takes precedence over a set which occurs lower down the hierarchy.

So I would suggest doing the override at the lowest level that works for you so that a higher level has another opportunity to override things further.