Layered sequences that do NOT return items

Hello everyone,

I want to have a layered packet that contains some other packets and a header that mentions the number of packets that are inside.
So : | Header (2pkts) | Pkt1 | Pkt2
However, it might be that there are NO pakets to be sent, then I still have to write a header with value 0 : | Header (0pkts) |

Let us call the inner pakets type A and the encapsulating paket type B.
So type B can encapsulate 0 or more type A pkts.

Another thing is :the inner type A pkts can only be generated at the moment a type B pkt is requested (depends on some time aware settings). And also it is the type A pkt generator that decides how many pkts will be in the type B pkt.

Now, I was thinking on how to do this with layered sequencers/sequences.
The driver does get_next_item() to a type B sequencer and this one will fetch type A pkts and make the type B paket.

My problem however is : how can I make the type A sequence? Because it has to generate pkts only when the type B sequencer calls get_next_item(), but sometimes it will generate multiple type A pkts (this is easily implemented) but sometimes it has to generate NO type A pkt at all. The latter case puzzles me… After a first call I want to “skip” a call and then again answer a call of the type B sequencer…

Another option is that I always generate a type A sequence item but add a bit that says it is valid or not…

A similar problem occurs for giving the last type A pkt… somehow I want to stop generating requests for 1 call, but the next call again generate requests… So the “timing” is controlled by the type B sequence, the payload by the type A sequencer.
Again I could add a bit that says “last pkt for this type B pkt” to the type A seq_item…

But I was wondering if there are more convenient ways to do this? If anyone would have any ideas?

Best regards,
Stefaan Maeyaert

Check out the Cookbook: Sequences/Layering

Sounds like you want to have your A-pkt agent connected to the bus and have a B2A translator sequence running in its sequencer. When the driver does a get_next_item(‘A’), the translator sequence will do a get_next_item(‘B’) from your B-pkt sequencer and decompose it into 0, one or more A-pkts. In your zero case, you could have the translator sequence return a null transaction to the A-pkt driver (which would have to check for this case, of course). If the null occurs, then you wait for whatever “skip” condition you need before the A-pkt driver does another get_next_item() call. If there are more than one A-pkts generated, subsequence get_next_item() calls by your driver will return them in-order. When the A-pkts in the B-pkt have all been processed, the next get_next_item(‘A’) call will cause the translator sequence to request another B-pkt.

Good luck,
-Tom