Can we extend the virtual sequence and original sequence from the same base sequence?
Ex:- class seq_adc_drive extends adc_oc_base_sequence - This is original sequence where stimulus is generated
class adc_test_seq extends adc_oc_base_sequence - This is the virtual sequence containing the handle of seq_adc_drive and also starting the sequencer in the particular sequencer using p_sequencer handle.
It’s not clear what you are trying to achieve by using a common base sequence. A regular sequence has to be typed appropriately with the sequence_item it is generating as these sequence_items are being sent to the driver. A virtual_sequence doesn’t have a type requirement since it is only starting sub-sequences and not generating any sequence items.
Also, you should never use p_sequencer as this limits your flexibility for using your sequences. Instead, you should have sequencer handles in your sequence and assign them appropriately prior to starting your sequence.
Hi @cgales ,
Thanks for the reply.
So, actually I wanted to have a base sequence which will have a common task and which can be called in the sequence instead of writing the same task in each sequence.
A virtual sequence is nothing special except that it’s part of a reusable methodology that doesn’t rely on a specific transaction type. However, extending a virtual sequence from a non-virtual sequence can break that reusability. Ultimately, this decision depends on your design and test bench architecture.
if you you have an initialization sequence that you always want to run for all tests but then change the stimulus in each test after the initialization…
Your default virtual sequence starts the following
(a) initialization seq
(b) stim1 seq
ensure you register all of the tests & sequences with the UVM factory.
Then you create a new test, (test2) which inherits from the default test.
You just need to do a UVM factory override in the test2 saying when the default sequence asks to start the default virtual seq to run virt_seq2
You can also do another UVM factory to say substitute any calls for stim1_seq with stim2_seq
The virt_seq2 will inherit from the default_virt_seq
the default virtual seq will execute the common initialization sequence
The default virtual seq will start stim1_seq but the factory override will intercept and start stim2_seq instead.
rinse and repeat for test3 with UVM factory overrides to use virt_seq3 and to swap stim1_seq with stim3_seq