Randomizing Frame Size, Packet Size, and Packet ID

Hello, I am attempting to develop a UVM testbench around an interface where both frames and packets are used. For example, a frame may contain up to 1000 packets and each frame contains a SOF and EOF signal that is asserted on the first and last packet of the frame respectively. All packets in the same frame will share packet ID and there are SOP and EOP signals for the beginning and end of packet words. Packets from different frames can be interwoven while remaining in the correct order on a frame-by-frame basis. I have never worked with UVM on a task like this before and I am not sure how best to setup transactions and sequences around this nested structure.

For a given test case I would like…

  1. randomized number of frames
  2. randomized number of packets per frame (up to 1000)
  3. consistent packet ID for all packets in the same frame

in the picture below a situation where 3 frames are randomly generated, the first containing 999 packets, the second containing 3 packets, and the third containing 12 packets. The number of packets per frame should also be randomly generated.

What would a transaction element look like and how would the coordination between packets and frames be handled best?

In reply to E_R_R:

I can give you suggestions for a few sequences methodologies to look at, but we probably need a few more details.

  • Your picture makes it look like all the packets have the same size, but I’m assuming each packet could be a different size within the same frame or frames.
  • Are the number of frames and packets per frame set at the beginning of the test?
  • Are there cases where there is no data being sent?

https://verificationacademy.com/cookbook/sequences/layering
https://verificationacademy.com/resources/technical-papers/seven-separate-sequence-styles-speed-stimulus-scenarios

In reply to dave_59:

Hello @dave_59 ,

Thanks for the response. I have taken a look at the links you shared and it looks like the first one has some information that may be particularly helpful.

I will also say that all of your assumptions were correct. The packets are not required to be the same size in a given frame. Most packets will be 2048 bytes in length if the frame is at least that long, and in cases where multiple packets are used, usually the final packet is truncated to fit in the frame size bound. It is also safe to assume that the number of frames and their size is to be set at the beginning of the test and thus the number of packets is determined from the frame size. Finally, it is safe to assume that for all test cases at least one frame of data is being sent.

Thanks!