3 nested calls using global variables, Nested calls using global variables – Teledyne LeCroy Voyager Exerciser Generation Script Language Manual User Manual
Page 130

Teledyne LeCroy
Voyager USB 3.0 Exerciser Generation Script Language Reference Manual
121
10.19.3 Nested Calls Using Global Variables
You can call another generation procedure inside a generation procedure. This is called
"nested calls". During such calls, the current values of global variables are used when the called
generation procedure is parsed.
Example
z =
18
SOME_PKT_TEMPLATE $Z
# Declare a global structure variable 'Z'
# based on the template 'SOME_PKT_TEMPLATE'.
Main
{
$Y = SOME_PKT_TEMPLATE
# Declare a local structure variable 'Y'
{
Field0 = z +
12
# Use a global variable 'z'.
}
z++
# Increment the global variable 'z'.
Send
Y
# Send packet based on the local structure variable 'Y'
.
Call
Block1( $Y,
12
,
10
)
# Call 'Block1'.
}
Block1( SOME_PKT_TEMPLATE $p, x, y )
{
$p
# Change the local structure variable 'p'.
{
Field0 =
2
*(x + y) + z
# Use local variables 'x', 'y' and global
# variable 'z' here.
}
Send
Z
# Send packet based on the global variable 'Z'.
$Z
# Change the global structure variable 'Z'.
{
Field0 =
0x0000BEEF
}
$Z[
0
,
4
] =
0xA
# Change the 4 bits of structure variable 'Z'
# at offset 0 bits
.
Call
Block2( $p )
# Call 'Block2'.
}
Block2( SOME_PKT_TEMPLATE $p )
{
Send
p
# Send packet based on the local structure variable 'p'.
Send
Z
# Send packet based on the global structure variable 'Z'.
}