3 using local fields in structure variables, Using local fields in structure variables – Teledyne LeCroy Voyager Exerciser Generation Script Language Manual User Manual
Page 105

Teledyne LeCroy
Voyager USB 3.0 Exerciser Generation Script Language Reference Manual
96
10.3 Using Local Fields in Structure Variables
You can declare local fields within a structure variable. Use local fields to reassign bit offsets or
append additional data to a structure variable.
These fields are only valid in the structure variable in which they are declared, not the packet
template.
You can declare new structure variables based on the structure variable with local fields.
However, it is illegal to assign an existing structure variable to a structure variable that contains
declared local fields. This may or may not generate parse errors. If no parse errors are
generated, the local fields are not in the assigned structure variable.
Note: See section Changing Structure Parser Variables for more examples.
Example
struct
S1
{
F16 :
16
=
0xAABB
F8 :
8
=
0xFE
F32 :
32
=
0xABCD1234
}
Main
{
# Declare a structure variable based on struct S1.
$Pkt_Var1 = S1
# Declare local field F24 in structure variable $Pkt_Var1. The
# local field is from offset 0 and is 24 bits long (it has the same
# offsets as F16 and F8).
$Pkt_Var1
{
F24 :
0
,
24
= {
11 22 33
}
}
# Declare a structure variable based on struct S1.
$Pkt_Var2 = S1
# Declare local field F24 in structure variable $Pkt_Var2. The
# local field is 120 bits long at offset 56 (end of the structure
# variable).
$Pkt_Var2
{
F128 :
120
= {
11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
}
}
# Declare structure variable $Pkt_Var3 (assigned from $Pkt_Var1).
$Pkt_Var3 = $Pkt_Var1
# Declare a structure variable based on struct S1.
$Pkt_Var4 = S1
# Bad assignment $Pkt_Var2 to $Pkt_Var4 (data NOT copied)
$Pkt_Var4 = $Pkt_Var2
}