How to implement the various scenarios using the sequence struct?
Once you define the sequence struct, you can create various scnearios by creating the sub types of the sequences using kind field.
1. Extend the sequence kind type with the new kind
extend usb_transaction_kind_t : [ SETUP];
2. Extend the new sequence sub type of the kind with either parameters or body().
// SETUP Transaction
extend SETUP usb_sequence_s {
body()@driver.clock is {
do sequence_items keeping {
}; // End of body()
}; // End of extend
// OUT Transaction
extend usb_transaction_kind_t : [ OUT];
extend OUT usb_sequence_s {
body()@driver.clock is {
do sequence_items keeping {
.pid == OUT;
}; // End of body()
}; // End of extend
// IN Transaction
extend usb_transaction_kind_t : [ IN];
extend IN usb_sequence_s {
body()@driver.clock is {
do sequence_items keeping {
.pid == IN;
}; // End of body()
}; // End of extend
In the next post, we will see how to write the test cases using sequences.
- The items and sub-sequences are created inside the pre-defined TCM called "body()" - used to define the behavior of the sequences - using the dedicated "do" action.
- The body() TCM inside the MAIN sequence is launched automatically by the run() method inside the sequence driver.
- The body() TCM of any sub-sequence is activated by the "do" action.
- The body() TCM defines the duration of the sequences.
- When "do"ing an item, you must emit the event driver.item_done to let the sequence complete the "do" action and inform the driver that the item was processed. Without emitting this event, the sequence cannot continue, and the driver cannot drive more items.
- The do action can only be activated inside sequences.
Once you define the sequence struct, you can create various scnearios by creating the sub types of the sequences using kind field.
1. Extend the sequence kind type with the new kind
extend usb_transaction_kind_t : [ SETUP];
2. Extend the new sequence sub type of the kind with either parameters or body().
// SETUP Transaction
extend SETUP usb_sequence_s {
body()@driver.clock is {
do sequence_items keeping {
// The "do sequence_items" will wait until the driver.get_next_item is called and will be
// completed once the driver. packet_done is emitted. Hence the "do sequence_items" and
// driver.get_next_item work in tandem
.pid == SETUP;// completed once the driver. packet_done is emitted. Hence the "do sequence_items" and
// driver.get_next_item work in tandem
}; // End of body()
}; // End of extend
// OUT Transaction
extend usb_transaction_kind_t : [ OUT];
extend OUT usb_sequence_s {
body()@driver.clock is {
do sequence_items keeping {
.pid == OUT;
}; // End of body()
}; // End of extend
// IN Transaction
extend usb_transaction_kind_t : [ IN];
extend IN usb_sequence_s {
body()@driver.clock is {
do sequence_items keeping {
.pid == IN;
}; // End of body()
}; // End of extend
In the next post, we will see how to write the test cases using sequences.
1 comment:
i actually love your writing type, very interesting.
don't give up and keep creating simply because it simply just good worth to follow it.
impatient to look over much of your own well written articles, stunning day ;)
Post a Comment