[FACTFL] Factory did not return a component of type

Hi,

I encoutered an OVM factory problem when I used set_type_override_by_type to overwrite some components in my ovm_env.

The error message is as follows:
OVM_FATAL @ 0: reporter [FACTFL] Factory did not return a component of type, sb_top

Here is my code segment.

class usbp_test extends ovm_test;

virtual function void build();
super.build();

// Overwrite transfer monitor, predictor/checker
set_type_override_by_type(sb_top::get_type(), sb_top_new::get_type());

my_usbp_env = usbp_env::type_id::create("my_usbp_env", this);

endfunction : build

endclass

Does anyone have idea about this fatal message?

Thanks,
JC

The error message is telling you that it couldn’t $cast what the factory provided to the variable type it is being assigned to. While there is not enough code posted to pinpoint the problem, you should take a look at the code for sb_top and sb_top_new.

You need to make sure that both sb_top and sb_top_new are registered with the factory, and that sb_top_new extends from sb_top. If sb_top_new doesn’t extend sb_top, then the $cast would fail and you will receive that error message.

Thank you, Chuck.

The sb_top_new doesn’t extend from sb_top.
In fact, I didn’t extend sb_top_new from sb_top because I need to change the TLM interface (analysis_port) for sb_top_new.

My current question is if I have to change the TLM interface of certain component, I can’t use set_*_override_by_type() to replace it. Is this correct?
Do you have any recommandation to deal with this kind of problem?

Thanks,
JC

Instance override requires that you maintain the same TLM interfaces since the components will be utilized in the same location in the environment.

Without specifics of what you are doing, it is hard to provide a detailed answer, but is it possible to add an additional analysis_port instead of replacing the existing one? You wouldn’t need to utilize the existing one, just the new one.

In reply to cgales:

Hi Gales,

I am also having similar problem of getting that error message, while overrides one class by another. In my case, i have two classes “A” and “B” , both derived from a “base” class. I have the class A, instantiated in my environment. Now i want to override this class “A” with class “B”. Since in this case, both “A” and “B” are derived from the same “base” class, is it not possible to override one by another?

-Pavan

In reply to Pavan:

Pavan,
If you desire to override class “A” with class “B”, then “B” needs to be derived from “A”. You can not override if “A” and “B” are derived from the same base class. The only potential way to do this would be to instantiate the base class in the environment, and provide an override of the base class with “A” or “B” as required.

–Chuck