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}