Protocol Solutions Group
3385 Scott Blvd., Santa Clara, CA 95054
Tel: +1/408.727.6600
Fax: +1/408.727.6622
UWBTrainer™ Exerciser
Generation Script Language
Reference Manual
Manual Version 1.02
For UWBTracer/UWBTrainer Software Version 3.02
November 2007
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
Document Disclaimer
The information contained in this document has been carefully checked and is believed to be
reliable. However, no responsibility can be assumed for inaccuracies that may not have been
detected.
LeCroy reserves the right to revise the information presented in this document without notice or
penalty.
Trademarks and Servicemarks
CATC Trace, UWBTracer, UWBTrainer, and BusEngine are trademarks of LeCroy.
All other trademarks are property of their respective companies.
This is version 1.02 of the UWBTrainer Generation Script Language Reference Manual.
This manual applies to UWBTrainer software version 3.02 and higher.
ii
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
[blank page]
viii
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
1 Introduction
The UWBTrainer™ Generation Script Language allows you to create UWB traffic generation
scenarios for UWBTrainer devices. The Generation Script Language allows you to implement
even complicated generation scenarios.
Typically, Generation Script Language constructions do not require special separation symbols
(such as the semicolon in C languages) to distinguish between different constructions. Where
possible, script parsing uses "context-dependency" rather than separatio n symbols.
Also, Generation Script Language constructions are not case-sensitive.
This document describes the commands and syntax of the UWBTrainer Generation Script
Language.
1.1 Declaration Conventions
1.1.1 Parentheses
In declarations and descriptions of Generation Script Language instructions,
the format
each other. The declaration
"(" ")" specifies a list of keywords that have the same value and can replace
( Packet | Frame | Struct ) Template_Name …
specifies that you can use the "Packet", "Frame", or "Struct" keyword for template name
declarations.
1.1.2 Brackets
In declarations and descriptions of Generation Script Language instructions,
the format "[" "]" specifies optional parts of declarations or instruction parameters. The declaration
specifies that the listed ancestors and attribute lists are optional for template name declarations.
1.2 Script Example Highlighting
Generation Script Language examples in this document show syntax highlighting similar to that in
the UWBTrainer Generation Script Editor.
1
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
2 Script Language Structure
2.1 Generation Script Structure
Typically, a generation script has the following structure:
• Parser directives
• Declarations
o Constants
o Data patterns
o Global generation settings
o Frame/structure templates
o Global numeric variables
o Global structure variables (declare a template for a variable before declaring a variable)
• Generation procedures
o List of generation instructions
Note: The parser can use previously declared objects in later declarations. In generation
procedures, the parser can use objects assigned before their declaration.
Reminder: The generation parser is NOT case-sensitive.
2.2 Main Procedure and Other Procedures
Although you can create many generation procedures, the major execution entry point is a
procedure with the name Main. Therefore, you must have a generation procedure named Main.
You can invoke the other generation procedures in the Main generation procedure using the
Call directive.
The Call directive makes a "dynamic" insertion, in which the included procedure is re-parsed
using the new parser variable values and the latest values of global variables.
2
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
3 Comments
Comments instruct the script parser to exclude the commented parts of the script file from
parsing.
3.1 Line Comment
To comment a line, start the line with the symbol #.
To comment the end of a line, put the symbol
of the line after the
Example
SomeStuff # The text after the # symbol is not parsed.
# symbol.
3.2 Block Comment
To comment a block of text, start with the symbol pair /* and end with the symbol pair */. The
parser ignores the part of the file inside the comment block.
Example
/*
Example of a block of comments.
All the text between '/' '*' and '*' '/' is ignored.
*/
# before the comment. The parser ignores the rest
3
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
4 File-Including Directives
To include a file in a generation parsing stream, use the %inline or %include directive.
4.1 Inline Directive
The %inline directive instructs the script parser to insert the content of the named file into the
parsing stream when the parser sees this directive, even if the file is already inserted.
Examples
%inline "SomeInc1.inc" # Includes the 'SomeInc1.inc' file.
%inline "SomeInc1.inc" # Includes the 'SomeInc1.inc' file again.
4.2 Include Directive
The %include directive instructs the script parser to insert the content of the named file into the
parsing stream only ONCE, the first time the parser sees the directive with the specified file
name.
Examples
%include "SomeInc1.inc" # Includes the 'SomeInc1.inc' file.
%include "SomeInc1.inc" # Does nothing.
4
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
5 Constant Declarations
You can declare numeric script constants to use later in assignments or arithmetic operations.
Constants are DWORD (unsigned integer) values only.
5.1 Predefined Constants
For information about the predefined constants, see the genconstants.ginc file in the
Generation\Include folder in the Application directory.
5.2 Constant Definition Examples
Examples
Const SOME_HEX_DATA = 0xAABBFFEE# Define a hexadecimal constant.
Const SOME_DEC_DATA = 12# Define a decimal constant.
Const "SOME DEC DATA" = 64# Define a decimal constant.
Const "Some Hex Data" = 0xCDCDBEBE
const HDR_ERR_SIZE = 8
const RATE_53MBS = 0
# The parser can use arithmetic operations in constant definitions.
const TX_PAYLOAD_OFFSET = 15 * 8# Payload offset(in bits) for
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
6 Data Pattern Declarations
Data pattern declarations declare named byte strings to use where you use byte vectors. Data
pattern declaration starts with the DataPattern keyword.
DataPatternPattern_Name = { hex_stream}
Example
# Declare a data pattern containing the byte string:
# AA BB CC DD DD EE FF 11 22 33 44 55
DataPatternPATTERN_1 = { AA BB CC DD EE FF 11 22 33 44 55 }
6.1 Constants and Data Patterns in Declarations
You can use constants and previously defined data patterns in data pattern declarations. Place
constants and data patterns inside a
but for code clarity it is recommended that you use a
[] block. (You can omit a [] block for constant insertion,
[] block.)
Note: When inserting constants into a data pattern, the script parser uses only the least
significant byte of the constant. For example, if constant 0xAABBCCDD is inserted, only the
0xDD is put into the data pattern.
Examples
Const MY_CONST = 0xCC
Const "MY CONST" = 0xDD
# Declare a data pattern containing the byte string:
# AA AA BB BB CC CC DD DD
DataPatternPATTERN_1 = { AA AA BB BB [MY_CONST] CC DD ["MY CONST"] }
# Declare a data pattern containing the byte string:
# 11 AA AA BB BB CC CC DD DD 88
DataPatternPATTERN_2 = { 11 [ PATTERN_1 ] 88 }
6.2 Leading Zeroes
Example
For bytes less than 0x10, it is not necessary to add a leading 0.
DataPattern PATTERN_4 = { B B 6 B B } # Is the same as 0B 0B 06 0B 0B.
6
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
7 Global Generation Settings
A generation script can define global parameters, called "generation settings", that affect aspects
of script compilation and execution. The generation settings are set using the Set script keyword.
7.1 Generation Settings
Currently the following settings are supported:
Setting Description
UwbTxPower
UwbTxChannel
UwbRxChannel
Specifies the level of transmitter power.
Possible values are
0 (no transmitting) to 15 (max level).
Default value: 15
Specifies the wireless channel that UWBTrainer™ uses
to transmit WiMedia traffic.
The setting value for channel mapping
(see Figure 7.1 below) includes:
Band Group (3 bits)
TF Code (3 bits)
as specified in the WiMedia PHY Specification.
Default value: AUTO
(UWBTrainer uses the currently specified channel.)
Specifies the wireless channel that UWBTrainer uses to
receive WiMedia traffic.
The setting value for channel mapping
(see Figure 7.1 below) includes:
Band Group (3 bits)
TF Code (3 bits)
as specified in the WiMedia PHY Specification.
Default value: AUTO
(UWBTrainer uses the currently specified channel.)
7
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
Receive
SuperFramePeriod
FrameDelay
Allows you to turn OFF(0) or ON(1) the UWBTrainer
receiver. Default value: OFF (0)
If the UWBTrainer receiver is on, then UWBTrainer
receives and processes Rx traffic even if the script
scenario is not concerned about it. This can significantly
decrease script performance (even for just only Tx
generation scenarios), because some time is needed to
process Rx traffic. So it is better to turn it off when there
is no need to process Rx traffic.
Note: Register Rx Frame condition instruction
automatically turns on the receiver. It remains active and
processes Rx traffic until it is turned off by this setting:
Set Receive = OFF or Set Receive = 0
Specifies the SuperFrame period in microseconds.
Possible values are 512 to 0xFFFFFF.
Default value: AUTO (65,536 microseconds)
Specifies the default delay in nanoseconds between
transmitted frames.
Default value: 0
(Frames are transmitted without delay.)
AddMissingFields
RandSeed
MaxLoopIterCount
Note: This value can be overridden by the Delay
parameter in a Send Frame instruction.
Instructs the script parser to add any missing frame
template fields for Send Frame instructions.
Missing TX frame template fields might include
FCS.
Missing RX frame template fields might include
FCS +Rx packet end report fields
(such as RSSI and LQI),
which are used in conditions.
Default value: ON
Allows you to set an integer seed for the pseudo-
random generator used by the RAND token.
Allows you to change the maximum total number of
preprocessor loop iterations in a generation script.
Possible values are 1 to 100,000.
Default value: 20,000
8
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
Blocking
Set the default behavior of Send Frame instructions.
If set to TRUE, the Send Frame instruction is blocked
until the frame is sent (unless overridden in the
Send Frame parameter).
If set to FALSE, Send Frame will continue executing
script instructions, even if the Send command is still
queued in the output FIFO and not yet executed
(unless overridden in the instruction parameter).
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
7.2 Simulation Settings
This group of settings does not affect generation output for UWBTrainer in any way. Only the
UWBTrainer application trace simulation tool uses these settings. This tool allows you to convert
generation scenarios into UWBTracer trace files and preview traffic generated by the UWBTrainer
device. (For more details about the simulation tool, please refer to the UWBTrainer user manual.)
Setting Description
RxSimulationMode
SimAnalyzerPhy
SimUseElseBranch
If set to 1, specifies that the generation scenario should
be converted to an RF trace file as it might be recorded
by a UWBTracer analyzer recording RF traffic.
If set to 0, specifies that the generation scenario should
be converted to an MPI trace file as it might be recorded
by a UWBTracer analyzer recording MPI traffic.
Default value: PHY_WISAIR_REV_C
If set to 1, specifies that, whenever the simulation tool
sees the else_condition branch, it takes those branch
instructions for the simulated trace file and ignores
if_condition branch instructions.
If set to 0, specifies that, whenever the simulation tool
sees the if_condition branch, it takes those branch
instructions for the simulated trace file and ignores
else_condition branch instructions.
Default value: 0 (simulation tool uses if_condition
branch instructions for a simulated trace file)
10
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
7.3 Generation Settings Syntax
The syntax for generation numeric and string settings is:
Set NumericSetting = numeric value
Set StringSetting = "string value"
Examples
# Default time in nanoseconds after the previous frame
# to send the next frame.
Set FrameDelay = 2000000
Set UwbTxPower = 8
Set UwbTxChannel = 9
7.4 Generation Settings outside Procedures
Generation settings specified outside the generation procedures are set before the first script
generation instruction is executed, no matter where they appear in the script. The two examples
below are equivalent.
Example 1
# Set a setting before the first instruction is executed.
Set FrameDelay = 20000
Main
{
# Some generation instructions
}
Example 2
# Set a setting before the first instruction is executed.
Main
{
# Some generation instructions
}
# Set before the first instruction is executed,
# though the Set line is below the instruction in the script.
SetFrameDelay = 12000
11
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
7.5 Generation Settings inside Procedures
Generation settings specified inside a generation procedure are set only during script execution
by the UWBTrainer™ device.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8 Frame and Structure Template Declarations
Frame/structure declarations declare named frame/structure objects. A frame/structure object
gives its target byte stream a set of "fields", each having a unique name. You can fully set up a
byte stream using frame/structure fields.
1
: Templates can inherit field layouts from other templates through ancestor lists.
: For frame/structure template declarations, you can use the Frame or Struct keyword.
Note
However, structures are supposed to be used as building blocks for constructing frame payloads
(or similar purposes), rather than for describing full frames.
8.1 Predefined Frame/Structure Templates
LeCroy PSG provides some useful WiMedia frame templates that can be used in generation
scripts. The predefined frame/structure templates are listed in the file:
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2 Field Definitions
You can define template fields using the following syntax:
Field_Name : [ offset, ] length [ (Byte Order attribute) ][ = Field_Value ][ [ list of possible values ] ]
or
Field_Name [: length] { Subfield definitions } [ (Byte Order attribute) [ = Field_Value ][ [ list of
possible values ] ]
1
: Specify all field offsets and lengths in bits. Numeric expressions with declared constants
Note
are allowed in field offset and length definitions. All field and subfield names must be unique
inside a template.
2
Note
: You can define local fields for packet variable instances, register condition instructions,
and when sending a frame. See sections “Changing Structure Parser Variables” and
“Send Frame Instruction” for more information.
8.2.1 Defining a Field at a Specific Offset
If the offset parameter is in a field definition, then the field is bound to a specific offset.
Examples
const F3_OFFSET = 16
const F3_LEN = 8
# Declare the frame template 'SomeTemplate.
FrameSomeTemplate
{
F1 : 0, 16# Declare the 16-bit field 'F1' at offset 0.
F2 : 64, 32# Declare the 32-bit field 'F2' at offset 64.
F3 :F3_OFFSET,F3_LEN # Declare the 8-bit field 'F2' at offset 16.
F4 :F3_OFFSET + F3_LEN, 16# Declare the 16-bit field 'F4' at
# offset 16+8.
}
14
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2.2 Defining a Field at the Current Offset
If the field offset is omitted, then the field's offset is calculated based on the lengths of previously
declared fields. The initial template offset is always 0.
Example
const F3_OFFSET = 64
const F3_LEN = 8
# Declare the frame template 'SomeTemplate.
FrameSomeTemplate
{
F1 : 16# Declare the 16-bit field 'F1' at offset 0.
F2 : 32# Declare the 32-bit field 'F2' at offset 16.
F3 :F3_OFFSET,F3_LEN # Declare the 8-bit field 'F2' at offset 64.
F4 : 16# Declare the 16-bit field 'F4' at offset 64+8.
}
15
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2.3 Defining a Field with Variable Length
If the field length is set to *, then 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, then the field’s length is set to 0.
Note: When a value is assigned to a variable length field, then 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 frame template 'SomeTemplate'.
FrameSome 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.
FCS : 32# Declare the 32-bit field 'FCS' at offset 16+32.
}
# Declare frame template 'SomeTemplate1', inheriting fields from
# 'SomeTemplate'.
FrameSome Template1 : Some Template
{
Data = 0xAABB# Assign a value to the 'Data' field. # Now the field has length 16 bits and the
# field 'FCS' offset is shifted by 16 bits = 16+32+16.
}
16
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2.4 Defining a Default Field Value
When defining a field, you can specify a default field value. If the default value is not provided,
then the field is filled with zeros based on the field length.
Note: When a value is assigned to a variable length field, then 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.
Example
const F3_OFFSET = 64
const F3_LEN = 8
# Declare the frame template 'SomeTemplate.
FrameSomeTemplate
{
F1 : 16# Declare the 16-bit field 'F1' at offset 0.
F2 : 32 = 123456# Declare the 32-bit field 'F2' with default
# value 123456.
F3 : * = {AA BB}# Declare a variable length field and assign # hex value {AA BB} to it.
# Now its length is 16 bits.
}
17
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2.5 Specifying Byte Order in Field Definitions
You can specify the byte order for integer fields (length <= 32 bits) using the Byte Ord er field
attribute. The Byte Order field attribute indicates how numeric values are assigned to integer
fields. By default, the byte order for integer fields is Big Endian: MSB->LSB. For example, the
integer value 0xAABBCCDD is assigned as the {AA BB CC DD} byte stream.
Example
# Specify byte order for some fields of a template.
8.2.6 Using Byte Stream Literals in Field Assignments
You can specify the byte order explicitly using byte stream literals:
Example
Field_32 : 32 ={ AA BB CC DD }
18
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2.7 List of Possible Field Values Attribute
You can specify a list of possible field values (defined by constant or data pattern names) for
declared template fields. The UWBTrainer™ Application Development Environment (UWBTrainer
Script Editor Intellisense and Graphic Scenario Builder) uses this list to quickly assign field
values.
Note: The list does not affect compilation or traffic generation.
Example
Const MyConst = 10
DataPattern MyPattern = { AA BB CC DD }
Frame MY_TEMPLATE
{
Field_1 : 16 [MyConst, MyPattern] # possible value list
Field_2 : 32 = 0xAABBCCDD [MyPattern] # possible value list
Field_3 : 32 (MSB) = [MyConst [MyConst] # possible value list
}
19
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.2.8 Defining Subfields
You can define named subfields for top-level template fields. Subfields allow you to set a field
value using DWORD little-endian bit order. Subfield and field names must be unique inside a
template. You can also assign field values using field names directly. Note: You cannot define
subfields for lower-level template fields.
Syntax
Field_Name [ : length ]
{
SubField [ : length ][ (Byte Order attribute) [ = Field_Value ][ [ list of possible values ] ]
SubField [ : length ] [ (Byte Order attribute) [ = Field_Value ][ [ list of possible values ] ]
SubField [ : length ][ (Byte Order attribute) [ = Field_Value ][ [ list of possible values ] ]
…
} [ (Byte Order attribute) [ = Field_Value ][ [ list of possible values ] ]
If the length of a parent field is less than the total length of its subfields, then the total length of
the subfields defines the parent field length.
Note: The subfields always use their parent field as a DWORD little-endian buff er. For example, if
the parent field has a 64-bit length for subfield assignments, the subfields use it as two littleendian DWORDs.
Example
struct Templ_1
{
F1 : 8
F2
{
SF1 : 8 = 0xCC
SF2 : 16
SF3 : 8
}
}
struct Templ_2
{
F1 : 8
F2 : 16 # Declare parent field length.
{
SF1 : 8
}
}
20
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
Main
{
# Send a frame with payload: 00 EE AA BB CC
Send Templ_1
{
SF2 = {AA BB}
SF3 = 0xEE
}
# The same as above
Send Templ_1
{
# Use direct parent field assignment instead of subfields.
F2 = {EE AA BB CC}
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# MAC HEADER
#------- Frame Control Multi-byte Field -------
# Example of a complex multi-byte field.
# A multi-byte complex field has a subfield layout.
# Only one level of subfields is currently allowed.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.4 Frame Template Inheritance
You can create a frame/struct template that inherits field layouts defined in another template. The
created template has all the fields defined in the inherited templates plus its own fields. All fields
must have unique names.
Note: The parser adds the fields defined in the created frame template after it adds fields from
the inherited templates.
You can change the default field values of the inherited fields.
8.4.1 Frame Template Single Inheritance
A new template inherits the field layouts from another template using an ancestor list:
Examples
FrameTX_FRAME : PLCP
{
# Example of a field with variable length having a default value.
Data : * = { 00 00 00 01 }
# The parser can use a declared data pattern name.
FCS : 32
# This field is calculated automatically if autocorrect settings
# are on in the SendFrame instruction.
}
# Other examples of frame templates:
# PHY-MAC header for RX frame + header error fields
FramePLCP_RX : PLCP
{
HDERsvd : 3
HDError : 5
}
# Template for generic TX frame
FrameTX_FRAME : PLCP_TX
{
Data : *
FCS : 32# calculated automatically
}
24
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# The field 'FrameType' now has a different default value.
# For example, the constant DATA = 3
FrameType = DATA
# Declare the field 'Opcode' ( offset : 128 , length : 8 )
# having default value 0x2A.
Opcode : OPCODE_OFFSET, 8 = 0x2A
# Declare the field 'LBA'(offset : 128+8, length : 64)
LBA : 64
}
# Example of using arithmetic and data pattern names
# in field definitions.
FrameMY_TX : TX_FRAME
{
# Declaration of the field at offset: 18 * 8 bits, length: 8 bits
MyLen : TX_PAYLOAD_OFFSET + (3 * 8), 8
# Setting a field value using a previously declared datapattern.
Data = PATTERN_4
}
25
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.4.2 Frame Template Multiple Inheritance
You can create a frame/struct template that inherits field layouts defined in several templates.
The created template has all the fields defined in the inherited templates plus its own fields. All
fields must have unique names.
Multiple inheritance can simplify the construction of complex templates.
Note: The parser adds the fields defined in the created template after it adds fields from the
inherited templates. The parser adds the fields defined in the inherited templates in order from the
left-most ancestor to the right-most ancestor.
Examples
FrameBase
{
F1 : 16
F2 : 8
F3 : 32
}
FrameTempl_0
{
FieldT0_8 : 8
FieldT0_16 : 16
}
FrameTempl_1
{
FieldT1_24 : 24
FieldT1_32 : 32
}
FrameCombined : Base, Templ_0, Templ_1
{
}
The Combined template above has the fields:
• F1 : 16 # Base
• F2 : 8 # Base
• F3 : 32 # Base
• FieldT0_8 : 8 # Templ_0
• FieldT0_16 : 16 # Templ_0
• FieldT1_24 : 24 # Templ_1
• FieldT1_32 : 32 # Templ_1
• Data : * # Combined
26
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.5 Frame Template Multi-byte Field Byte Order
Attribute
By default, for fields up to 32 bits, the parser uses the Little Endian (LSB -> MSB) byte order.
For example, if a 32-bit field has the value 0xAABBCCDD, it is written into the byte stream as:
DD CC BB AA
You can require that all template fields have the Big Endian (MSB -> LSB) byte order. Adding
(MSB) after the ancestor list in the template declaration instructs the script parser to choose the
MSB -> LSB byte order.
Note: The Byte Order attribute applies only for fields defined inside a template and does not
affect fields specified in inherited or inserted templates.
33
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
Examples
FrameBase_0 (MSB)
{
F1 : 16
}
FrameBase_1 # LSB to MSB byte order by default
{
F2 : 32
}
FrameCombined : Base0, Base_1 (MSB)
# The attribute goes after the template ancestor list.
{
Cmb_Fld : 32
}
# Combined template has the fields:
# F1 : 16 (MSB)
# F2 : 32 (LSB)
# Cmb_Fld : 32 (MSB)
34
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
8.6 Structure Declaration Examples
To the parser, structures are the same as frame templates. However, you should use structures
to assign frame field values, rather than as frame layouts in Send Frame instructions.
Note: Also see the examples using the Struct keyword to assign frame field values in later
sections.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9 Generation Procedures
A generation (or instruction) procedure typically contains a list of generation scenario instructions
and script parser "preprocessor" directives.
• Generation scenario instructions are translated into generation instructions executed by
the UWBTrainer™.device (for example, Send Frame).
• Script parser "preprocessor" directives are executed during parsing and are not sent to
the UWBTrainer (for example, parser arithmetic expressions and loops).
Note: The procedure with the name Main is the entry point of the generation stream and must be
present.
9.1 Send Frame Instruction
To send a frame, write the Send keyword followed by the name of the frame template or frame
variable in the generation procedure and provide a list of parameters that should override the
default instruction parameters, if any.
Note: For information about using frame variables, see the "Declaring frame variables" section.
The script parser constructs a Send Frame instruction based on the frame template or frame
variable, plus the provided parameters, and sends it to UWBTrainer.
Format
# Basic Send instruction
Send(Frame Template name | Structure variable name )
[
{
Field = Value
...
}
( frame delay, superframe offset, absolute time,
nanosecond time adjustment, burst mode switch,
override bitmap, time variable index, blocking )
]
9.2 Using Local Fields in Send Frame Instructions
You can add local fields to Send instructions. You can use them to add to the existing frame
template or structure variable or to override specified offsets within the declared structures. These
local fields only exist for the specific instance of the Send instruction in which they are declared.
The frame template or structure variable remains unmodified and does not retain the local fields
created. (To learn how to retain local fields, see the section “Using Local Fields in Structure
Variabl
append information to a specific packet without having to redefine a template. (Local fields are
also applicable to Register Condition Instructions.)
es”) With local fields, you may quickly assign a portion of a larger field using bit offsets or
36
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
Format
# Send instruction with a local field appended.
Send(Frame Template name | Structure variable name )
[
( frame delay, superframe offset, absolute time,
nanosecond time adjustment, burst mode switch,
override bitmap, time variable index, blocking )
{
Field = Value
...
# Declare local field “Lfield” 48 bits long at the packet end. LField : 48 = { 01 02 03 04 05 06 }
}
]
# Send instruction with a local field overwriting an offset.
Send(Frame Template name | Structure variable name )
[
{
Field = Value
...
# Declare local field “FirstByte” 8 bits long at offset 0. FirstByte : 0,8 = { 01 }
}
( frame delay, superframe offset, absolute time,
nanosecond time adjustment, burst mode switch,
override bitmap, time variable index, blocking )
]
# Send instruction with local fields appended and overwrite an offset.
Send(Frame Template name | Structure variable name )
[
( frame delay, superframe offset, absolute time,
nanosecond time adjustment, burst mode switch,
override bitmap, time variable index, blocking )
{
Field = Value
...
# Declare local field “Lfield” 48 bits long at packet end. LField : 48 = { 01 02 03 04 05 06 }
# Declare local field “FirstByte” 8 bits long at offset 0. FirstByte : 0,8 = { 01 }
}
]
1
: The instruction parameters “( … )” and frame/structure field assignments “{ … }” are
Note
interchangeable in order within the Send instruction.
2
: Declare local fields within the Send instruction in the same way that frame template fields
Note
are declared. They exist only for the instruction in which they are declared.
37
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.3 Instruction Parameters
The parser searches the template list first.
•If a template with the specified name is not found, it searches the local generation
procedure structure variable list.
•If a local generation procedure stru cture variable i s not found, the parser searches the
global structure variable list.
•If a structure variable is not found, the system reports a parser error.
The named instruction parameters are:
• Delay: Delay time (in microseconds) to wait before sending the fra me.
• SFOffset: Offset (in microseconds) of the frame to be sent, in SuperFrame.
• AbsTime: Absolute time (in microseconds) at which the frame is to be sent. Note: When
using the AbsTime time mode parameter, make sure that the first frame sent has a time
value greater than or equal to 10 microseconds, to ensure correct timing between the first
few frames of the scenario.
• TimeAdjNs: Time adjustment (in nanoseconds) for Delay, SFOffset, or AbsTime.
• Burst: BURST_BEGIN specifies the start of a burst sequence. BURST_CONTINUE
specifies that the burst sequence does not end. BURST_END specifies the end of a burst
sequence. IGNORE means not to use a burst sequence.
•Override: Specifies a bitmap that instructs the UWBTrainer to set values for the TFC/BG,
FCS, Scr, and Length fields from the frame template, rather than calculating them
•TimeVar: Specifies the Time variable index associated with a condition registered in a
Register Condition instruction. The Time variable value + the Delay is the absolute time
the frame will be sent. The TimeVar value range is from 0 to 255 and must have been
declared explicitly in a previous RegRxFrmCondition, ConditionRegisterWMRxFrame, StartTimer, or WaitRxFrame instruction.
•Blocking: If TRUE, the frame will be sent out over the air before the following instruction
is executed. If FALSE, the Send Frame instruction will be output into a FIFO, but
instruction execution of the script will continue even if the Send Frame instruction is still
pending. This allows queuing a series of SendFrame commands with little latency
between them. The normal default value is FALSE, but the default can be overridden by
the Blocking setting.
The default for all the parameters is UNDEFINED ( 0xFFFFFFFF ).
38
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
1
Note
: Set Burst to IGNORE if no bursts are being sent. Do not set it to OFF, because the parser
interprets OFF as the end of a Burst sequence and generates parse errors if a Frame was never
sent with Burst ON.
2
: You must associate a Time variable with a condition before using it in a Send Frame
Note
instruction. The script parser generates a parsing error if the TimeVar parameter contains an
index of a Time variable not declared in any Register Condition instruction.
The purpose of associating a Time variable with a condition is that, when the condition triggers,
the condition event timestamp is stored in the Time variable associated with the condition.
Afterwards, the timestamp provides precise scheduling frame transmission because it specifies
the delay after the event occurred.
Delay, SFOffset, and AbsTime are all mutually exclusive. Set only one of these three timing
parameters to a value in a Send instruction, or a parse error will be generated.
Delimit instruction parameters using a comma, as shown in the following examples:
To send a TX_Frame with Delay = 0, Indicate End of a Burst, and No Override:
# Send a frame based on the template 'TX_FRAME'
# using default values.
SendTX_FRAME
# Send a frame based on the template 'TX_FRAME'
# using default values overriding some default
# instruction parameters.
SendTX_FRAME ( Delay = 100 )
SendTX_FRAME( 100 ) # the same as the previous instruction
# Send a frame based on the template 'TX_FRAME_1'
# using overridden values and changing the default delay setting.
SendTX_FRAME_1
{
DestAddr = 0xAABB
SrcAddr = 0xEFBE
Data = { AA BB CC DD 12 34 56 78 [PATTERN_2] }
}
( Delay = 100 ) # Set the 'Delay' to 100000.
# Send a frame and use provided FCS instead of
# automatic calculation.
SendTX_FRAME
{
DestAddr = 0xAABB
SrcAddr = 0xEFBE
Data = { AA BB CC DD }
FCS = 0x11223344 # This value is used as FCS
# for this frame.
}
( Override = OVR_FCS )
40
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Register an RxFrame condition and keep the timestamp of
# the condition event in Time variable #1.
RegRxFrmCondition( HDR_COND, TimeVar = 1 )
{
# Header Mask/Match
PLCP
{
DestAddr = 0xAABB
SrcAddr = 0xBEEF
}
}
# Register a Timer condition and keep the timestamp of
# the condition event in Time variable #1.
StartTimer ( 2000, TimeVar = 1 )
# Wait for any condition to occur.
Wait ( HDR_COND, TIMER )
# Send frame 100 us after either a timer or RxHdr event occurs.
# Note that both conditions specify the same Time variable index:
# No matter which condition event happens first, the Time variable
# keeps the timestamp of either of them.
SendTX_FRAME( TimeVar = 1, Delay = 100 )
{
DestAddr = 0xAABB
SrcAddr = 0xEFBE
}
}
41
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.4 Structure Variable Syntax
Structure variables have a special syntax.
Example
# This syntax instructs the parser to send a frame based on
# some structure variables, avoiding the search for templates.
Send$(Structure variable name)
[
{
Field = Value
...
}
( parameter1, parameter2, ... )
]
Example
Main
{
# Declare a structure variable based on the template 'TX_FRAME'.
$X = TX_FRAME
# Send a frame based on the template 'TX_FRAME'
# using default values.
Send $X
}
9.4.1 Omitting the Send Keyword
You can omit the Send keyword if needed (but this is not recommended).
Example
Main
{
# Send a frame based on the template 'TX_FRAME'
# using default values.
TX_FRAME
}
42
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.5 Changing a Generation Setting
The parser can change some generation settings during script execution.
Format
Set Setting = Value
Example
Main
{
Send TX_FRAME
Send TX_FRAME
Set TxPower = 8# Change TxPower after sending two frames.
Send TX_FRAME
Send TX_FRAME
43
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.6 Register Condition Instructions
You can register different types of "conditions" for which to wait or to use in flow elements, such
as the If element.
Important: At any place in a script, up to 15 user-defined register conditions may be in use
simultaneously. (Note: In addition, the timer register condition named TIMER is always in use.)
After you have defined 15 register conditions in a script, to define a new register condition you
must first revoke a register condition that is no longer in use. To revoke a register condition that is
no longer in use, use the RevokeCondition instruction.
This registers the Rx Frame (header + payload) condition so that the options are automatically
reset when the condition is hit. It is triggered only if it occurs the number of times specified by the
counter parameter.
3
: If no Mask/Match pattern is specified, the system uses any Rx frame.
Note
The instruction named parameters are:
Name: Condition name.
AutoReset: Specifies that the condition is automatically reset after it is triggered.
Count: Specifies the number of times the condition event occurs before the condition is
triggered.
TimeVar: Specifies the index of the Time variable in which to keep the condition
timestamp when it is triggered. Values can range from 0 to 255.
No value indicates that this parameter is ignored.
By default, AutoReset is OFF, Count = 1, and TimeVar = UNDEFINED (timestamp is not
saved).
4
Note
: If mask/match size is less or equal to the size of PHY-MAC header then condition-
matching check is performed considerably faster.
5
Note
: You may declare local fields for frame templates and variable masking/matching. See
section “Using Local Fields in Send Frame Instru
ctions” section for more details.
45
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
You can specify additional matching parameters inside the Register Rx Frame Header +Payload
Condition Instruction block that are not part of the PHY-MAC header and frame payload. Such
parameters include RSSI, LQI, Frame duration ranges, and errors.
Format:RxFrameInfo
{
Parameter 1
…
Parameter N
}
The format of additional condition parameters is defined by the RxFrameInfo structure (defined in
the Generation\Include\ RxFrameInfo.ginc file):
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Register Rx Frame condition: Any Rx Frame with error FCS error
# or Unsupported rate error and a lower duration of 65536-131072 us
# ( the lower duration is checked using a declared local variable,
# Upper_Duration_Lo, which is set to the upper byte of Duration_Lo)
: If the auto_reset parameter is set to 1, then the timer starts counting again. If the
Note
auto_reset parameter is set to 0, then use a ResetTimer instruction to reset the timer.
The instruction named parameters are:
Timeout: Specifies the timer timeout in microseconds.
AutoReset: Specifies that the condition is automatically reset after it is triggered.
TimeVar: Specifies the index of the Time variable in which to keep the condition
timestamp when it is triggered. Values can range from 0 to 255.
No value indicates that this parameter is ignored.
By default, AutoReset is OFF, Timeout = UNDEFINED (Timeout parameter must be set to a
non-zero value to register a Timer condition), and TimeVar = UNDEFINED (timestamp is not
saved).
2
Note
: The timer used in this instruction allows jitter of several microseconds. If you need a
precise timer for scheduling frames, then use TxSleep instruction.
Example
Main
{
# Start the timer with timeout 2000 microseconds.
StartTimer ( 2000 )
Wait( TIMER ) # Wait for the timer to elapse.
}
50
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.7.2 Stop Timer Instruction
This instruction stops the UWBTrainer microsecond resolution timer and revokes the “TIMER”
condition.
Format
StopTimer
Example
Main
{
# Start the timer with timeout 2000 microseconds and the auto_reset
# option.
StartTimer ( 2000, 1)
Wait( TIMER ) # Wait for the timer. The timer will be restarted.
StopTimer # Stop the timer and revoke the “TIMER” condition.
}
9.7.3 Reset Timer Instruction
This instruction resets the UWBTrainer microsecond resolution timer.
Format
ResetTimer
Example
Main
{
# Start the timer with timeout 2000 microseconds.
# The timer has to be reset after elapsing.
StartTimer ( 2000 )
Wait( TIMER ) # Wait for the timer. The timer has to be restarted.
ResetTimer # Reset the timer.
Wait( TIMER ) # Wait for the timer again.
}
51
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.7.4 Sleep Instruction
This instruction instructs UWBTrainer to Sleep for the s pecified number of micros econds before
processing the next instruction.
Format
Sleep ( sleep_value )
The instruction named parameter is:
Timeout: Specifies the timer timeout in microseconds.
Note: The sleep instruction is a shortcut to using Timer and Wait instructions (see the Wait Instructions). The sleep instruction is exactly the same as the following set of instructions:
# Start the timer and register the auto_reset “TIMER” condition.
StartTimer( 2000, YES )
# Send frames during 2000 microseconds.
Until( TIMER )
{ # Send frames.
SendWM_FRAME ( Delay = 1000 )
}
56
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Send frames until condition 'HDR_COND' OR condition 'TIMER'
# triggers.
# Same as Until but clearer for multiple conditions.
Until_Any( HDR_COND, TIMER )
{ # Send frames.
SendWM_FRAME ( Delay = 1000 )
}
# Send frames until condition 'HDR_COND' AND condition 'TIMER'
# trigger.
Until_All( HDR_COND, TIMER )
{ # Send frames.
SendWM_FRAME ( Delay = 1000 )
}
}
57
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.12 Wait for the Next SuperFrame Instruction
This instruction instructs UWBTrainer to wait until the beginning of the next superframe(s) before
processing the next instruction.
Note: This instruction does not delay script execution. It instructs the UWBTrainer transmitter to
wait for the specified number of superframes before sending frames in its Tx queue. It means that
the instruction following WaitForNextSuperFrame will be processed without any delay.
Format
WaitForNextSuperFrame( [ number_of_superframes ] )
The instruction named parameter is:
SFCount: Number of super frames to skip.
If this parameter is set to 0 (the default), UWBTrainer waits for the next
superframe.
By default, SFCount is 0.
Example
Main
{
# Wait for the next superframe.
WaitForNextSuperFrame()
# Send the frame 10 microseconds after the beginning of
# the superframe.
Send WM_FRAME( Delay = 10 )
# Wait for the next superframe, then skip 3 superframes.
WaitForNextSuperFrame( 3 )
Send WM_FRAME
}
58
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.13 TxSleep Instruction
This instruction instructs the UWBTrainer transmitter to pause for a specified timeout before
sending a next frame in its Tx queue.
Note: This instruction does not delay script execution as the Sleep instruction does. It means that
the instruction following TxSleep will be processed without any delay. The TxSleep instruction is
a more precise “sleep” timer than Sleep instruction but it affects only frame scheduling in Tx
queue.
WaitRxFrame registers the Rx Frame and Timer conditions and waits until any of them triggers.
The Rx Frame condition is triggered only if it occurs the number of times specified by the
counter parameter.
Note: If no Mask/Match template is specified, the system waits for any Rx frame.
The instruction named parameters are:
Timeout: Specifies the timer timeout in microseconds.
Count: Specifies the number of times the Rx Frame condition event occurs before the condition is triggered.
TimeVar: Specifies the index of the Time variable in which to keep the condition
timestamp when it is triggered. Values can range from 0 to 255.
No value indicates that this parameter is ignored.
By default, Timeout = 0xFFFFFFFF, Count = 1, and TimeVar = UNDEFINED (timestamp is not
saved).
For more details about Additional condition parameters please refer to topic
# Check that ANY condition in the condition list is true.
If_Condition( HDR_COND )
{
# Do something.
}
# Check that ANY condition in the condition list is true.
# Same as If but clearer for multiple conditions
If_Any( HDR_COND, HDR_COND )
{
# Do something.
}
# Check that ALL conditions in the condition list are true.
If_All( HDR_COND, HDR_COND2 )
{
# Do something.
}
# Example with 'else' statement
if_condition( HDR_COND )
{
# Do something.
}
else_condition
{
# Do something else.
}
}
63
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.16 Loop Instruction
You can run some code in a loop, a limited or unlimited number of times.
Format
Loop [( counter )]
[
{
instruction_1
...
instruction_n
}
]
Note: If the counter parameter is omitted or set to INFINITE, the loop is executed infinitely. You
can use BreakLoop instruction to break loop code execution and jump the next after Loop
instruction.
Example
Main
{
Loop( 100 ) # Run the instructions below 100 times.
{
Send TX_FRAME
Send TX_FRAME
}
# Run an infinite loop. User interaction is required to break it.
Loop
{
Send TX_FRAME
Send TX_FRAME
}
}
64
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.17 BreakLoop Instruction
You can break Loop instruction code execution and jump to the next after Loop instruction.
Format
BreakLoop
Example
Main
{
# Start 100 us timerStartTimer( 100 )
# Run an infinite loop.
Loop
{
# Break the loop after timer expires.
If_Condition( TIMER ) { BreakLoop }
Send TX_FRAME
}
}
65
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.18 Exit Instruction
You can stop script execution at any time.
Format
Exit
Example
Main
{
# Start the timer with timeout 10 seconds.StartTimer( 10 * 1000000 )
# Run an infinite loop. User interaction is required to break it. Loop
{
Send TX_FRAME
Send TX_FRAME
If_Condition( TIMER )
{
# Stop script execution after sending frames for 10
# seconds.
Exit
}
}
}
66
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.19 Analyzer Control Instructions
You can control the UWBTracer™ from the script.
9.19.1 StartRecording Instruction
You can instruct the application to start recording on UWBTracer.
Format
StartRecording ([ recording_options, trace_file, keep_old_trace ] )
recording_options: Optional parameter specifying the path to the file containing the
recording options. If it is omitted, the current UWBTracer recording options are used.
trace_file: Optional parameter specifying a file name for the recorded trace. If it is omitted,
the file name provided in the recording options is used.
keep_old_trace: Optional parameter specifying that the application should not overwrite a
trace with the same file name. It should use a similar but different new file name. If it is omitted,
the old trace file is overwritten.
The instruction named parameters are:
RecOpt: See recording_options parameterfor details.
TraceName: See trace_file parameter for details.
KeepOldTrace: See trace_file parameter for details.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.19.2 StopRecording Instruction
You can instruct the application to stop recording on UWBTracer.
Format
StopRecording ( [ wait_for_trace, force_stop_recording ] )
wait_for_trace: Optional parameter specifying that the UWBTrainer should not proceed until
the application uploads the recorded trace. If it is omitted, the application stops recording and
starts the uploading process, and UWBTrainer proceeds without waiting until the trace file is fully
uploaded.
force_stop_recording: Optional parameter specifying that the application should stop
recording and start the uploading process even if the recording was not started by the script. If it
is omitted, the application stops recording and starts the uploading process only if the script
started the recording.
The instruction named parameters are:
WaitForTrace: See wait_for_trace parameterfor details.
ForceStopRec: See force_stop_recording parameter for details.
Examples
Main
{
# Stop recording and wait for trace even if the script didn’t start
# it.
StopRecording( 1, 1 )
StartRecording( "C:\\my_rec.rec", "C:\\Test1.uwb" )
Send TX_FRAME
Send TX_FRAME
StopRecording( 1 ) # Stop recording and wait for trace.
TriggerAnalyzer # Send a trigger signal to the analyzer. Send TX_FRAME
Send TX_FRAME
}
9.19.4 Trace Instruction
You can instruct the application to display a trace message in the application output window.
Format
Trace( trace_message )
trace_message: Trace message to display.
Note: This instruction does not block script execution. If many trace messages are sent in a short
period of time, some of them may be dropped and not displayed. Use the Trace_B instruction
(see below) to guarantee trace message displaying.
Examples
Main
{
Send TX_FRAME
Send TX_FRAME
Trace( "2 frames were sent." ) # Does not block script execution.
Send TX_FRAME
Send TX_FRAME
Trace( "4 frames were sent." ) # Does not block script execution.
}
69
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
9.19.5 Trace_B Instruction
You can instruct the application to display a trace message in the application output window. The
script will stop and will not proceed until the application displays the trace message .
Format
Trace_B( trace_message )
trace_message: Trace message to display.
Note: This instruction blocks script execution to guarantee trace message displaying. However,
this can break precise timing sequences. Use the Trace instruction (see above) if you do not
want to block script execution.
Examples
Main
{
Send TX_FRAME
Send TX_FRAME
Trace_B( "2 frames were sent." ) # Blocks script execution.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10 Advanced Script Parser Features
The script parser has some advanced features that simplify creation of complicated generation
scenarios. Such features include:
• Using local and global integer variables
• Using local and global structure variables
• Using special data pattern cre ators in field assignments
• Using multipliers with struct variables in field assignments
• Using = + in field assignments
• Initializing struct variables from hex streams
• Supporting arithmetic operations with parse r varia bles
• Supporting concatenation operations for structure vari ables
• Using parser sizeof operators
• Using parser while, for, and if-else operators
• Calling generation procedures with parameters
• Allowing users to trace/debug the parser and follow va riable and template construction
• Supporting name aliasing for constants, settings, data patterns, templates, variables,
instructions and named instruction parameters.
•Using include paths to spe cify additional folders in which to look for included files
10.1 Local Numeric Parser Variables
You can declare a local numeric parser variable, which is seen only inside the generation
procedure, and use it in field assignments.
Format
[ Local ] var = expression
Note: The Local keyword is required if you already have a global variable with the same name.
Using this keyword explicitly instructs the script parser to declare a local variable with the same
name.
Example
y = 10 # Declare a global numeric variable with name 'y'.
Main
{
x =0xAABB# Declare a local variable 'x'.
Localy = 20 # Explicitly declare a local variable 'y'
SendTX_FRAME
{
DestAddr = x# Use the previously assigned variable 'x'
SrcAddr = y + 10# Use the previously assigned variable 'x' + 10
SeqCtrl = z # Create a new variable 'z' with value 0.
}
}
71
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.2 Local Structure Parser Variables
You can declare a local "structure" parser variable, which is seen only inside the generation
procedure, and use it in a Send Frame instruction and field assignments.
Note: The Local keyword is required if you already have a global variable with the same name.
Using this keyword explicitly instructs the script parser to declare a local variable with the same
name.
Example
Main
{
# Declare a variable X as a frame of type MY_TX_FRAME.
$X = MY_TX_FRAME
# Note: Frame variables can be declared/redeclared and used many times.
# Declare a variable Y and change the default frame.
$Y = MY_TX_FRAME
# Template field values.
{
DestAddr = 0xAABB
SrcAddr = 0xEFBE
}
# Declare a variable Z using the frame variable Y as a prototype.$Z = Y
{
DestAddr = 0x1122
SrcAddr = 0x3344
}
Local $Z = Y# Explicitly declare a local variable.
# Declare a structure variable having the same name as one of the
# templates.
$MY_TX_FRAME = MY_TX_FRAME
{
DestAddr = 0xAABB
SrcAddr = 0xEFBE
}
72
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Explicitly instruct the script parser to create a new
# structure variable based on the other structure variable rather
# than a template.
$W = $MY_TX_FRAME
# Send a frame based on the structure variable.
Send $W
}
73
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
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 frame 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
# 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 is 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
}
74
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.4 Changing Structure Parser Variables
You can change a structure variable in a generation procedure by changing a field value, length,
offset, or hex stream assignment, or you can add to or edit the structure variable by declaring
local fields. You can also redeclare the variable.
1
Note
: If you change a structure variable by a hex stream assignment and the structure variable
has some variable-length fields, then only the first variable-length field is filled with data and all
other variable-length fields have zero length.
2
Note
: If you declare local fields within a structure variable, they are only valid in that structure
variable, not the frame template. New structure variables can be declared 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, and this will generate parse errors.
# Assign some values at some offsets:
# The format is $PktVar[offset, length] =
# appropriate field assignment (numeric value, data pattern, etc.)
$X[16,8] = 0xAA$X[16] = 0xAA
75
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Note: If the length value is omitted, the default is 8 bits.
offset = 16# Preprocessor variable keeps the offset.
len = 8# Preprocessor variable keeps the length.
$X[offset, len] = 0xAA$X[offset] = 0xAA
$Y = MY_STRUCT
# Change the structure variable from a hex stream.
$Y = { 11 22 33 44 55 66 77 88 }
# After the above change, the variable Y fields have the
# following values:
# Y.V1 = { 11 22 }
# Y.V2 = 0x33
# Y.V3 = 0x44
# Y.V4 = { 55 66 77 88 }
# Change $Y from the above to {AA BB CC DD 55 66 77 88} and
# add local field F6 to variable X.
$Y { V_123 : 0, 32 = { AA BB CC DD }
$Z = MY_STRUCT_2
# Attempt to copy $Y to $Z. This will NOT work and may or may not
# generate a parse error.
# If no error is generated, the parser skipped this instruction.
# (Because $Z is derived from MY_STRUCT_2 and $Y is no longer
# purely MY_STRUCT_2 with its local variables,
# this assigment is not valid).
$Z = $Y
# Copy $Y to a newly instantiated $W structure variable.
# This is legal because $W does not have a frame template
# associated with it, because it is being declared.
$W = $Y
# Change $Y from the above to
# {AA BB CC DD 55 66 77 88 00 00 00 00 FF FF}
# and add local variable V5 at offset 96 with length 16.
# Offset 64-95 is padded with zeroes.
$Y { V5 : 96, 16 = { FF FF } }
76
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Send a frame of {FF 00FE FD FC 66 77 88 00 00 00 00 FF FF} by
# modifying $Y from the above and
# instantiate local variables V3_1 and V3_2 for use
# in this send instruction only. [ No $ = send ]
$X = MY_STRUCT_2
# Change the structure variable from a hex stream.
$X = { 11 AA BB CC DD 22 33 44 BE EF BE EF }
# After the above change, the variable X fields have the
# following values:
# X.F1 = 0x11
# X.F2 = { AA BB CC DD }
# X.F3 = { 22 33 44 }
# X.F4 = empty
# X.F5 = { BE EF BE EF }
# Change $X from the above to
# {11 AA BB CC DD 22 33 44 BE F0 0D F0 0D}
# and add local field F6 to variable X.
# The variable length fields F3 & F4 are treated as empty
# and F5 is treated as having offset 40-71,
# hence F6 occupies offset 72-103.
$X { F6 : 32 = { F0 0D F0 0D } }
# Change $X from the above to
# {11 02 01 04 03 22 33 44 BE F0 0D F0 0D}
# and add local fields F2Lower and F2Upper to variable X.
$X{
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
# Change $X from the above to
# {C0 01 C0 DE 11 22 AA EE BE F0 0D F0 0D}
# and add local field F1_F2 and B3 to variable X.
# B3 is only 16 bits long, hence only AA EE is taken as data,
# and FF BB is truncated.
$X
{
F1_F2 : 0, 40 = { C0 01 C0 DE 11 } B3 : 48, 16 = { AA EE FF BB } #Note: B3 is only 16 bits long.
}
# Send a frame of {C0 01 C0 DE 11 22 AA EE 44 55 22 33 44} by
# modifying $X from the above.
# Existing local field F6 is used and
# F7 is instantiated for use in this Send instruction only.
# F6 fills in from offset 72-103,
# because that is where it became declared
# when created in $X earlier.
# F7 fills in offset 64-79,
# because variable length fields F3 and F4 still exist,
# and there is a hole between offset 63-72.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.5 Sending Frames using Structure Variables
You can send a frame based on some frame variable.
Examples
Main
{
# Send a frame based on the frame variable X using overridden values.
# Note: Frame variable X field values are NOT changed.
# '$' may be omitted after the 'Send' keyword,
# but if there is a template X, it is used instead of
# the structure variable X.
SendX
{
FrameType = 2
DestAddr = 0xAABB
SrcAddr = 0xEFBE
Data = { AA BB CC DD 12 34 56 78 [PATTERN_2] }
}
# '$' explicitly indicates that you want to send a frame
# based on the structure variable X.
Send$X
{
FrameCtrl = 0xC018# Assign the whole multi-byte field.
SeqCtrl = 0x1234# Assign the whole multi-byte field.
}
# Short syntax.
# Send a frame based on the frame variable X having delay 50 us
X ( 50 )
}
79
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.6 Using Special Data Pattern Creators in Field
Assignments
You can use special pattern constructors to simplify creation of data patterns.
Examples
Main
{
# Examples of using special data pattern declarations while
# assigning field values.
Send TX_FRAME
{
SrcAddr = 0xEFBE
Data = { 01 02 03 00 0A } # Simple byte stream
Data = PATTERN_2 # Use declared data pattern.
# Use combined byte stream.
Data = { AA BB CC DD 12 34 56 78 [PATTERN_2] }
Data = 12, 0xAA# Specify data payload of 12 bytes and
# fill it by 0xAA: AA AA AA AA ... AA
# Specify data payload of 12 bytes and fill it starting
# from 1, incrementing each byte by 2: 01 03 05 07 09 ...
Data = 12, 1, 2
}
}
80
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.7 Using Structure Variables to Assign Field Values
You can use structure variables in field assignments. Also See Section Using Multipliers to
Assign Field Values.
Examples
Main
{
# Use structure variables to assign field values.
# Declare a 'structure' instance based on the template S1.
$S = S1
# Declare a 'structure' instance based on the template S2
# and change the default value for the S16 field.
$W = S2 { S16 = 2}
SendTX_FRAME
{
Data = $S# Data field contains the payload of structure S.
}
SendTX_FRAME
{
# Example of concatenation of structures.
# Data field contains combined payload of structuresS and W
Data = $S + $W
}
}
81
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.8 Using Multipliers to Assign Field Values
You can use a "multiplier" to assign repeated data and create complex assignments. This
multiplier only works on structure variables when assigning fields.
Note: Though this multiplier uses the symbol
Examples
Generic $X
Generic $Y
Main
{
# Use multipliers to assign field values.
# Declare a packet variable of 'structure' instance Generic with
# data FB 01 02
$TestIE = Generic { Data = { FB 01 02 } }
# Declare a 'structure' instance based on the template S2
# and change the default value for the S16 field.
$S2_Var = S2 { S16 = 2}
SendTX_FRAME
{
Data = 10*$TestIE # Data field contains the sequence of $TestIE
*, this multiplier is not the arithmetic multiplier.
82
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.9 Using the Append Operator in Field Assignments
You can append data to fields using = + (append operator) in field assignments. Use the append
operator to generate dynamic packets and avoid restating previously assigned values. For
example, if a packet variable field SomeField contains “01 02 03”, to add “04 05 06” you can
assign SomeField = +{04 05 06} ), rather than assigning SomeField = {01 02 03 04 05 06}.
Note:Do not confuse this operator with the += operator, or a parse error will be generated!
You can write the append operator as = + or =+ (without a space), but it is recommended to use
the space to avoid confusion with the += operator.
for(i=4, i<17, i++)
{
if (i!=11)
{
$Beacon11_BPOIE{ DevAddrList = +{ i 00 } }
}
}
... ... ... ...
}
83
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.10 Initializing Struct Variables from Hex Streams
You can assign structure variables using hex streams. Rather than defining each field within a
structure variable, set the structure variable equal to a hex/byte stream. The fields within the
structure variable are then assigned based on the offset.
10.10.1 Assignments for Variables with Fixed-length Fields
For structure variables composed of fixed length fields (so that the the structure variable has fixed
length), assignments by hex streams fill the fields in offset order. Any overflow from the
hex stream is truncated. For example, assigning an eight-byte structure variable to a twelve-byte
hex stream loses the last four bytes of the hex stream.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.10.2 Assignments for Variables with Variable Length Fields
For structure variables that have one variable length field:
1. The hex stream fills all fixed-length fields prior to the first variable-length field, using a top-
down approach.
2. The hex stream fills all fixed-length fields following the variable-length field using a bottom-up
approach, in which the required number of bytes come from the end of the hex stream and
the fixed-length fields are filled in order.
3. The hex stream fills the variable-length field with the remaining bytes from the middle of the
hex stream.
If a structure variable has more than one variable-length field (including interleaved variablelength and fixed-length fields), only the first variable-length field receives data. Later variablelength fields receive no data and are blank. For these types of structure variables, it is not
recommended to explicitly modify fields after assignment from a hex stream because data will not
be logically assigned. Essentially, a structure variable with more than one variable-length field
becomes a structure variable with only one variable-length field, the first one listed in offset order.
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.15 Forward Declarations
You can use declared items in generation procedures before their d eclarations.
Example
Main
{
# The frame template 'SOME_PKT_TEMPLATE' is declared later.
SendSOME_PKT_TEMPLATE
{
Field0 = 0xAABBCCDD
}
Call Block1() # The procedure 'Block1' is declared later.
# Declare the 'SOME_PKT_TEMPLATE' frame template used above.
FrameSOME_PKT_TEMPLATE
{
Field0 : 32 = 0xFEFEFEFE
}
}
# Declare the procedure 'Block1' used above.
Block1
{
Send TX_FRAME
}
91
LeCroy CorporationUWBTrainer Exerciser - Generation Script Language Reference Manual
10.16 RAND Token
You can use a RAND token in places where numeric literals are used to insert pseudo-random
numbers in the range 0 to 0x7fff.
Note: By default, RAND uses a different integer seed value every time the script is compiled. You
can set the seed using the RandSeed setting (for the RandSeed setting description, see the
"Generation Setting" topic).
Example
Main
{
# The frame template 'SOME_PKT_TEMPLATE' is declared later.
SendSOME_PKT_TEMPLATE
{
Field0 = { 00RANDRAND RAND RAND00 } # Set random hex
# stream.
}
x = RAND# Assign a random value to the numeric variable.
}
10.17 RandStream( n ) Primitive
The RandStream( n ) primitive is a utility, based on the RAND token, that produces a random
byte stream, where n is the number of bytes in the stream.
Note: For a description of random seeding, see the Note in the "Rand Token" section
(preceding).
Example
Main
{
# The frame template 'SOME_PKT_TEMPLATE' is declared later.
SendSOME_PKT_TEMPLATE
{
Fieldof32bytes = RandStream(32) # Set a random 32-byte stream.
}
}
92
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.