beautypg.com

3 defining a field with variable length, Defining a field with variable length – Teledyne LeCroy Voyager Exerciser Generation Script Language Manual User Manual

Page 43

background image

Teledyne LeCroy

Voyager USB 3.0 Exerciser Generation Script Language Reference Manual

34

8.2.3 Defining a Field with Variable Length

If the field length is set to

*

, the field’s length is defined by the value that is assigned to the field. If

no value is assigned to the variable length field, the field’s length is set to 0.

Note: When a value is assigned to a variable length field, the field's length is changed based on

the difference between the previous and current values. In this case, the offsets of following fields
not bound to fixed offsets are shifted by the difference.

Examples

# Declare packet template 'SomeTemplate'.

Packet

Some Template

{
F1 :

16

# Declare the 16-bit field 'F1' at offset 0.

F2 :

32

# Declare the 32-bit field 'F2' at offset 16.

Data :

*

# Declare the variable-length field 'Data'. The field

# length is now 0.

CRC32 :

32

# Declare the 32-bit field 'CRC32' at offset 16+32.

}


# Declare packet template 'SomeTemplate1', inheriting fields from
# 'SomeTemplate'.

Packet

Some Template1 : Some Template

{
Data =

0xAABB

# Assign a value to the 'Data' field.

# Now the field has length 16 bits and the

# field 'CRC32' offset is shifted by 16 bits =
# 16+32+16.

}