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
Loading...
+ 94 hidden pages