Any way to cancel a factory override?

3 posts / 0 new
Last post
Chris Burns
Offline
Academy Total Access User
Joined: 10/19/2011
Posts: 5
Any way to cancel a factory override?

I have been using the UVM factory system to change up my "sequence_items", eg:

DRIVER_seq_item::type_id::set_type_override(DRIVER_1ERR_seq_item::get_type());

And I've found it works fine to do this in the middle of "task body" of a sequence, no restriction that I have to do it at the beginning. So, of course, I want to throw in a few of the special sequence_items, then switch back. I tried overriding my override to switch back to the original:

DRIVER_seq_item::type_id::set_type_override(DRIVER_seq_item::get_type());

But the factory just tells me

UVM_WARNING @ 725: reporter [TYPDUP] Original and override type arguments are identical

and it won't do it!

I figured out I can make another class DRIVER_seq_item_BACK_2_NORMAL, which is basically an unmodified extension of my original class, and the factory WILL let me re-override to that one, which accomplishes what I want, BUT: is there a slicker way to do this? What I'd like is something like a "cancel_type_override" function.

ben@SystemVerilog.us
Offline
Academy Total Access User
Joined: 03/23/2010
Posts: 14
Re: Any way to cancel a factory override?

More of a fundamental question: why would you want to cancel a factory override?

mperyer
Offline
Verification Forum Moderator
Joined: 07/24/2010
Posts: 146
Re: Any way to cancel a factory override?

I think you may have uncovered an interesting "feature" of the override system.

However, you may not need to be overriding the sequence item in this case. Since your driver_error item is extended from your driver item, there is nothing to stop you sending driver_error items to the driver through the sequencer. The driver has to check which one it has received, but your sequences can mix them anyway they like. If you have a sequence scenario where you need to mix the two item types then this would work.

Another alternative is to have a base class from which your driver and driver error items are derived. Then parameterise the sequencer/driver with that base class. Your dynamic override would then work. This would require you to do some casting in the driver and in the sequence if you are using responses.