
Teledyne LeCroy Voyager USB 3.0 Exerciser Generation Script Language Reference Manual
109
10.11 Sizeof Operators
Several kinds of sizeof operators are currently supported:
fld_size (field_name): Returns the length of the field in bits.
pkt_size (template): Returns the length of the template payload in bits.
pkt_size ($pkt_var_name): Returns the length of the structure variable payload in bits.
pttn_size (data_pattern): Returns the length of the data pattern payload in bits.
Note: Fields that are not initialized with a variable length (declared as f : *) have 0 length.
Examples
Main
{
# Examples of using 'sizeof' operators.
# Declare a 'structure' instance based on the template S1.
$S = S1
# Declare a 'structure' instance based on the template S2,
# changing the default value for the S16 field.
$W = S2 { S16 = 2 }
Send TX_PACKET
{
# Set the Len to the size of
# combined payload + the size of the 'Len' field.
Len = ( fld_size( Len ) + pkt_size( $S ) + pkt_size( $W ) ) / 8
# Same as the previous assignment.
Len = ( fld_size( Len ) + pkt_size( S1 ) + pkt_size( S2 ) ) / 8
# Data field contains combined payload of structures S and W.
Data = $S + $W
}
}
Comentarios a estos manuales