Create_item in a virtual sequence

I have a virtual sequencer running a sequence. I extended ovm_sequence without parameterization like so

class single_seq extends ovm_sequence;

Within the sequence, I’m attempting to create a transaction and send it on one of the virtual sequencer’s subsequencers. I’m using create_item to instantiate the transaction. The transaction is of type ovm_register_transaction which inherits from ovm_sequence_item. The create_item call is

assert($cast(reg_req, create_item(ovm_register_transaction::type_id::get(), reg_subseqr, "register_transaction"))) else
	`ovm_fatal("CREATE", "Could not create ovm_register_transaction object.");

The reg_req object is of type ovm_register_transaction and declared in the sequence. reg_subseqr is a pointer to the subsequencer (I omit its assignment for clarity).

When I execute this, I get

** Fatal: Illegal assignment to object of class ovm_register_transaction from object of class ovm_sequence_item

I expected that the factory would create an ovm_register_transaction… not an ovm_sequence_item and then cast it to ovm_register_transaction. If I paramterize the virtual sequence

class single_seq extends ovm_sequence #(ovm_register_transaction);

then it works fine and I don’t get the error.

What is create_item doing in a virtual sequence that I’m not understanding?

What are you trying to do with reg_req after you create it? The purpose of a virtual sequence is to create and control sequences on sub sequencers, not sequence items. If reg_req is a sequence_item, then you can not use it in the virtual sequence. You need to use a sequence on the sub sequencer.

What are you trying to do with reg_req after you create it? The purpose of a virtual sequence is to create and control sequences on sub sequencers, not sequence items. If reg_req is a sequence_item, then you can not use it in the virtual sequence. You need to use a sequence on the sub sequencer.

I thought it was legitimate to create items instead of sequences and invoke those on a sub sequencer. In this case with reg_req, after create_item I call start_item, randomize the item/set values, then call finish_item. Finally, get_response precipitates the failure.

In this case with reg_req, I can move the functionality to it’s own sequence and invoke that on the sub sequencer, so that’ll work.

However, in another case I have, I’m generating an item and then cloning that item several times and sending a copy of the item to several different sub sequencers. This works, and I’m not requesting a response so there was no failure due to the response. If only sequences should be invoked on sub sequencers, then what’s the best way to go about sending an item to multiple sub sequencers/drivers? I could clone the item, then create several instantiations of the sequence and pass the item into each sequence, then invoke the copies of the sequence on each sub sequencer. That seems like extra work and I’m not sure if setting a member variable in a sequence directly goes against the methodology.

Love to hear your thoughts or opinions on this!

Controlling a sequence by manually setting specific members is perfectly valid. It is an alternate method to configure the sequence and can sometimes be more efficient that using .randomize().

All you need to do is create the sequence, randomize it (if necessary), override/set any specific members and then start the sequence on the appropriate sequencer.

In reply to gbbrown:

Hi gbbrown,

I know we can create the sequence_item in virtual_seqeucne and then start on the sequencer using the create_item.Then we will do the start_item(txn) and finish_item(txn).

But i want to curiously know about the advantage of this.?
Please tell me after doing this do we need to write any base sequence or what?

Thanks,
Sagar