Teledyne UWBTrainer User Manual

Protocol Solutions Group 3385 Scott Blvd., Santa Clara, CA 95054 Tel: +1/408.727.6600 Fax: +1/408.727.6622
UWBTrainer™ Exerciser
Reference Manual
Manual Version 1.02
For UWBTracer/UWBTrainer Software Version 3.02
November 2007
LeCroy Corporation UWBTrainer 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.

Copyright

Copyright © 2007, LeCroy Corporation. All Rights Reserved. This document may be printed and reproduced without additional permission, but all copies
should contain this copyright notice.
Version
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 Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

Contents

1 INTRODUCTION
1.1 Declaration Conventions ................................................................1
1.1.1 Parentheses...................................................................................1
1.1.2 Brackets.........................................................................................1
1.2 Script Example Highlighting............................................................1
.....................................................................1
2 SCRIPT LANGUAGE STRUCTURE.......................................2
2.1 Generation Script Structure............................................................2
2.2 Main Procedure and Other Procedures..........................................2
3 COMMENTS ...........................................................................3
3.1 Line Comment ................................................................................3
3.2 Block Comment ..............................................................................3
4 FILE-INCLUDING DIRECTIVES.............................................4
4.1 Inline Directive................................................................................4
4.2 Include Directive.............................................................................4
5 CONSTANT DECLARATIONS...............................................5
5.1 Predefined Constants.....................................................................5
5.2 Constant Definition Examples ........................................................5
6 DATA PATTERN DECLARATIONS.......................................6
6.1 Constants and Data Patterns in Declarations ................................6
6.2 Leading Zeroes...............................................................................6
7 GLOBAL GENERATION SETTINGS .....................................7
7.1 Generation Settings........................................................................7
7.2 Simulation Settings.......................................................................10
7.3 Generation Settings Syntax..........................................................11
7.4 Generation Settings outside Procedures......................................11
7.5 Generation Settings inside Procedures........................................12
7.6 Arithmetic Expressions in Constants............................................12
8 FRAME AND STRUCTURE TEMPLATE DECLARATIONS 13
8.1 Predefined Frame/Structure Templates.......................................13
8.2 Field Definitions............................................................................14
8.2.1 Defining a Field at a Specific Offset ............................................14
8.2.2 Defining a Field at the Current Offset..........................................15
8.2.3 Defining a Field with Variable Length..........................................16
8.2.4 Defining a Default Field Value.....................................................17
8.2.5 Specifying Byte Order in Field Definitions...................................18
8.2.6 Using Byte Stream Literals in Field Assignments........................18
8.2.7 List of Possible Field Values Attribute.........................................19
8.2.8 Defining Subfields........................................................................20
8.3 Constants/Arithmetic Expressions in Template Declarations.......22
8.4 Frame Template Inheritance ........................................................24
8.4.1 Frame Template Single Inheritance ............................................24
8.4.2 Frame Template Multiple Inheritance..........................................26
8.4.3 Frame Template Insert Directive.................................................28
8.4.4 Complex Frame Templates.........................................................30
iii
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
8.5
Frame Template Multi-byte Field Byte Order Attribute.................32
8.5.1 Big Endian Byte Order.................................................................32
8.5.2 Another Example.........................................................................33
8.6 Structure Declaration Examples...................................................35
9 GENERATION PROCEDURES ............................................36
9.1 Send Frame Instruction................................................................36
9.2 Using Local Fields in Send Frame Instructions............................36
9.3 Instruction Parameters .................................................................38
9.4 Structure Variable Syntax.............................................................42
9.4.1 Omitting the Send Keyword.........................................................42
9.5 Changing a Generation Setting....................................................43
9.6 Register Condition Instructions.....................................................44
9.6.1 Register Rx Frame Header+Payload Condition Instruction ........44
9.7 Timer Instructions.........................................................................50
9.7.1 Start Timer Instruction.................................................................50
9.7.2 Stop Timer Instruction .................................................................51
9.7.3 Reset Timer Instruction ...............................................................51
9.7.4 Sleep Instruction..........................................................................52
9.8 Revoke Condition Instruction........................................................53
9.9 Reset Condition Instruction ..........................................................54
9.10 Wait Instructions...........................................................................55
9.11 Until Instructions...........................................................................56
9.12 Wait for the Next SuperFrame Instruction....................................58
9.13 TxSleep Instruction.......................................................................59
9.14 Wait Frame Shortcut Instructions.................................................60
9.15 If Instructions ................................................................................62
9.16 Loop Instruction............................................................................64
9.17 BreakLoop Instruction...................................................................65
9.18 Exit Instruction..............................................................................66
9.19 Analyzer Control Instructions........................................................67
9.19.1 StartRecording Instruction...........................................................67
9.19.2 StopRecording Instruction...........................................................68
9.19.3 TriggerAnalyzer instruction..........................................................69
9.19.4 Trace Instruction..........................................................................69
9.19.5 Trace_B Instruction .....................................................................70
10 ADVANCED SCRIPT PARSER FEATURES........................71
10.1 Local Numeric Parser Variables...................................................71
10.2 Local Structure Parser Variables..................................................72
10.3 Using Local Fields in Structure Variables.....................................74
10.4 Changing Structure Parser Variables...........................................75
10.5 Sending Frames using Structure Variables..................................79
10.6 Using Special Data Pattern Creators in Field Assignments.........80
10.7 Using Structure Variables to Assign Field Values........................81
10.8 Using Multipliers to Assign Field Values ......................................82
10.9 Using the Append Operator in Field Assignments .......................83
10.10 Initializing Struct Variables from Hex Streams.............................84
10.10.1 Assignments for Variables with Fixed-length Fields...............84
10.10.2 Assignments for Variables with Variable Length Fields.........85
10.11 Sizeof Operators...........................................................................87
10.12 Preprocessor Integer Arithmetic...................................................88
10.13 Preprocessor If Operator..............................................................89
10.14 Preprocessor Loop Operators......................................................90
10.15 Forward Declarations ...................................................................91
10.16 RAND Token.................................................................................92
iv
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
10.17
RandStream( n ) Primitive............................................................92
10.18 Global Numeric and Structure Variables......................................93
10.19 Using the Call Directive for Generation Procedure Insertions......94
10.19.1 Calling Another Generation Procedure with Parameters.......94
10.19.2 Calling a Generation Procedure with No Parameters............98
10.19.3 Nested Calls Using Global Variables......................................99
10.20 Parser Tracing Functions ...........................................................100
10.20.1 PTrace( ) : Parser Trace.......................................................100
10.20.2 PTraceVar( ) : Parser Trace Variable...................................101
10.20.3 PtraceVarEx( ) : Parser Trace Variable Extended................102
10.20.4 PtraceTemplate( ) : Parser Trace Template.........................105
10.21 Name Aliasing.............................................................................107
10.22 Include Path Directive.................................................................108
11 APPENDIX A – GENERATION SCRIPT EXAMPLE ..........109
12 HOW TO CONTACT LECROY...........................................116
v
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
List of Instructions, Comments, Definitions, Directives,
Operators, Parameters, Primitives, Procedures, and Settings
AbsTime_parameter....................................................................................................................................38
AddMissingFields_setting
aliasing......................................................................................................................................................107
append operator AutoReset_parameter
block_comment.............................................................................................................................................3
BreakLoop..................................................................................................................................................
Burst_parameter
Call directive
Commentss................................................................................................................................................... 3
ConditionRegisterWMRxFrame instruction ConditionReset instruction ConditionRevoke instruction constants instruction
Count_parameter
DataPattern instruction
Delay_parameter DelayNs_parameter
Exit..............................................................................................................................................................74
fields_definition
fld_size_operator.........................................................................................................................................14
ForceStopRec_parameter
Frame instruction
FrameDelay_s
If_All instruction If_Any instruction If_Condition instruction %include dir %inline directiv
KeepOldTrace_param
line_comment................................................................................................................................................3
Local instruction Loop instruction Main procedure
MaxLoopIterCount_parser_setting MaxLoopIterCount _s
multiplier instruction
Name_parameter Override_parameter
Packet instr
pkt_size_operator........................................................................................................................................87
directive.......................................................................................................................................................89
PTrace instr PTraceTemplate instr PTraceVar instruction PTraceVarEx instruction
pttn_size_operator ......................................................................................................................................87
RAND token ...............................................................................................................................................92
RandSeed_setting
RandStream_primiti
Receive_setting............................................................................................................................................. 8
..........................................................................................................................................83
.........................................................................................................................................38
..............................................................................................................................................94
........................................................................................................................................45
.........................................................................................................................................38
...........................................................................................................................................66
......................................................................................................................................68
etting....................................................................................................................................13
........................................................................................................................................62
......................................................................................................................................62
ective...................................................................................................................................108
e..........................................................................................................................................4
.......................................................................................................................................71
........................................................................................................................................64
...........................................................................................................................................2
........................................................................................................................................45
uction.....................................................................................................................................13
uction...................................................................................................................................100
.........................................................................................................................................8
.............................................................................................................................8
.................................................................................................................................50
73
...........................................................................................44
......................................................................................................................54
...................................................................................................................53
..................................................................................................................................5
..............................................................................................................................6
....................................................................................................................................59
...........................................................................................................................87
............................................................................................................................62
eter...........................................................................................................................67
..............................................................................................................90
etting...........................................................................................................................8
................................................................................................................................82
....................................................................................................................................38
uction...................................................................................................................105
.............................................................................................................................101
........................................................................................................................102
ve..............................................................................................................................92
vi
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
RecOpt_parameter......................................................................................................................................67
RegRxFrmCondition instruction ResetCondition instruction
.............................................................................................................45
......................................................................................................................54
ResetTimer.................................................................................................................................................59
RevokeCondition instruction
RxSimulationMode_setting
Send instruction Set instructi
SFOffset_parameter SimAnalyzerPhy_s
........................................................................................................................................36
on........................................................................................................................................... 11
....................................................................................................................................38
etting.............................................................................................................................10
...................................................................................................................53
.........................................................................................................................10
SimUseElseBranch_setting.........................................................................................................................10
Sleep instruction StartRecording instruction StartTimer instruction StopRecording instruction
.......................................................................................................................................52
.......................................................................................................................67
...............................................................................................................................50
.......................................................................................................................68
StopTimer...................................................................................................................................................59
Struct instruction
subfields_defi SuperFramePeriod_setting TimeAdjNs_parameter Timeout_parameter TimeVar_parameter
Trace instruction Trace_B instruction
TraceName_parameter
......................................................................................................................................13
nition......................................................................................................................................20
...........................................................................................................................8
................................................................................................................................38
.....................................................................................................................................52
....................................................................................................................................50
.......................................................................................................................................69
..................................................................................................................................70
...............................................................................................................................67
TriggerAnalyzer.........................................................................................................................................77
TxSleep instruction Until instruction Until_All instruction Until_Any instruction
UwbRxChannel_s UwbTxChannel_setting UwbTxPower_s
Wait instruction Wait_All instruction Wait_Any instruction WaitForNextSuperFrame instruction
WaitForTrace_parameter
WaitRxFrame instruction
...................................................................................................................................59
.........................................................................................................................................56
..................................................................................................................................56
................................................................................................................................56
etting.................................................................................................................................7
.................................................................................................................................7
etting....................................................................................................................................7
.........................................................................................................................................55
..................................................................................................................................55
................................................................................................................................55
......................................................................................................58
............................................................................................................................68
..........................................................................................................................60
vii
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
[blank page]
viii
LeCroy Corporation UWBTrainer 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
( Packet | Frame | Struct ) Template_Name [ Ancestor_1, Ancestor_ 2, … ]
[ (Attribute list) ]
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 Corporation UWBTrainer 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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
# the Tx frame
# Payload offset(in bits) for the Rx frame
const RX_PAYLOAD_OFFSET = TX_PAYLOAD_OFFSET + HDR_ERR_SIZE
# Example of a complex name in an expression
const MY_Data = ["Some Hex Data"] + 12
5
LeCroy Corporation UWBTrainer 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.
DataPattern Pattern_Name = { hex_stream }
Example
# Declare a data pattern containing the byte string: # AA BB CC DD DD EE FF 11 22 33 44 55
DataPattern PATTERN_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
DataPattern PATTERN_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
DataPattern PATTERN_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 Corporation UWBTrainer 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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).
Default: FALSE
Figure 7.1: Channel Mapping (PHY Spec 1.1 Table 7.7)
9
LeCroy Corporation UWBTrainer 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: 1 (RF simulation mode) Specifies simulation analyzer PHY settings for
RF simulation mode. It is used only when RxSimulationMode = 1.
Possible values (constants are defined in gen_constants.ginc) are:
PHY_WISAIR_REV_B = 0x11 PHY_WISAIR_REV_C = 0x12 PHY_WISAIR_REV_532 = 0x13 PHY_ALEREON = 0x30
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 Corporation UWBTrainer 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.
Set FrameDelay = 12000
11
LeCroy Corporation UWBTrainer 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.
Main
{
Set FrameDelay = 24000 # Set during runtime.
}

7.6 Arithmetic Expressions in Constants

You can use arithmetic expressions, such as
+, -, *, /, %, >>, <<, &, |, ^, and ()
to define setting values.
Example
Const SOME_CONST = 5 set FrameDelay = ( 2000000 + 5 ) >> ( 8 + SOME_CONST )
12
LeCroy Corporation UWBTrainer 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.
Note
( Packet | Frame | Struct ) Template_Name [ : Ancestor_1, Ancestor_ 2, … ] [ (Attribute list) ]
[
{ Field Definition 1 Field Definition 2 ... }
]
2
: 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:
UWBTracer\Generation\Include\main_pkt_templates.ginc
13
LeCroy Corporation UWBTrainer 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.
Frame SomeTemplate
{ 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 Corporation UWBTrainer 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.
Frame SomeTemplate
{ 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 Corporation UWBTrainer 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'.
Frame Some 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'.
Frame Some 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 Corporation UWBTrainer 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.
Frame SomeTemplate
{ 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 Corporation UWBTrainer 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.
Frame Mixed
{ F1 : 16 F2 : 32 (MSB) F3 : 16 (MSB) = 0xAABB F4 : 32 = 0xAABBCCDD }
# Template with the same field layout as the template above
Frame MSBMixed (MSB)
{ F1 : 16 (LSB) F2 : 32 F3 : 16 = 0xAABB F4 : 32 (LSB) = 0xAABBCCDD }

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 Corporation UWBTrainer 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 Corporation UWBTrainer 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 little­endian 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 Corporation UWBTrainer 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}
}
# Send a frame with payload: 0A 00 EE
Send Templ_2
{ F1 = 0xA SF1 = 0xEE
}
}
Frame PLCP_PART
{
FrameCtrl
{ Reserved3 : 2 Retry : 1 CtrlType : 4 FrameType : 3 AckPolicy : 2 Secure : 1 Version : 3 } DestAddr : 16 SrcAddr : 16
}
21
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

8.3 Constants/Arithmetic Expressions in Template Declarations

You can use constants and arithmetic expressions in both field definitions and value declarations.
Examples
const BM_LENGTH = 1
# Declare the frame template 'PLCP'.
Frame PLCP
{
# PHY HEADER # Declare the field 'Rate' ( offset : 0, length : 5 bits ), having # default value RATE_53MBS ( 0 ).
Rate : 5 = RATE_53MBS Reserved0 : 3 Len7_0 : 8 Scr : 2 Reserved1 : 2 Len11_8 : 4 BG : 1 TFCode : 3 = 1 PreType : 1 BM : BM_LENGTH # Constant in a field definition. Reserved2 : 10
22
LeCroy Corporation UWBTrainer 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.
FrameCtrl { Reserved3 : 2 Retry : 1 CtrlType : 4 FrameType : 3 AckPolicy : 2 Secure : 1 Version : 3 DestAddr : 16 SrcAddr : 16 }
#------- Sequence Control -------
# Another example of a complex multi-byte field.
SeqCtrl { Reserved4 : 1 MoreFrag : 1 SeqNum : 11 FragNum : 3 }
#------- Access Information -------
# Another example of a complex multi-byte field.
AccInfo { AccMthd : 1 MoreFrms : 1 Duration : 14 } }
23
LeCroy Corporation UWBTrainer 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
Frame TX_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
Frame PLCP_RX : PLCP
{ HDERsvd : 3 HDError : 5 }
# Template for generic TX frame
Frame TX_FRAME : PLCP_TX
{ Data : * FCS : 32 # calculated automatically }
24
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
# Template for generic RX frame
Frame RX_FRAME : PLCP_RX
{ Data : * FCS : 32 # Calculated automatically RSSI : 8 LQI : 8 RXERsvd : 3 RXError : 5 }
# Example of declaration of some field at some offset and # declaration of some consecutive fields after that.
const OPCODE_OFFSET = 128 Frame TX_FRAME_1 : TX_FRAME
{
# 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.
Frame MY_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 data pattern.
Data = PATTERN_4 }
25
LeCroy Corporation UWBTrainer 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
Frame Base
{ F1 : 16 F2 : 8 F3 : 32 }
Frame Templ_0
{ FieldT0_8 : 8 FieldT0_16 : 16 }
Frame Templ_1
{ FieldT1_24 : 24 FieldT1_32 : 32 }
Frame Combined : 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 Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Examples
# Frame payload fields
struct FramePldFields
{ Data : * FCS : 32 }
# RX frame header error fields
Struct HdrErrFields
{ HDERsvd : 3 HDError : 5 }
# RX frame payload error fields
Struct RxErrFields
{ RSSI : 8 LQI : 8 RXERsvd : 3 RXError : 5 }
# Template for generic TX frame
Frame TX_FRAME : PLCP, FramePldFields
{ }
# Template for generic RX frame
Frame RX_FRAME : PLCP, HdrErrFields, FramePldFields, RxErrFields
{ }
27
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

8.4.3 Frame Template Insert Directive

You can insert field layouts from another template after a specific field in a template. Use the
insert or
Example 1
Frame Base
{ F1 : 16 F2 : 8 F3 : 32 }
Frame Templ_0
{ FieldT0_8 : 8 FieldT0_16 : 16 }
Frame Templ_1
{ FieldT1_24 : 24 FieldT1_32 : 32 }
Frame Combined : Base
{ Cmb_F1 : 8 insert Templ_0 # Insert fields from frame template Templ_0. Cmb_F2 : 16 insert Templ_1 # Insert fields from frame template Templ_1. Data : 32 }
':' directive.
The Combined template above has the fields:
F1 16 # Base F2 8 # Base F3 32 # Base Cmb_F1 8 # Combined FieldT0_8 8 # Templ_0 FieldT0_16 16 # Templ_0 Cmb_F2 16 # Combined FieldT1_24 24 # Templ_1 FieldT1_32 32 # Templ_1 Data 32 # Combined
28
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Example 2
Frame Combined : Base
{ Cmb_F1 : 8 : Templ_0 # insert fields from frame template Templ_0 Cmb_F2 : 16 : Templ_1 # insert fields from frame template Templ_1 Data : 32 }
29
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

8.4.4 Complex Frame Templates

Template insertions can simplify construction of complex templates.
Examples
# Frame payload fields
struct FramePldFields
{ Data : * FCS : 32 }
# RX frame header error fields
Struct HdrErrFields
{ HDERsvd : 3 HDError : 5 }
# RX frame payload error fields
Struct RxErrFields
{ RSSI : 8 LQI : 8 RXERsvd : 3 RXError : 5 }
# Template for generic TX frame
Frame TX_FRAME : PLCP
{ : FramePldFields }
# Template for generic RX frame
Frame RX_FRAME : PLCP
{ : HdrErrFields : FramePldFields : RxErrFields }
30
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
# Or use only template insertions instead of template inheritance
# Template for generic TX frame
Frame TX_FRAME
{ : PLCP : FramePldFields }
# Template for generic RX frame
Frame RX_FRAME
{ : PLCP : HdrErrFields : FramePldFields : RxErrFields }
31
LeCroy Corporation UWBTrainer 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
Example
Frame MY_TEMPLATE
{ Field_16 : 16 = 0xEEFF Field_32 : 32 = 0xAABBCCDD }
The byte stream based on this template is:
FF EE DD CC BB AA

8.5.1 Big Endian Byte Order

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.
Example
Frame MY_TEMPLATE (MSB)
{ Field_16 : 16 = 0xEEFF Field_32 : 32 = 0xAABBCCDD }
The byte stream based on this template is:
EE FF AA BB CC DD
Note: This attribute is needed only for assignments in which numeric literals (such as 0xAABBCCDD or 12323344 ) are used.
32
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

8.5.2 Another Example

Example
struct IPv4Header_ (MSB)
# Instructs that all short fields have MSB to LSB byte order # when assigned values.
{ Version : 4 = 4 IHL : 4 TypeOfSrv : 8 TotalLen : 16 Identification : 16 Flags : 3 Offset : 13 TTL : 8 Protocol : 8 HdrCheckSum : 16 SourceAddr : 32 DestAddr : 32 }
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 Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Examples
Frame Base_0 (MSB)
{ F1 : 16 }
Frame Base_1 # LSB to MSB byte order by default
{ F2 : 32 }
Frame Combined : 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 Corporation UWBTrainer 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.
Examples
struct S1
{ F16 : 16 = 0xAABB F8 : 8 = 0xFE F32 : 32 = 0xABCD1234 }
struct S2
{ S8 : 8 = 0xDA S32 : 32 = 0x56781122 S16 : 16 = 0xBEEF }
35
LeCroy Corporation UWBTrainer 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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
automatically.
Send Frame Override Field Instruction Parameters
TFC/BG OVR_TFC = 0x01 Length OVR_LEN = 0x02 Scrambler OVR_SCR = 0x04 FCS OVR_FCS = 0x08 No Override OVR_NONE = 0 Override All OVR_ALL = (OVR_TFC | OVR_LEN | OVR_SCR | OVR_FCS)
( Found in "gen_constants.ginc" )
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 Corporation UWBTrainer 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 TX_FRAME( Delay = 0, Burst = OFF, Override = OVR_NONE )
To send a TX_Frame with SFOffset = 10 us, Indicate End of a Burst, and No Override:
Send TX_FRAME( SFOffset = 10, Burst = OFF, Override = OVR_NONE )
To send a TX_Frame with AbsTime = 250 us, Indicate End of a Burst, and No O v erride:
Send TX_FRAME( AbsTime = 250, Burst = OFF, Override = OVR_NONE )
To send a TX_Frame with Delay = 200 us, Indicate End of a Burst, and No Override:
Send TX_FRAME( 200, UNDEFINED, UNDEFINED, 0, OFF, OVR_NONE )
To send a TX_Frame with Delay = 400 us:
Send TX_FRAME( 400 )
To send a TX_Frame and block until it has been sent out over the air:
Send TX_FRAME( B
locking = TRUE )
To send a TX_Frame with Time Variable Index = 1 and Delay = 400 us:
Send TX_FRAME( TimeVar = 1, Delay = 400 )
To send a TX_Frame with Delay = 20 us + 100 ns and Override Scrambler:
Send TX_FRAME( Delay =
20, TimeAdjNs = 100, Override = OVR_SCR )
To send a TX_Frame with Delay = 20 us + 100 ns and Override Le ngth and FCS:
Send TX_FRAME(
20, UNDEFINED, UNDEFINED, 100, UNDEFINED, (OVR_LEN |
OVR_FCS) )
39
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
To send a TX_Frame with SFOffset = 170 us without any Nanosecond adjustment, Indicate the beginning of a Burst, and Override TFC/BG:
Send TX_FRAME( UNDEFINED, 170, UNDEFINED, 0, ON, OVR_TFC )
To send a TX_Frame with Absolute Time = 250 us and Override All:
Send TX_FRAME( AbsTime = 250, Override = OVR_ALL )
Examples
Main
{
# Send a frame based on the template 'TX_FRAME' # using default values.
Send TX_FRAME
# Send a frame based on the template 'TX_FRAME' # using default values overriding some default # instruction parameters.
Send TX_FRAME ( Delay = 100 ) Send TX_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.
Send TX_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.
Send TX_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 Corporation UWBTrainer 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.
Send TX_FRAME( TimeVar = 1, Delay = 100 )
{ DestAddr = 0xAABB SrcAddr = 0xEFBE }
}
41
LeCroy Corporation UWBTrainer 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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.

9.6.1 Register Rx Frame Header+Payload Condition Instruction

You can register a condition for both the Rx Frame header and a payload.
1
Note
: Checking just the header condition works much faster than checking the combined
condition.
2
Note
: The 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.
Format
ConditionRegisterWMRxFrame ( condition_name, [auto_reset], [counter], [Time variable index] )
[
{ Mask/Match pattern or frame variable
Additional condition parameters }
]
44
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Format in Short Form
RegRxFrmCondition ( condition_name, [auto_reset], [counter],
[Time variable index] )
[
{ Mask/Match pattern or frame variable
Additional condition parameters }
]
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 Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
9.6.1.1 Additional Rx Frame Header+Payload Condition parameters
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):
struct RxFrameInfo
{ RSSI_Lo : 8 # RSSI lower limit RSSI_Hi : 8 # RSSI upper limit
LQI_Lo : 8 # LQI lower limit LQI_Hi : 8 # LQI upper limit
Duration_Lo : 32 # Frame duration lower limit in microseconds Duration_Hi : 32 # Frame duration upper limit in microseconds
Reserved_0 : 8 # reserved value, should not be used
Errors # error flags { Reserved_1 : 2 FrmAborted : 1 # Frame Aborted error flag FCSError : 1 # FCS error flag LenError : 1 # Frame Length error flag HdrError : 1 # Frame Header error flag PldError : 1 # Frame Payload error flag UnsptdRate : 1 # Unsupported Rate error flag } }
46
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Examples
Main
{
# Register the Rx Frame condition named 'COND_1'.
RegRxFrmCondition ( COND_1 ) {
WM_FRAME
{
# Header Mask/Match
DestAddr = 0xAABB SrcAddr = 0xBEEF
# Payload Mask/Match
Data = {AA BB CC DD} } }
# Register the Rx Frame condition named 'COND_2' using # the named parameters.
RegRxFrmCondition ( COND_2,
AutoReset = YES,
Count = 3,
TimeVar = 1 )
{
WM_FRAME
{
# Header Mask/Match
DestAddr = 0xAABB SrcAddr = 0xBEEF
# Payload Mask/Match
Data = {AA BB CC DD} } }
# Register the RX Frame condition named "COND_3" with the same # parameters as in the previous instruction.
RegRxFrmCondition ( COND_3, YES, 3, 1 ) {
WM_FRAME
{
# Header Mask/Match
DestAddr = 0xAABB SrcAddr = 0xBEEF
# Payload Mask/Match
Data = {AA BB CC DD} } }
47
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
$X = WM_FRAME # Declare a frame variable.
{
# Header Mask/Match
DestAddr = 0xAABB SrcAddr = 0xBEEF
# Payload Mask/Match
Data = {AA BB CC DD} }
RegRxFrmCondition ( COND_2, 4, YES ) { X # Use a frame variable as mask/match. }
# Register Rx Frame condition: Any Rx Frame with RSSI from 2 to 8. RegRxFrmCondition( RX_FRM_COND ) { RxFrameInfo { RSSI_Lo = 2 RSSI_Hi = 8 } }
# Register Rx Frame condition: Any Rx Frame with duration from # 15 us to 18 us.
RegRxFrmCondition( RX_FRM_COND ) { RxFrameInfo { Duration_Lo = 15 Duration_Lo = 18 } }
# Register Rx Frame condition: Any Rx Frame with error FCS error # or unsupported rate error.
RegRxFrmCondition( RX_FRM_COND ) { RxFrameInfo { Errors = ERR_FCS | ERR_UNSUPPORTED_RATE } }
48
LeCroy Corporation UWBTrainer 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)
RegRxFrmCondition( RX_FRM_COND ) { RxFrameInfo { FCSError = 1 UnsptdRate = 1
Upper_Duration_Lo: 48,16 = 0x0001
} }
# Register Rx Frame condition: Any Data Frame with duration from # 15 us to 18 us.
RegRxFrmCondition( RX_FRM_COND ) { # RxFrameInfo and Frame hdr-payload mask/match pattern can be
# in any order.
RxFrameInfo { Duration_Lo = 15 Duration_Hi = 18 }
# hdr-payload mask/match pattern PLCP { FrameType = DATA } }
}
49
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.7 Timer Instructions

You can register and manipulate the UWBTrainer microsecond resolution timer using Timer instructions.

9.7.1 Start Timer Instruction

This instruction registers a special timer condition named “TIMER” and starts the timer if the timer was already started with the new timeout value.
Format
StartTimer ( timer_value, [auto_reset], [Time variable index] )
1
: 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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:
StartTimer ( timer_value ) Wait ( TIMER ) StopTimer
Example
Main
{
# Sleep for 65538 microseconds. # The following instructions are executed afterwards:
Sleep ( 65538 )
Send FrameXYZ
# This set of StartTimer, Wait, and StopTimer Instructions is the # same as the Sleep instruction above.
StartTimer( 65538 ) # Start the timer with timeout 2000 usecs.
Wait( TIMER ) # Wait for the timer. [Condition “TIMER”]
StopTimer # Stop the timer and revoke the “TIMER”
# condition.
Send FrameABC
}
52
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.8 Revoke Condition Instruction

You can instruct the UWBTrainer to release all resources associated with some condition. Especially do this if several conditions are not being used.
Format
ConditionRevoke( condition_name ) or
RevokeCondition( condition_name )
The instruction named parameter is:
Name: Condition name.
Example
Main
{
# Register the RX Frame condition named "HDR_COND_1".
RegRxFrmCondition ( HDR_COND_1 ) {
# Header Mask/Match
PLCP { DestAddr = 0xAABB SrcAddr = 0xBEEF } }
# Do something.
# Revoke condition from the UWBTrainer condition list.
RevokeCondition ( HDR_COND_1 ) }
53
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.9 Reset Condition Instruction

You can reset the conditions registered as non auto-reset and change its state from "triggered" to "charged".
Format
ConditionReset( condition_name ) or
ResetCondition( condition_name )
The instruction named parameter is:
Name: Condition name.
Example
Main
{ RegRxFrmCondition ( HDR_COND ) { # Header Mask/Match PLCP { DestAddr = 0xAABB SrcAddr = 0xBEEF } }
Wait( HDR_COND ) # Wait for condition to be triggered.
# Do something.
ResetCondition( HDR_COND ) # Reset condition after it is triggered.
Wait( HDR_COND ) # Again wait for condition to be triggered. }
54
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.10 Wait Instructions

You can wait for registered conditions.
Formats
Wait for ANY one of the condition(s) specified: Wait( condition_name_1 [, condition_name_2, ...] )
Wait for ANY one of the condition(s) specified (same as Wait): Wait_Any( condition_name_1 [, condition_name_2, ...] )
Wait for ALL the condition(s) specified: Wait_All( condition_name_1 [, condition_name_2, ...] )
Note: Wait / Wait_Any perform a logical OR on the conditions specified. Wait_All performs a logical AND on the conditions specified.
Examples
Main
{
# Register a Header condition.
RegRxFrmCondition( HDR_COND, YES ) { # Header Mask/Match PLCP { DestAddr = 0xAABB SrcAddr = 0xBEEF } }
# Start the timer and register the auto_reset “TIMER” condition.
StartTimer( 2000, YES )
# Wait for condition 'HDR_COND' OR condition 'TIMER' # to be triggered.
Wait( HDR_COND, TIMER )
# Same as Wait but clearer for multiple conditions.
Wait_Any( HDR_COND, TIMER )
# Wait for condition 'HDR_COND' AND condition 'TIMER' # to be triggered.
Wait_All( HDR_COND, TIMER )
}
55
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.11 Until Instructions

You can execute some code while waiting for some conditions.
Formats
Execute until ANY one of the condition(s) specified triggers: Until( condition_name_1 [, condition_name_2, ...] )
Execute until ANY one of the condition(s) specified triggers (the same as Until): Until_Any( condition_name_1 [, condition_name_2, ...] )
Execute until ALL condition(s) specified trigger: Until_All( condition_name_1 [, condition_name_2, ...] )
Note: Until / Until_Any perform a logical OR on the conditions specified. Until_All performs a logical AND on the conditions specified.
Examples
Main
{
# Register a Header condition.
RegRxFrmCondition( HDR_COND, YES ) { # Header Mask/Match PLCP { DestAddr = 0xAABB SrcAddr = 0xBEEF } }
# Start the timer and register the auto_reset “TIMER” condition.
StartTimer( 2000, YES )
# Send frames during 2000 microseconds.
Until( TIMER )
{ # Send frames.
Send WM_FRAME ( Delay = 1000 )
}
56
LeCroy Corporation UWBTrainer 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.
Send WM_FRAME ( Delay = 1000 )
}
# Send frames until condition 'HDR_COND' AND condition 'TIMER' # trigger.
Until_All( HDR_COND, TIMER )
{ # Send frames.
Send WM_FRAME ( Delay = 1000 )
}
}
57
LeCroy Corporation UWBTrainer 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 Corporation UWBTrainer 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.
Format
TxSleep( [ delay_microseconds, delay_nanoseconds ] )
The instruction named parameter is:
Delay : Delay part in microseconds. DelayNs: Delay part in nanoseconds.
Note: The total delay is calculated as Delay + DelayNs. Example
Main
{
# Send some frame
Send WM_FRAME
# Pause Tx queue for 10 microseconds.
TxSleep( 10 )
# Send the next frame.
Send WM_FRAME
# Pause Tx queue for 10 microseconds + 100 ns. TxSleep( 10,100 )
# Send the next frame.
Send WM_FRAME }
59
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.14 Wait Frame Shortcut Instructions

The Wait shortcut instructions save some time because they register conditions "behind the scenes".
Note: These instructions are not in Version 1.0.
Format
WaitRxFrame ( [timeout], [counter], [Time variable index] )
[
{ Mask/Match frame template or frame variable
Additional condition parameters
}
]
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
Additional Rx Frame Header+Payload Condition parameters.
9.6.1.1
60
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Examples
Main
{
# 1. Register a Rx Frame condition. # 2. Register a Timer condition (if specified). # 3. Wait for conditions.
WaitRxFrame( 3000 ) { RX_FRAME { # Header Mask/Match DestAddr = 0xAABB SrcAddr = 0xBEEF # Payload Mask/Match Data = {AA BB CC DD} } } }
61
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.15 If Instructions

You can check whether some condition is hit or not.
Format
Test one OR several conditions:
If_Condition( condition_name_1 [, condition_name_2, ...] ) { <instructions>
}
[ else_condition {
<instructions>
}
]
Format
Format
Test one OR several conditions (the same as If_Condition):
If_Any( condition_name_1 [, condition_name_2, ...] )
{
<instructions> }
[
else_condition { <instructions> }
]
Test ALL conditions:
If_All( condition_name_1 [, condition_name_2, ...] ) { <instructions> }
[
else_condition { <instructions> }
]
62
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Examples
Main
{ ConditionRegisterWMRxFrame( HDR_COND ) { # Header Mask/Match PLCP { DestAddr = 0xAABB SrcAddr = 0xBEEF } }
# Wait for condition.
Wait( HDR_COND, HDR_COND1, 2000 )
# 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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 timer StartTimer( 100 )
# Run an infinite loop.
Loop { # Break the loop after timer expires.
If_Condition( TIMER ) { BreakLoop }
Send TX_FRAME }
}
65
LeCroy Corporation UWBTrainer 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 Corporation UWBTrainer 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 parameter for details.
TraceName: See trace_file parameter for details.
KeepOldTrace: See trace_file parameter for details.
Example
Main
{ StartRecording( "C:\\my_rec.rec", "C:\\UWB\Test1.uwb" )
Send TX_FRAME Send TX_FRAME
StartRecording( RecOpt = "C:\\my_rec.rec" ) }
67
LeCroy Corporation UWBTrainer 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 parameter for 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.
StartRecording( TraceName = "C:\\Test2.uwb" ) Send TX_FRAME Send TX_FRAME
StopRecording( 1 ) # Stop recording and wait for trace.
}
68
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

9.19.3 TriggerAnalyzer instruction

You can instruct the application to trigger UWBTracer.
Format
TriggerAnalyzer
Example
Main
{ StartRecording( "C:\\my_rec.rec", "C:\\Test1.uwb" ) Send TX_FRAME Send TX_FRAME
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 Corporation UWBTrainer 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.
Send TX_FRAME Send TX_FRAME
Trace_B( "4 frames were sent." ) # Blocks script execution. }
70
LeCroy Corporation UWBTrainer 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'.
Local y = 20 # Explicitly declare a local variable 'y'
Send TX_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 Corporation UWBTrainer 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.
Format
[ Local ] $var = template_or_var_name [ Local ] $var = $variable_name
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 Corporation UWBTrainer 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 Corporation UWBTrainer 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
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 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 Corporation UWBTrainer 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.
Examples
Struct MY_STRUCT
{ V1 : 16 V2 : 8 V3 : 8
V4 : 32
}
Struct MY_STRUCT_2
{ F1 : 8 F2 : 32 F3 : * # Variable length F4 : * # Variable length
F5 : 32
}
Main
{
# Change some fields in a structure variable.
$X { DestAddr = 0x1234 }
# 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 Corporation UWBTrainer 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 Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
# Send a frame of {FF 00 FE 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 ]
Y { V1 = 255 V2 = 254 V3_1 : 16, 8 = 253 V3_2 : 24, 8 = 252 }
# COMPLEX LOCAL FIELD MANIPULATION EXAMPLES
$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{
F2Lower : 8, 16 = { 02 01 } F2Upper : 24, 16 = { 04 03 } }
77
LeCroy Corporation UWBTrainer 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.
Send $X{ F6 = { 11 22 33 44 } F7 : 16 = { 44 55 } } }
78
LeCroy Corporation UWBTrainer 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.
Send X { 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 Corporation UWBTrainer 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 Corporation UWBTrainer 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 }
Send TX_FRAME { Data = $S # Data field contains the payload of structure S. }
Send TX_FRAME {
# Example of concatenation of structures. # Data field contains combined payload of structures S and W
Data = $S + $W } }
81
LeCroy Corporation UWBTrainer 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 }
Send TX_FRAME { Data = 10*$TestIE # Data field contains the sequence of $TestIE
# repeated 10 times:
# { FB 01 02 FB 01 02 FB 01 02 FB 01 02 FB 01 # 02 FB 01 02 FB 01 02 FB 01 02 FB 01 02 }
}
# Declare Packet Variable $X of structure Generic with data FF $X = Generic { Data = 0xFF }
# Packet Variable $Y contains the sequence of $TestIE repeated # three times and $X repeated two times: # { FB 01 02 FB 01 02 FB 01 02 FF FF }
$Y { Data = 3*$TestIE + 2*$X } Num_of_Y = 5 # Local Numeric Variable Send TX_FRAME {
# Example of concatenation and multiplication of structures. # Data field contains combined payload of: # #
Data = $S2_Var*2 + 16*$X + Num_of_Y*$Y } }
$S2_Var + $S2_Var + $X + $X + $X + $X + $X + $X + $X + $X + $X + $X + $X + $X + $X + $X + $Y + $Y + $Y + $Y + $Y
*, this multiplier is not the arithmetic multiplier.
82
LeCroy Corporation UWBTrainer 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.
Examples
Frame BPOIE{
ElemID : 8 = 1 ElemLen : 8 BPLen : 8 Occupancy_Bitmap : * DevAddrList : * }
BPOIE $Beacon3_BPOIE BPOIE $Beacon11_BPOIE
Main
{ $Beacon3_BPOIE { BPLen = 16 Occupancy_Bitmap = { 00 55 55 55 01 } DevAddrList = { 04 00 } } # Generate DevAddrList for Addrs 5-16 : DevAddrList = {04 00} -->
# DevAddrList = { 04 00 05 00 06 00 07 00 08 00 09 00 0A 00 # 0B 00 0C 00 0D 00 0E 00 0F 00 10 00 }
for( i=5, i<17, i++) { $Beacon3_BPOIE{ DevAddrList = +{ i 00 } } } $Beacon11_BPOIE { BPLen = 16 Occupancy_Bitmap = { 10 55 15 55 01 } DevAddrList = { 03 00 } } # Generate DevAddrList for Addrs 4-10 and 12-16 :
# DevAddrList = {03 00} --> # DevAddrList = { 03 00 04 00 05 00 06 00 07 00 08 00 09 00 # 0A 00 0C 00 0D 00 0E 00 0F 00 10 00 }
for(i=4, i<17, i++) { if (i!=11) { $Beacon11_BPOIE{ DevAddrList = +{ i 00 } } } }
... ... ... ...
}
83
LeCroy Corporation UWBTrainer 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.
Example
Frame GenericSample
{ Field_1 : 8 Field_2 : 32 Field_3 : 16 Field_4 : 4 Field_5 : 3 Field_6 : 1 }
GenericSample $Struct_Var
Main
{ $Struct_Var = { 01 02 03 04 05 06 07 08 }
# The following is the same as the line above.
$Struct_Var{ Field_1 = 1 Field_2 = { 02 03 04 05 } Field_3 = { 06 07 } Field_4 = 0 Field_5 = 4 Field_6 = 0 } }
84
LeCroy Corporation UWBTrainer 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 variable­length and fixed-length fields), only the first variable-length field receives data. Later variable­length 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.
Example
Frame SF_Beacon
{ PHY : 40 MAC : 80 BH : 64 IEs : * DATA: * }
Frame GenericSample
{ First3_Bytes : 24 More_Bytes : * Some_More_Len : 8 Some_More_Bytes : * Even_More_Len : 8 Even_More_Bytes : *
Total_Len : 16
}
SF_Beacon $BeaconSlot2 GenericSample $X
set SuperFramePeriod = 65538 # Set Length of SuperFrame (65,538 us).
85
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual
Main
{ $BeaconSlot2 = { 00 0C 00 D0 00 00 00 FF FF 02 00 00 00 00 00
98 76 54 32 10 FC 02 00 01 02 03 00 }
# Equivalent to $BeaconSlot2{ PHY = { 00 0C 00 D0 00 } MAC = { 00 00 FF FF 02 00 00 00 00 00 } BH = { 98 76 54 32 10 FC 02 00 } IEs = { 01 02 03 00 } # DATA is Empty. }
$X = { 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 }
# Equivalent to $X{ First3_Bytes = { 01 02 03 } More_Bytes = { 04 05 06 07 08 09 0A 0B 0C 0D 0E } Some_More_Len = 0x15 # Some_More_Bytes is empty. Even_More_Len = { 10 } # Even_More_Bytes is empty. Total_Len = { 11 12 } }
}
86
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

10.11 Sizeof Operators

Several kinds of sizeof operators are currently supported:
fld_size (field_name): Returns the length of the field in bits.
pkt_size (template): Returns the length of the template payload in bits.
pkt_size ($pkt_v ar_name ): Returns the length of the structure variable payload in bits.
pttn_size (data_p attern): Returns the length of the data pattern payload in bits.
Note: Fields that are not initialized with a variable length (declared as
Examples
Main
{
# Examples of using 'sizeof' operators. # Declare a 'structure' instance based on the template S1.
$S = S1
# Declare a 'structure' instance based on the template S2, # changing the default value for the S16 field.
$W = S2 { S16 = 2 }
Send TX_FRAME {
# Set the Len to the size of # combined payload + the size of the 'Len' field.
Len = ( fld_size( Len ) + pkt_size( $S ) + pkt_size( $W ) ) / 8
# Same as the previous assignment.
Len = ( fld_size( Len ) + pkt_size( S1 ) + pkt_size( S2 ) ) / 8
# Data field contains combined payload of structures S and W.
Data = $S + $W } }
f : *) have 0 length.
87
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

10.12 Preprocessor Integer Arithmetic

You can declare a preprocessor DWORD variable, make arithmetic operations with it, and use it in field and setting/parameter assignments.
Note: Arithmetic expressions are allowed only in numeric variable assignments. Some legal expressions are.
x = y + 2
TX_FRAME ( Duration = (x+y)*7 )
TX_FRAME ( x + 12 )
Examples
Main
{ x = 2
y = ( z = 12 ) + ( TX_PAYLOAD_OFFSET + 36 ) / 8 z = 0x1 << 5 s = "Some Hex Data" # Constants may be used in operations.
x++ y--
z += ( x + y ) x = ( ( y & 0xFF ) >> 5 ) / 12
Send TX_FRAME ( Delay = x )
Send TX_FRAME { SrcAddr = 0xEEEE
# Example of a data payload assignment that uses # integer variables, constants, hex literals, # and a data pattern.
Data = { y y y 7a7a7a "Some Hex Data"
"Some Hex Data" 8b 8b 8b z z z [PATTERN_3] }
}
( Delay = y ) # Use an integer variable for a parameter setting. }
88
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

10.13 Preprocessor If Operator

A special preprocessor directive includes/excludes different parts of generation code depending on some condition.
Examples
Main
{ x = 180 y = 30
# Short if operator with only a 'then' clause
if( x > y )
{
# This block is parsed the usual way and all instructions # are added to the current instruction block.
Send TX_FRAME Send MMC_FRAME( Delay = 2000 ) } if( x < y )
{
# This block is parsed in a special way: # Only the "{" "}" are taken into account. # All other stuff is ignored.
Send WINET_FRAME { DestAddr = 0xAABB SrcAddr = 0xEFBE Data = { AA BB CC DD 12 34 56 78 [PATTERN_2] } } ( Delay = 100000 ) }
# Full if operator with both 'then' and 'else' clauses.
if( x > y ) {
# This block is parsed the usual way and all instructions # are added to the current instruction block.
Send MY_WUSB_FRAME Send MMC_FRAME( Delay = 2000 ) }
else {
# This block is parsed in a special way. # Only "{" "}" are taken into account. # All other stuff is ignored.
Send MY_WUSB_FRAME } }
89
LeCroy Corporation UWBTrainer Exerciser - Generation Script Language Reference Manual

10.14 Preprocessor Loop Operators

Note: Loop operators can produce a huge number of instructions. Therefore, you should set a
maximum allowed limit for the total number of loop iterations in a generation script. To do this, use the MaxLoopIterCount parser setting.
Examples
Main
{ k = 0
# 'while' loop operator.
while( k < 4 )
{
k++
# Skip the remaining part of the loop iteration. if( k == 2 ) { skip_iteration } # Stop the loop.
if( k == 3 ) { stop_loop }
Send TX_FRAME { SrcAddr = 0xEEEE DestAddr = 0xBBBB
# Data pattern uses preprocessor variables.
Data = { k k k k k } } }
# 'for' loop operator.
for( k = 0, k < 10, k++ ) {
# Skip the remaining part of the loop iteration. if( k == 2 ) { skip_iteration } # Stop the loop.
if( k == 4 ) { stop_loop }
Send TX_FRAME { SrcAddr = 0xEEEE DestAddr = 0xBBBB
# Data pattern uses preprocessor variables.
Data = { k k k k k } } } }
90
LeCroy Corporation UWBTrainer 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.
Send SOME_PKT_TEMPLATE { Field0 = 0xAABBCCDD }
Call Block1() # The procedure 'Block1' is declared later.
# Declare the 'SOME_PKT_TEMPLATE' frame template used above.
Frame SOME_PKT_TEMPLATE
{ Field0 : 32 = 0xFEFEFEFE } }
# Declare the procedure 'Block1' used above.
Block1 { Send TX_FRAME }
91
LeCroy Corporation UWBTrainer 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.
Send SOME_PKT_TEMPLATE { Field0 = { 00 RAND RAND RAND RAND 00 } # 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.
Send SOME_PKT_TEMPLATE { Fieldof32bytes = RandStream(32) # Set a random 32-byte stream. } }
92
Loading...