Protocol Solutions Group
3385 Scott Blvd., Santa Clara, CA 950 54
Tel: +1/408.727.6600
Fax: +1/408.727.6622
PETrainer™
Scripting Language
Reference Manual
For PETrainer™ Software Version 7.xx
January 2014
Teledyne LeCroy PETrainer Scripting Language
Document Disclaim er
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.
Teledyne LeCroy reserves the right to revise the information presented in this document without
notice or penalty.
Trademarks and Servicemarks
CATC Trace, PETrainer EML, PETra iner ML, P ETr ac er EML, PETrac er ML, PET rac er ,
PETracer Summit, Summit Z2-16, Summit Z3-16, and BusEngine are trademarks of Teledyne
LeCroy.
Microsoft and Windows are registered trademarks of Microsoft Inc.
All other trademarks are property of their respective companies.
How to Contact Teledyne LeCroy .................................... 84
v
Teledyne LeCroy PETrainer Scripting Language
1 Introduction
This manual describes the scripting language used to create traffic generation files for
PETrainer™, including the Summit Z2-16™ and Summit Z3-16™ Trainers.
1.1 Support Resources
As new functionalities are added, not all of them are supported by older versions of the PETracer
software. For newer releases of the analyzer's software, please refer to Teledyne LeCroy's web
site:
teledynelecroy.com/
Syntax
PETrainer™ Script files consist of the statements with the following format:
See the list of all commands with all applicable modifiers on page 2. For some commands the list of the
parameters is optional.
All literals are not case sensitive.
All default values are zeros unless otherwise noted.
Integer literals represent numeric values with no fractions or decimal points.
Hexadecimal, decimal, and binary notations are supported:
• Hexadecimal numbers must be preceded by 0x: 0x2A, 0x54, 0xFFFFFF01
• Decimal numbers are written as usual: 24, 1256, 2
• Binary numbers are denoted with 0b: 0b01101100, 0b01, 0b100000
It is possible to use expressions, for example, (i - 239). See Page 65 for more examples.
String literals are surrounded by double quotes.
Array data types are represented by integer or string literals surrounded by “(“ and “)” characters, and
separated by a comma “,”. For example, (2,23,4).
Single-line comments are supported and should be preceded by a semicolon “;”.
Multi-line comments are also supported. Multi-line comments begin with a “/*” combination, and end with
Creates a template for a packet
that can be used in the Packet
command.
performance generation.
Note: Available only for the
Summit Z2-16™ and Summit Z3-
send once, a number of times, or
repeatedly. Available only in a
Setup command section of a
FastTransmit block.
Note: Available only for the
Summit Z2-16 and Summit Z3-16
2
Teledyne LeCroy PETrainer Scripting Language
Parameter
Values
Default
Value
Comment
PSN
0:4095, Incr
0
When Incr is specified, the PSN for the
packets will have the same PSN.
TLPType
MRd32
CplDLk
0
Sets the Fmt (bits 6:5 of byte 0 in the TLP
TC
0:7
0
Traffic Class: bits 6:4 of byte 1 in the
TLP header
TD
0:1 0 Bit 7 of byte 2 in the TLP header:
form of a single DW at the end of the TLP.
EP
0:1 0 Bit 6 of byte 2 in the TLP header:
1 indicates the TLP is poisoned.
0:1 0 Bit 4 of byte 2 in the TLP header:
3 Packet Command
This command initiates transmission of a specified packet on the bus.
3.1 Packet = TLP
This command initiates transmission of TLP packet on the bus. The parameters of the Packet = TLP
command cover all the fields in the TLP header: TLP Payload, PSN (Packet Sequence Number), ECRC,
and LCRC. Reserved fields can be set with the RawData parameter.
current TLP is assigned as the PSN of the
previously sent TLP incremented by 1.
When the PSN is generated automatically
(see the AutoSeqNumber parameter,
Page 38), this parameter has no effect.
Note: When automatic PSN is turned off
PSN=Incr will work properly only for TLP
transmissions with Count=1. Count
instructs the exerciser to repeat the same
packet and when automatic PSN
generation is turned off, all repeated
If not specified, this field is 1 for all read
requests and calculated according to the
actual payload for write requests.
For a length of 1024, set Length to 0
LAST_CFG_TAG
LAST_IO_TAG
LAST_MEM_TAG
value
and Configuration TLP packets.
Byte 10 for Completion TLP packets.
When Tags are generated automatically
(see the TagGeneration parameter, Page
38), this parameter has no effect for
Memory, IO, and Configuration TLP
packets.
The LAST_CFG_TAG,
LAST_IO_TAG, and
LAST_MEM_TAG modifiers are only valid
for the Summit Z2-16 and Summit Z3-16
Trainers and are only applicable to
Completion TLPs.
When a LAST_CFG_TAG,
LAST_IO_TAG, or
LAST_MEM_TAG modifier is used for a
completion TLP, the Tag field value is set
to the value of the Tag in the latestreceived Configuration, IO, or Memory
request, respectively, as seen by the Z2-
IO, and Configuration TLP packets.
Bytes 8-9 for Completion TLP packets.
This parameter can be set in the following
format: (BusNumber :
0xFFFFFFFF
0xFFFFFFFF
d
automati
d
automati
cally
4
software automatically calculates the
ECRC. (TD field has to be specified.)
software automatically calculates the
LCRC.
When LCRC is generated automatically
by the PETrainer™ hardware (see the
AutoLCRC parameter, Page 38
), this
Teledyne LeCroy PETrainer Scripting Language
Parameter
Values
Default
Value
Comment
Payload
(XXXX,XXXX,…)
Specified as the array of DWORDs in
Data TLP packets.
Field[<start>:<end>]
The arbitrary TLP Header field could be
field.
RawData@<start>
Inserts raw data symbols at <start> byte
ML and EML Trainers.
Count
1:65535
1
Repeats this packet the number of times
specified.
Field[<pos>]
Incr
Random
Zeros
Ones
hexadecimal format (Big Endian).
The Payload parameter applies only to
TLP packets with data.
Incr: Specifies a payload as the sequence
(0, 1, …’Length’).
Random: Specifies a random payload.
Zeros: Specifies a payload of all zeros.
Ones: Specifies a payload of all ones. Note: When Incr, Random, Zeros, and
Ones are used, the Length parameter
must be specified before the payload.
Payload can be specified for Memory, IO,
Configuration writes, and Completion with
specified by using Field parameter.
Start, end, and pos are bit positions from
the beginning of TLP Header.
Position 0 corresponds to the
Most Significant Bit of the first byte of TLP
Header.
Position 95 for 3 DWORD header (and
position 127 for 4 DWORD header)
correspond to the Least Significant Bit of
the last byte of TLP Header.
Fields are limited by 32 bit values.
Use Field[<start>:<end>] syntax to
specify multi bit field.
Use Field[<pos>] to specify single bit
position from the beginning of the TLP.
See the Packet = Raw des cr iption, Page
29, for possible raw data formats.
Note: This parameter is available only on
5
Teledyne LeCroy PETrainer Scripting Language
Parameter
Values
Default
Value
Comment
AutoIncrementAddress
Yes
No
This parameter is supported only for the
specified.
StoreData
( FROM_MEMxx_x,
N/A
This parameter is supported only for the
Substitution (see 3.1.7)
No
Summit Z2-16 and Summit Z3-16
Trainers.
It applies to Memory Write and Memory
Read Request TLPs.
If the parameter is set to the "Yes"
modifier, and the "Count" modifier is set to
a value greater than 1, the Summit Z2-16
and Summit Z3-16 Trainers perform a
"burst" of Memory Writes or Reads, with
the Address value for each subseque nt
address automatically incremented
according to the Length value for the write
or read.
The manual or automatic Tag policy is
applied to the transmitted TLPs as
offset )
Summit Z3-16 Trainer.
It can be used for any Memory Read TLP.
When used it instructs the Trainer to
collect all the data returned as a response
to this Memory Read and copy it to the
specified Address Space locat ion.
Values have the same notation as in Field
Example 1:
Read one DWORD of data from address 0x1000.
Length parameter is not specified, so the default value of 1 is used.
TC, TD, EP, Ordering, Snoop, and Tag parameters are not specified, so the default value of 0 is used.
LCRC is not specified, so the LCRC is calculated by software.
Example 2:
Read 32 DWORDs of data starting from address 0x1000.
PSN would accept values 0 for first TLP and 1 for second TLP.
TC, EP, Ordering, and Snoop parameters are not specified, so the default value of 0 is used.
LCRC is not specified, so the LCRC is calculated by software.
ECRC is not specified, so the ECRC is calculated by software.
Example 6:
This example shows how to specify the TLP type directly. Any invalid TLP type can be generated with this
method.
Packet = TLP {
TLPType = 0x4F
}
Example 7:
Repeat this TLP packet 64 times.
Packet = TLP {
TLPType = MRd32
Address = 0x1000
Count = 64
}
8
Teledyne LeCroy PETrainer Scripting Language
Parameter
Value
Default
Comment
LastDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
FirstDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
Address
0x00000000:
0xFFFFFFFF
0
Bytes 8-11 in the TLP header.
3.1.1 TLPType = MRd32, MRdlk32, MWr32
Last DW BE in the PCI Expres s
1st DW BE in the PCI Express
Example 1:
This example shows how to send a 32-bit Memory Write TLP.
The Length field is not specified, so it would be calculated by software. (Length = 4 would be used.)
TC, TD, EP, Ordering, Snoop, and Tag parameters are not specified, so the default value of 0 is used.
LCRC is not specified, so the LCRC is calculated by software.
Example 2:
This example shows how to send a 32-bit Memory Write TLP. This command would generate a random
payload of 1024 DWORDs.
Packet = TLP {
TLPType = MWr32
LastDwBe = 0xF
FirstDwBe = 0xF
Address = 0x1000
Length = 0 ; 0 means 1024 DWORDs of payload
Payload = Random
}
9
Teledyne LeCroy PETrainer Scripting Language
Parameter
Value
Default
Comment
LastDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
FirstDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
AddressLo
0x00000000:
0xFFFFFFFF
0
Bytes 8-11 in the TLP header.
AddressHi
0x00000000:
0xFFFFFFFF
0
Bytes 12-15 in the TLP header.
3.1.2 TLPType = MRd64, MRdLk64, MWr64
Last DW BE in the PCI Expres s
1st DW BE in the PCI Express
Example 1:
This example shows how to send a 64-bit Memory Write TLP.
Length parameter is set to 3 intentionally in order to generate a TLP with incorrect length.
TC, TD, EP, Ordering, Snoop, and Tag parameters are not specified, so the default value of 0 is used.
LCRC is not specified, so the LCRC is calculated by software.
Byte 7 in the TLP header. See rules for
Specification.
FirstDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
Address
0x00000000:
0xFFFFFFFF
0
Bytes 8-11 in the TLP header.
3.1.3 TLPType = IoRd, IoWr
Last DW BE in the PCI Expres s
1st DW BE in the PCI Express
Example 1:
Read one DWORD of data from address 0x1000 of the IO address space.
Length parameter is not specified, so the default value of 1 is used.
TC, TD, EP, Ordering, Snoop, and Tag parameters are not specified, so the default value of 0 is used.
LCRC is not specified, so the LCRC is calculated by software
Packet = TLP {
TLPType = IoRd
Address = 0x1000
}
11
Teledyne LeCroy PETrainer Scripting Language
Parameter
Value
Default
Comment
LastDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
FirstDwBe
0:15
0
Byte 7 in the TLP header. See rules for
Specification.
DeviceID
(XX:XX:X) or direct
0
Bytes 8-9 in the TLP header. This
FunctionNumber)
Register
0 Bytes 10-11 in the TLP header.
3.1.4 TLPType = Cfgrd0, Cfgwr0, Cfgrd1, Cfgwr1
Last DW BE in the PCI Express
1st DW BE in the PCI Express
value
Example 1:
This example reads the Capability Pointer from the device’s configuration space
(Bus Number 0, Device Number 2, Function Number 4).
Lower byte address for the starting byte of
the completion
3.1.6 TLPType = Cpl, CplLk, CplD, CplDLk
This parameter can be set in the following
format: (BusNumber : DeviceNumber :
UR
CRS
PCI Express Completers and may only be
set by PCI-X completers.
Indicates that the Byte Count field reports
the size of just the first packet instead of
Note: For the Summit Z2-16 and Summit Z3-16 Trainers you can specify the automatic Tag value
modifiers to make the Completion automatically respond to incoming requests., See the modifier values
for the Tag parameter on page 5, in the Packets = TLP table, for reference.
Example 1:
This example shows how to send a Completion TLP. This Completion TLP returns Unsupported Request
(UR) status.
Requester is Function 0 of Device 0 on Bus 0.
Completer is Function 0 of Device 1 on Bus 0.
This completes the TLP request with Tag Number 4.
Example 2:
This example shows how to send a Completion with Data TLP. This Completion TLP returns
Successful Completion (SC) status.
Requester is Function 0 of Device 0 on Bus 0.
Completer is Function 0 of Device 1 on Bus 0.
This completes the TLP request with Tag Number 4.
This is the last Completion of the Split Transaction, since ByteCount field is equal to the number of bytes
transferred and BCM is not set.
When the Summit Z2-16 and Summit Z3-16 Trainers Are Emulating a PCI Express™ Endpoint
Device
When you use the Summit Z2-16 and Sum mit Z3-16 Trainers to emulate a PCI Express Endpoint
Device, you must enable automatic handling of the device Configuration space.
You can also enable automatic handling of Memory and IO spaces. If you enable automatic handling of
Memory and IO spaces, and you perform BAR setup for the initial device Configuration Space image, you
can enable up to three memory spaces (Mem64, Mem32 A, and Mem32 B) and up to two IO spaces
(IO A and IO B). The enabled address spaces have a corresponding data image in the internal memory of
the -16 and Summit Z3-16 Trainers. Whatever the system writes into those spaces over PCI Express can
be read back over PCI Express.
For the Summit Z2-16 and Summit Z3-16 Trainers only, the PETrainer script language provides
extensions that allow data written into Configuration, Memory, or IO spaces to modify behavior of the
running script. If the script specifies values of specific fields and/or Payload in the TLPs for transmission,
you can define that the system use the value from a location in a Configuration, Memory, or IO space of
the device that the Summit Z2-16 and Summit Z3-16 Trainers are emulating.
Field payload substitution allows modifying the behavior of running scripts. When a script that has
substitution definitions is running, a test scenario can write new values to specific locations in
Configuration, Memory, or IO spaces. Subsequent TLPs transmitted by the script use the updated values
of the corresponding fields and/or Payload.
A substitution definition has the following format:
The address_space_designation parameter specifies the address space from which to take the value
for the field. The defined address-space-ID keywords are:
o FROM_CFG
o FROM_MEM64
o FROM_MEM32_A
o FROM_MEM32_B
o FROM_IO_A
o FROM_IO_B
The address_space_offset parameter is optional. It defines the byte offset into the address space for the
location from which to take the substitution value. If you omit this parameter, the offset is zero and the
system takes the value from the beginning of the specified address space.
The SwapBytes parameter, when present, specifies that the PETrainer Z3 should swap the Endian order
of the bytes in a 2-byte or 4-byte field before copying it into the specified field of the TLP to transmit.
Some example field name substitution defin it ions are:
17
Teledyne LeCroy PETrainer Scripting Language
Address = ( FROM_MEM32_A, 32 )
The system takes the value of the Address field from the Mem32 A address space, starting with byte 32
from the beginning of the memory space image.
Tag = ( FROM_CFG, 256 )
The system takes the value of the Tag field from Configuration Space byte location 256 (which is register
location 64).
Payload = ( FROM_MEM64 )
The system copies the data Payload stream for this TLP from the beginning of the Memory Space 64
image.
Scripts can define substitution only for the following TLP fields:
o Payload
o Tag
o RequesterId
o CompleterId
o Address
o AddressLo
o AddressHi
o ComplStatus
Note: The Summit Z2-16 and Summit Z3-16 Trainers track all accesses and locations of address spaces.
The substitution address_space_offset parameter can be the string value LAST_WRITTEN. When
performing a substitution that uses LAST_WRITTEN for the address_space_offset parameter, the
Summit Z2-16 and Summit Z3-16 Trainers use the value from the beginning of the location where the
system performed the latest Write transaction. The LAST_WRITTEN option allows writing new values at
random locations or at locations that the script writer cannot determine beforehand and making such
values available for later field or Payload substitution.
An example Packet definition with field name substitution using the LAST_WRITTEN option is:
If the script transmits this TLP packet in a loop, initially the system sends a Payload f illed w ith zer oes (or
whatever value initialized memory space 32 A). Before the system writes into a memory space, the lastwritten address initializes to the beginning of the memory space, so the LAST_WRITTEN parameter
starts at 0. Now suppose that the system writes into memory space 32 A at offset 0x100. The next
transmitted TLP Payload specified by the above code includes 16 dwords of the data the system wrote
starting at offset 0x100 of memory space 32 A.
18
Teledyne LeCroy PETrainer Scripting Language
Parameter
Values
Default
Comment
DLLPType
Ack
Vendor
First byte in the DLLP
CRC
0: 65535
Automatically
Bytes 4-5 in the DLLP.
calculated automatically.
Field[<start>:<end>]
The arbitrary DLLP field could
single bit field.
RawData@<start>
Inserts raw data symbols at
formats.
Count
1: 65535
1
Repeats this packet the
number of times specified.
3.2 Packet = DLLP
This command initiates transmission of DLLP packets on the bus.
Parameters for the Packet = DLP command cover all the fields in a DLLP.
Reserved fields can be set using the RawData parameter.
be specified by using Field
parameter.
Start, end, and pos are bit
positions from the beginning of
DLLP.
Position 0 corresponds to the
Most Significant Bit of the first
byte of DLLP.
Position 31 corresponds to the
Least Significant Bit of the last
byte of DLLP.
Use Field[<start>:<end>]
syntax to specify multi bit field.
Use Field[<pos>] to specify
<start> byte position from the
beginning of the DLLP.
See Packet = Raw description
(page 29
) for possible raw data
19
Teledyne LeCroy PETrainer Scripting Language
Example 1:
This example shows how to send a PM_Active_State_Request_L1 power management DLLP. This
DLLP would be sent 132 times.
The DLLP’s CRC is calculated automatically since CRC is not specified.