3385 Scott Blvd., Santa Clara, CA 95054 Tel: +1/408.727.6600 Fax: +1/408.727.6622
Verification Script Engine
for
LeCroy SATracer /SASTracer
Reference Manual
Manual Version 1.01
For SASTracer/SATracer Software Version 2.60/4.60
February 13, 2006
Page 2
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
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
LeCroy, CATC, SASTracer, SATracer, SASTrainer, SATrainer Automation are trademarks of
LeCroy.
Microsoft, Windows, Windows 2000, and Windows XP are registered trademarks of
Microsoft Inc.
All other trademarks are property of their respective companies.
This document may be printed and reproduced without additional permission, but all copies
should contain this copyright notice.
Version
This is version 1.0 the SASTracer/SATracer Verification Script Engine Reference Manual.
This manual applies to SASTracer/SATracer software version 2.60/4.60 and higher.
Page 3
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
22 THE VSE IMPORTANT SCRIPT FILES ............................................................................... 62
22.1 EXAMPLE SCRIPT FILES ....................................................................................................... 62
iv
Page 6
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
1 Introduction
This document contains a description of the LeCroy Verification Script Engine (VSE), a new
utility in the SATracer/SASTracer software that allows users to perform custom analyses of
SAS/SATA traffic, recorded using the new generation of SAS/SATA protocol analyzers.
VSE allows users to ask the SASTracer/SATracer application to send some desired “events”
(currently defined as Primitive/Frame/Transaction/Command) from a trace to a verification script
written using the LeCroy script language. This script then evaluates the sequence of events (timing,
data or both) in accordance with user-defined conditions and performs post-processing tasks; such as
exporting key information to external text-based files or sending special Automation/COM
notifications to user client applications.
VSE was designed to allow users to easily retrieve information about any field in a SAS/SATA
Frame/Transaction/Command, and to make complex timing calculations between different events in a
pre-recorded trace. It also allows filtering-in or filtering-out of data with dynamically changing
filtering conditions, porting of information to a special output window, saving of data to text files and
sending of data to COM clients connected to a SASTracer/SATracer application.
1
Page 7
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
2 Verification Script Structure
Writing a verification script is easy, as long as you follow a few rules and have some
understanding of how the SASTracer/SATracer application interacts with running scripts.
The main script file that contains the text of the verification script should have extension .sasvs,
and be located in the subfolder ..\Scripts\VFScripts of the main SASTracer/SATracer folder. Some
other files might be included in the main script file using directive %include. (see CATC Scripting Language Reference Manual for details).
The following schema presents a common structure of a verification script (this is similar to the content
of the script template [VSTemplate.pev_] which is included with VSE):
#############################################################################################
# Module info
#############################################################################################
# Filling of this block is necessary for proper verification script operation...
############################################################################################
set ModuleType = "Verification Script"; # Should be set for all verification scripts
set OutputType = "VS"; # Should be set for all verification scripts that
# output only Report string and Result.
set InputType = "VS";
set DecoderDesc = "<Your Verification Script description>"; # Optional
######################################################################################################
#
# include main Verification Script Engine definitions
#
%include "VSTools.inc" # Should be set for all verification scripts
######################################################################################
# Global Variables and Constants
######################################################################################
# Define your verification script-specific global variables and constant in this section...
# (Optional)
const MY_GLOBAL_CONSTANT = 10;
set g_MyGlobalVariable = 0;
######################################################################################
# Specify in the body of this function the initial values for global variables
# and what kinds of trace events should be passed to the script.
# ( By default, all packet level events from all channels
# will be passed to the script.
#
# For details – how to specify what kind of events should be passed to the script
# please see the topic ‘sending functions’.
#
# OPTIONAL.
######################################################################################
g_MyGlobalVariable = 0;
# Uncomment the line below - if you want to disable output from
# ReportText()-functions.
#
# DisableOutput();
######################################################################################
# It is a main script function called by the application when the next waited event
# occured in the evaluated trace.
#
# !!! REQUIRED !!! – MUST BE IMPLEMENTED IN VERIFICATION SCRIPT
######################################################################################
ProcessEvent()
{
# Write the body of this function depending upon your needs.
######################################################################################
# It is a main script function called by the application when the script completed
# running. Specify in this function some resetting procedures for a successive run
# of this script.
#
# OPTIONAL.
######################################################################################
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
3 Interaction Between SASTracer/SATracer and a Verification
Script
When a user runs a script against a pre-recorded trace, the following sequence occurs:
1. Prior to sending information to the script's main processing function ProcessEvent(), VSE looks
for the function OnStartScript() and calls it if it is found. In this function, setup actions are
defined, such as specifying the kind of trace events that should be passed to the script and
setting up initial values for script-specific global variables.
2. Next, the VSE parses the recorded trace to verify that the current packet or other event meets
specific criteria—if it does, VSE calls the script’s main processing function ProcessEvent(),
placing information about the current event in the script’s input context variables.
(Please refer to the topic Input context variables later in this document for a full description of
verification script input context variables )
3. ProcessEvent() is the main verification routine for processing incoming trace events. This
function must be present in all verification scripts. When the verification program consists of a
few stages, the ProcessEvent() function processes the event sent to the script, verifies that
information contained in the event is appropriate for the current stage, and decides if VSE
should continue running the script or, if the whole result is clear on the current stage, tell VSE
to complete execution of the script.
The completion of the test before the entire trace has been evaluated is usually done by
setting the output context variable in this manner: out.Result = _VERIFICATION_PASSED or
_VERIFICATION_FAILED.
(Please refer to the topic Output context variables later in this document for a full description of
verification script output context variables)
NOTE: Not only does a verification script evaluate recorded traces against some criteria—but it can also extract
information of interest and post-process it later by some third-party applications (there is a set of script functions
allowing you to save extracted data in text files, or send it to other applications, via COM/Automation interfaces).
4. When the script has completed running, VSE looks for the function OnFinishScript() and calls
it if found. In this function, some resetting procedures can be done.
The following figure illustrates the interaction between the SASTracer/SATracer application and a
running verification script:
5
Page 11
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
V
_
_
V
erification Script
OnStartScript()
ProcessEvent()
ProcessEvent()
ProcessEvent()
ProcessEvent()
(If expected event )
(If expected event )
(If expected event )
(If expected event )
Data…
Text
File
COM
Client
Call..
Call
..
Call
..
Call..
Call
..
SASTracer Application
(Run verification script)
Starting VSE running …
ProcessEvent()
Set out.Result =
VERIFICATION_PASSED
or
VERIFICATION_FAILED
will complete the script run.
OnFinishScript()
PASSED
erification Script results
FAILED
Call
..
(If expected
event )
Call..
DONE
Finishing VSE running … …
The Verification script result "DONE" occurs when the script has been configured to extract and display some information about
the trace, but not to display PASSED/FAILED results. To configure a script so that it only displays information—place a call
somewhere in your script to the function ScriptForDisplayOnly()in OnStartScript(), for example.
6
Page 12
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
4 Running Verification Scripts from the SASTracer/SATracer
In order to run a verification script over a trace—you need to open the SASTracer/SATracer
main menu item Report\Run verification scripts… or push the icon on the main toolbar if it is not
hidden.
7
Page 13
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
V
V
A
The special dialog will open displaying a list of verifications scripts. You can select one script to run,
or several scripts from the list to run in parallel:
output windows
erification Script List
Name for scripts are file names
without extension.
Finds a view related to the
verified trace and place this
window under it.
.
Starts running selected
verification scripts
Finds a view related to the
verified trace and place this
window by the right side of it.
erification Script description
Descriptions for scripts are defined in
set DecoderDesc="MyDescription";
Tabbed output
windows for selected
verification scripts.
Saves contents of
output windows in
text files.
llows to set
different settings.
8
Page 14
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
4.1 Running verification scripts
Push the button Run scripts after you selected the desired script(s) to run. VSE will start
running the selected verification script(s), show script report information in the output windows,
and present results of verifications in the script list:
9
Page 15
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Right-click in script list opens a pop-up menu with options for performing additional operations on
the selected scripts:
-
Run verification script(s) – starts running selected script(s)
-
Edit script – allows editing of the selected script(s) using whatever editor was specified in Editor
settings
- New script – creates a new script file using the template specified in Editor settings.
-
Show Grid – shows/hides a grid in the verification script list.
- Show Description window – shows/hides the script description window. (Shortcut key : F2)
-
Show Output - shows/hides the script output windows. (Shortcut key : F3)
-
Settings – opens a special Setting dialog which allows you to specify different settings for VSE.
10
Page 16
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
p
g
p
4.2 VSE GUI settings.
After choosing Settings, the following dialog will appear:
This option (if set) allows editor
applications supporting multi-document
interface (MDI) to edit all script files
related to the selected scripts in one
application instance.
Otherwise, a new application instance will
be launched for each script file.
This option (if set) allows editor
applications to edit all included files
(extension : *.inc) along with main
verification script files (extension : *.vse )
Otherwise, only main verification script
files will be opened for editing.
Launches editor application in full screen
mode.
Full path to the file to be used as a
template for a new script.
This setting (if set) specifies that the last
saved output for selected scripts should
be loaded into the out
This setting (if set) brings Run VS dialog
to foreground when scripts stopped
.
runnin
This setting (if set) forces the application
to save output automatically when the
ts stopped running.
scri
ut windows.
See screen pop-up tooltips for
explanation of other settings…
11
Page 17
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
5 Verification Script Engine Input Context Members
All verification scripts have input contexts – some special structures whose members are filled by
the application and can be used inside of the scripts (for more details about input contexts – please refer
to the CATC Script Language(CSL) Manual). The verification script input contexts have two sets of
members:
- Trace event-independent set of members.
- Trace event -dependent set of members.
5.1 Trace event-independent set of members
This set of members is defined and can be used for any event passed to script:
in.Level - transaction level of the trace event (0 = frames, 1= sequences )
in.Index - Index of the event in the trace file (frame number for frames, sequence number
for sequences)
in.Time - time of the event (type: list, having the format: 2 sec 125 ns -> [2 , 125].
(See 9.1 VSE time object for details)
in.Channel - channel where the event occured. (may be
in.TraceEvent - type of trace event (application predefined constants are used. See the list of possible
events, below)
in.Notification - type of notification (application predefined constants are used.
Currently, no notifications are defined)
_CHANNEL_2 (2) indicating which direction of the SAS/SATA link the event occurred)
_CHANNEL_1 (1) or
12
Page 18
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
5.2 Trace event-dependent set of members
This set of members is defined and can be used only for a specific events or after calling some
functions filling out some of the variables:
5.2.1 Primitives
in.Primitive– 4-byte value of the Primitive in.Count– Primitive count
in.Payload - bit source of the frame/sequence payload (you can extract any necessary
information using GetNBits(), NextNBits() or PeekNBits() functions—please refer to the CSL Manual
for details about these functions)
in.PayloadLength - the length (in bytes of the retrieved payload)
in.SOF,in.StartOfFrame– 4-byte value of Start of frame primitive
in.EOF,
in.EndOfFrame – 4-byte value of End of frame primitive
in.CRC– CRC value as transmitted
13
Page 19
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
in.CalculatedCRC– CRC value as calculated
5.2.4 SAS Open Address Frame members
Note: All members return the content of the matching field name (in.xyz returns the value of field
“xyz”) based on the SAS specification.
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
6 Verification Script Engine Output Context Members
All verification scripts have output contexts – some special structures whose members are filled
by the script and can be used inside of the application (for more details about output contexts – please
refer to the CATC Script Language(CSL) Manual). The verification script output contexts have only
one member:
out.Result - the result of the whole verification program defined in the verification script.
This member is supposed to have 3 values:
_VERIFICATION_PROGRESS,( is set by default when script starts running )
_VERIFICATION_PASSED, and _VERIFICATION_FAILED
The last two values should be set if you decide that recorded trace does (or does not) satisfy the
imposed verification conditions. In both cases, the verification script will stop running.
If you don't specify any of those values - the result of script execution will be set as
_VERIFICATION_FAILED at exit.
NOTE: If you don’t care about the results of the script that’s running, please call function
ScriptForDisplayOnly() one time before stopping the script – then the results will be DONE.
28
Page 34
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
7 Verification Script Engine Events
VSE defines a large group of trace “events”—on packet, link and split transaction levels—that
can be passed to a verification script for evaluation or retrieving and displaying some contained
information. The information about the type of event can be seen in in.TraceEvent. Please refer to the
topic Sending functions in this manual for details about how to specify transaction levels and which
events should be sent to verification scripts.
7.1 Frame level events
The table below describes the current list of Frame level events (transaction level: 0) and value of
in.TraceEvent:
Types of Frames in.TraceEvent
Primitive only _FRM_PRIMITIVE
OOB Signal Frame _FRM_OOB_SIGNAL
Connect Frame _FRM_CONNECT
Disconnect Frame _FRM_DISCONNECT
Open Address Frame _FRM_AF_OPEN
Identify Address Frame _FRM_AF_IDENTIFY
SSP Frame _FRM_SSP
SMP Frame _FRM_SMP
STP Frame _FRM_STP
7.2 Command level events
No command level events defined yet.
29
Page 35
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
8 Sending Functions
This topic contains information about the special group of VSE functions designed to specify
which events the verification script should expect to receive.
8.1 SendLevel()
This function specifies that events of the specified transaction level should be sent to the script.
Format : SendLevel( level )
Parameters: level – This parameter can be one of following values:
_ATA – ( value 4 ) send ATA Command level events
Note: only Packet and Link Transaction level events are available in release 4.4 of PETracer software.
Example:
SendLevel( _LINK); # - send Link level events
…
Remark:
If no level was specified – events of packet level will be sent to the script by default.
8.2 SendLevelOnly()
This function specifies that ONLY events of the specified transaction level should be sent to the
script.
Format : SendLevelOnly( level )
Parameters: level – This parameter can be one of following values:
_ATA – ( value 4 ) send ATA Command level events
Example:
SendLevelOnly( _LINK ); # - send ONLY Link level events
…
_LINK – ( value 0 ) send Link level events
_LINK – ( value 0 ) send Link level events
30
Page 36
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
8.3 DontSendLevel()
This function specifies that events of the specified transaction level should NOT be sent to the
script.
Format : DontSendLevel( level )
Parameters: level – This parameter can be one of following values:
_LINK – ( value 0 ) do not send Link level events
_ATA – ( value 4 ) do not send ATA Command level events
Example:
DontSendLevel( _LINK ); # - DO NOT send Link level events
…
8.4 SendChannel()
This function specifies that events that have occurred on the specified channel should be sent to
script.
Format : SendChannel( channel )
Parameters: channel – This parameter can be one of following values:
_CHANNEL_2 ( = 2 ) – send events from Channel T1
_CHANNEL_3 ( = 3 ) – send events from Channel I2
_CHANNEL_4 ( = 4 ) – send events from Channel T2
_CHANNEL_5 ( = 5 ) – send events from Channel I3
_CHANNEL_6 ( = 6 ) – send events from Channel T3
_CHANNEL_7 ( = 7 ) – send events from Channel I4
_CHANNEL_8 ( = 8 ) – send events from Channel T4
Example:
SendChannel(_CHANNEL_1); # - send events from Channel I1
…
_CHANNEL_1 ( = 1 ) – send events from Channel I1
31
Page 37
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
8.5 SendChannelOnly()
This function specifies that ONLY events that have occurred on the specified channel should be
sent to the script.
Format : SendChannelOnly( channel )
Parameters: channel – This parameter can be one of following values:
_CHANNEL_1 ( = 1 ) – send events from Channel I1
_CHANNEL_2 ( = 2 ) – send events from Channel T1
_CHANNEL_3 ( = 3 ) – send events from Channel I2
_CHANNEL_4 ( = 4 ) – send events from Channel T2
_CHANNEL_5 ( = 5 ) – send events from Channel I3
_CHANNEL_6 ( = 6 ) – send events from Channel T3
_CHANNEL_7 ( = 7 ) – send events from Channel I4
_CHANNEL_8 ( = 8 ) – send events from Channel T4
Example:
SendChannelOnly( _CHANNEL_1 ); # - send ONLY events from Channel I1
…
8.6 DontSendChannel ()
This function specifies that events that have occurred on the specified channel should NOT be
sent to the script.
Format : DontSendChannel ( channel )
Parameters: channel – This parameter can be one of following values:
_CHANNEL_2 ( = 2 ) – send events from Channel T1
_CHANNEL_3 ( = 3 ) – send events from Channel I2
_CHANNEL_4 ( = 4 ) – send events from Channel T2
_CHANNEL_5 ( = 5 ) – send events from Channel I3
_CHANNEL_6 ( = 6 ) – send events from Channel T3
_CHANNEL_7 ( = 7 ) – send events from Channel I4
_CHANNEL_8 ( = 8 ) – send events from Channel T4
Example:
DontSendChannel ( _CHANNEL_1 ); # - DO NOT send events from Channel I1
…
_CHANNEL_1 ( = 1 ) – send events from Channel I1
32
Page 38
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
8.7 SendAllChannels()
This function specifies that events that have occurred on ALL channels should be sent to the
script.
Format : SendAllChannels ()
Example:
…
SendAllChannels (); # - send events from ALL channels
8.8 SendTraceEvent ()
This function specifies the events to be sent to the script.
Format : SendTraceEvent( event )
Parameters: event – See Verification Script Engine Events
for all possible values.
Example:
…
SendTraceEvent( _FRM_AF_OPEN
…
);
8.9 DontSendTraceEvent()
This function specifies that the event specified in this function should not be sent to script.
Format : DontSendTraceEvent ( event )
Parameters: event – See Verification Script Engine Events for all possible values.
Example:
…
if( SomeCondition )
{
DontSendTraceEvent( _FRM_AF_OPEN
}
);
8.10 SendTraceEventOnly()
This function specifies that ONLY the event specified in this function will be sent to the script.
Format : SendTraceEventOnly( event )
Parameters: event – See Verification Script Engine Events
for all possible values.
33
Page 39
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Remark: This function may be useful when many events are to be sent, yet you need to send
only one kind of event and turn off the rest.
Example:
…
if( SomeCondition )
{
SendTraceEventOnly (_FRM_AF_OPEN );
}
8.11 SendAllTraceEvents()
This function specifies that ALL trace events relevant for the selected transaction level will be
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
9 Timer Functions
This group of functions covers VSE capability to work with timers –-- internal routines that
repeatedly measures a timing intervals between different events.
9.1 VSE time object
A VSE time object is a special object that presents time intervals in verification scripts.
From point of view of the CSL, the verification script time object is a “list”-object of two elements.
( Please see the CSL Manual for more details about CSL types )
[seconds, nanoseconds]
NOTE: The best way to construct VSE time object is to use Time() function (see below ).
9.2 SetTimer()
Starts timing calculation from the event where this function was called.
Format : SendTimer( timer_id = 0)
Parameters:
timer_id – a unique timer identifier.
Example:
SetTimer(23); # - start timing for timer with id = 23;
Remark :
If this function is called a second time for the same timer id, it resets the timer and starts timing
calculations again from the point where it was called.
SetTimer(); # - start timing for timer with id = 0;
35
Page 41
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
9.3 KillTimer()
Stops timing calculation for a specific timer and frees related resources.
Format : KillTimer( timer_id = 0)
Parameters:
timer_id – a unique timer identifier.
Example:
KillTimer(23); # - stop timing for timer with id = 23;
KillTimer(); # - stop timing for timer with id = 0;
9.4 GetTimerTime()
Retrieve the timing interval from the specific timer
Format : GetTimerTime ( timer_id = 0)
Parameters:
timer_id – a unique timer identifier.
Return values:
Returns VSE time object from timer with id = timer_id.
Example:
GetTimerTime (23); # - Retrieve timing interval for timer with id = 23;
Remark :
This function, when called, does not reset the timer.
GetTimerTime (); # - Retrieve timing interval for timer with id = 0;
36
Page 42
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
10 Time Construction Functions
This group of functions are used to construct VSE time objects.
10.1 Time()
Constructs a verification script time object.
Format : Time(nanoseconds)
Time(seconds, nanoseconds)
Return values:
First function returns [0, nanoseconds], second one returns [seconds, nanoseconds]
Parameters:
nanoseconds – number of nanoseconds in specified time
seconds – number of seconds in specified time
Example:
Time (3, 100); # - create time object of 3 seconds and 100
nanoseconds
Time( 3 * MICRO_SECS ); # - create time object of 3 microseconds
Time( 4 * MILLI_SECS ); # - create time object of 4 milliseconds
NOTE: MICRO_SECS and MILLI_SECS are constants defined in VS_constants.inc.
Time ( 50 * 1000 ); # - create time object of 50 microseconds
37
Page 43
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
11 Time Calculation Functions
This group of functions covers VSE capability to work with “time” —VSE time objects.
11.1 AddTime()
Adds two VSE time objects
Format : AddTime(time1, time2)
Return values:
Returns VSE time object representing the time interval equal to the sum of time_1 and time_2
Parameters:
time_1 - VSE time object representing the first time interval
time_2 - VSE time object representing the second time interval
Example:
t2 = Time(2, 200);
t3 = AddTime( t1, t2 ) # - returns VSE time object = 2 sec 300 ns.
11.2 SubtractTime()
Format : SubtractTime (time1, time2)
Return values:
and time_2
Parameters:
Example:
t2 = Time(2, 200);
t3 = SubtractTime ( t2, t1 ) # - returns VSE time object = 2 sec 100 ns.
11.3 MulTimeByInt()
t1 = Time(100);
Subtract two VSE time objects
Returns VSE time object representing the time interval equal to the difference between time_1
time_1 - VSE time object representing the first time interval
time_2 - VSE time object representing the second time interval
t1 = Time(100);
Multiplies VSE time object by integer value
38
Page 44
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Format : MulTimeByInt (time, mult)
Return values:
Returns VSE time object representing the time interval equal to the product of time * mult
Parameters:
time - VSE time object
mult - multiplier, integer value
Example:
t1 = MulTimeByInt ( t, 2 ) # - returns VSE time object = 4 sec 400 ns.
t = Time(2, 200);
11.4 DivTimeByInt()
Divides VSE time object by integer value
Format : DivTimeByInt (time, div)
Return values:
Returns VSE time object representing the time interval equal to the quotient of time / div
Parameters:
time - VSE time object
div - divisor, integer value
Example:
t1 = DivTimeByInt ( t, 2 ) # - returns VSE time object = 1 sec 100 ns.
t = Time(2, 200);
39
Page 45
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
12 Time Logical Functions
This group of functions covers VSE capability to compare VSE time objects
12.1 IsEqualTime()
Verifies that one VSE time object is equal to the other VSE time object
Format : IsEqualTime (time1, time2)
Return values:
Returns 1 if time_1 is equal to time_2, returns 0 otherwise
Parameters:
time_1 - VSE time object representing the first time interval
time_2 - VSE time object representing the second time interval
Example:
If( IsEqualTime( t1, t2 ) ) DoSomething();
12.2 IsLessTime()
Format : IsLessTime (time1, time2)
Return values:
Parameters:
Example:
If( IsLessTime ( t1, t2 ) ) DoSomething();
12.3 IsGreaterTime()
Format : IsGreaterTime (time1, time2)
t1 = Time(100); t2 = Time(500);
Verifies that one VSE time object is less than the other VSE time object
Returns 1 if time_1 is less than time_2, returns 0 otherwise
time_1 - VSE time object representing the first time interval
time_2 - VSE time object representing the second time interval
t1 = Time(100); t2 = Time(500);
Verifies that one VSE time object is greater than the other VSE time object
40
Page 46
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Return values:
Returns 1 if time_1 is greater than time_2, returns 0 otherwise
Parameters:
time_1 - VSE time object representing the first time interval
time_2 - VSE time object representing the second time interval
Example:
If( IsGreaterTime ( t1, t2 ) ) DoSomething();
t1 = Time(100); t2 = Time(500);
12.4 IsTimeInInterval()
Verifies that a VSE time object is greater than some VSE time object and less than the other
VSE time object
Format : IsTimeInInterval( min_time, time, max_time )
Return values:
Returns 1 if min_time <= time <= max_time, returns 0 otherwise
Parameters:
time_1 - VSE time object representing the first time interval
time_2 - VSE time object representing the second time interval
In case if a multi-segmented trace is being processed, this function returns the index of the
segment for the current event.
NOTE: When a multi-segmented trace file (extension *.smt or *.smat) is processed by VSE – different trace events in
different segments of the same trace file may have the same indexes (value stored in in.Index input context members)
– but they will have different segment numbers.
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
16 Navigation Functions
16.1 GotoEvent ()
This function forces the application to jump to some trace event and show it in the main trace
view.
Format : GotoEvent( level, index, segment )
GotoEvent()
Parameters:
level - the transaction level of the event to jump to (possible values: _LINK, _ATA)
index - the transaction index of the event to jump to
segment - the segment index of the event to jump to. If omitted, the current segment index will
be used.
Remarks:
If no parameters were specified, the application will jump to the current event being processed
by VSE. The segment parameter is used only when the verification script is running over a multisegmented trace (extensions: *.smt, *.samt). For regular traces it is ignored.
If wrong parameters were specified (like an index exceeding the maximum index for the
specified transaction level), the function will do nothing and an error message will be sent to the output
window.
Example:
if( Something == interesting ) GotoEvent(); # go to the current event
…
if( SomeCondition )
…
{
interesting_segment = GetEventSegNumber();
interesting_level = in.Level;
interesting_index = in.Index;
}
…
OnFinishScript()
{
…
# go to the interesting event…
GotoEvent( interesting_level, interesting_index, interesting_segment );
}
47
Page 53
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
16.2 SetMarker()
This function sets a marker for some trace event.
Format : SetMarker( marker_text)
SetMarker( marker_text, level, index, segment )
Parameters:
marker_text - the text of the marker
level - the transaction level of the event to jump to (possible values: _LINK, _ATA)
index - the transaction index of the event to jump to
segment - the segment index of the event to jump to. If omitted, the current segment index will
be used.
Remarks:
If no parameters were specified, other than marker_text, the application will set a marker to the
current event being processed by VSE. The segment parameter is used only when a verification script
is running over a multi-segmented trace (extensions: *.smt, *.samt). For regular traces it is ignored.
If wrong parameters were specified (like an index exceeding the maximum index for a specified
transaction level), the function will do nothing and an error message will be sent to the output window.
Example:
# set marker to the current eventif( Something == interesting ) SetMarker( "!!! Something cool !!!" );
…
if( SomeCondition )
interesting_index,
…
{
interesting_segment = GetEventSegNumber();
interesting_level = in.Level;
interesting_index = in.Index;
}
…
OnFinishScript()
{
…
# set marker to the interesting event…
SetMarker( " !!! Cool Marker !!! ", interesting_level,
interesting_segment );
# go to the interesting event…
GotoEvent( interesting_level, interesting_index, interesting_segment );
}
48
Page 54
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
17 File Functions
This group of functions covers VSE capabilities to work with the external files.
17.1 OpenFile()
This function opens a file for writing.
Format : OpenFile( file_path, append )
Parameters:
file_path - the full path to the file to open. ( For ‘\’ use ‘\\’ )
append - this parameter (if present and not equal to 0) specifies that VSE should append to the
contents of the file – otherwise, the contents of the file will be overwritten.
Return Values:
The “handle” to the file to be used in other file functions.
Example:
set file_handle = 0;
…
file_handle = OpenFile( “D:\\Log.txt” ); # opens file, the previous
contents will be
…
…
CloseFile( file_handle ); # closes file
…
the file.
file_handle = OpenFile( GetApplicationFolder() + “Log.txt”, _APPEND );
…
# erased.
WriteString( file_handle, “Some Text1” ); # write text string to file
WriteString( file_handle, “Some Text2” ); # write text string to file
# opens file, the following file operations will append to the contents of
49
Page 55
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
17.2 CloseFile()
This function closes an opened file.
Format : CloseFile( file_handle )
Parameters:
file_handle - the file “handle”.
Example:
set file_handle = 0;
file_handle = OpenFile( “D:\\Log.txt” ); # opens file, the previous contents will
be
…
…
CloseFile( file_handle ); # closes file
…
…
…
# erased.
WriteString( file_handle, “Some Text1” ); # write text string to file
WriteString( file_handle, “Some Text2” ); # write text string to file
17.3 WriteString()
This function writes a text string to the file.
Format : WriteString( file_handle, text_string )
Parameters:
file_handle - the file “handle”.
text_string - the text string”.
Example:
set file_handle = 0;
file_handle = OpenFile( “D:\\Log.txt” ); # opens file, the previous
contents will be
…
…
CloseFile( file_handle ); # closes file
…
…
# erased.
WriteString( file_handle, “Some Text1” ); # write text string to file
WriteString( file_handle, “Some Text2” ); # write text string to file
…
17.4 ShowInBrowser()
This function allows you to open a file in the Windows Explorer. If the extension of the file has
the application registered to open files with such extensions – it will be launched. For instance, if
50
Page 56
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Internet Explorer is registered to open files with extensions *.htm and the file handle passed to
ShowInBrowser() function belongs to a file with such an extension,this file will be opened in the
Internet Explorer.
…
WriteString( html_file, “</body></html>” );
ShowInBrowser( html_file ); # opens the file in Internet Explorer
CloseFile( html_file );
…
51
Page 57
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
18 COM/Automation Communication Functions
This group of functions covers VSE capabilities to communicate with COM/Automation clients
connected to the SASTracer/SATracer application. (Please refer to the SASTracer/SATracer Automation manual for the details on how to connect to the SASTracer/SATracer application and
VSE).
18.1 NotifyClient()
This function allows you to send information to COM/Automation client applications in a
custom format. The client application will receive a VARIANT object which it is supposed to parse.
Format : NotifyClient( event_id, param_list )
Parameters:
event_id - event identifier
param_list - the list of parameters to be sent to the client application. Each parameter might be
an integer, string or list.
(See CSL Manual for details about data types available in CSL ).
Because the list itself may contain integers, strings, or other lists it is possible
to send complicated messages.
(lists should be treated as arrays of VARIANTs)
Example:
if( SomeCondition() )
{
NotifyClient( 2, [ in.Index, in.Level,
TimeToText( in.Time )] );
}
…
# Here we sent 2 parameters to clients applications :
Remark:
See an example of handling this notification by client applications and parsing code in the
SASTracer/SATracer Automation document.
…
# 2 ( integer ),
# [ in.Index, in.Level, TimeToText( in.Time )] ( list )
52
Page 58
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
19 User Input Functions
19.1 MsgBox()
Displays a message in a dialog box, waits for the user to click a button and returns an Integer
indicating which button the user clicked.
Format : MsgBox( prompt, type, title )
Parameters:
prompt - Required. String expression displayed as the message in the dialog box.
type - Optional. Numeric expression that is the sum of values specifying the number
and type of buttons to display, the icon style to use, the identity of the default
button, and the modality of the message box. If omitted, the default value for
buttons is _MB_OK. (See the list of possible values in the table below)
title - Optional. String expression displayed in the title bar of the dialog box. If you omit
the title, the script name is placed in the title bar.
The type argument values are:
Constant Description
_MB_OKONLY Display OK button only ( by Default ).
_MB_OKCANCEL Display OK and Cancel buttons.
_MB_RETRYCANCEL Display Retry and Cancel buttons.
_MB_YESNO Display Yes and No buttons.
_MB_YESNOCANCEL Display Yes, No, and Cancel buttons.
_MB_ABORTRETRYIGNORE Display Abort, Retry, and Ignore buttons.
_MB_EXCLAMATION Display Warning Message icon.
_MB_INFORMATION Display Information Message icon.
_MB_QUESTION Display Warning Query icon.
_MB_STOP Display Critical Message icon.
_MB_DEFBUTTON1 First button is default.
_MB_DEFBUTTON2 Second button is default.
_MB_DEFBUTTON3 Third button is default.
_MB_DEFBUTTON4 Fourth button is default.
Return Values:
This function returns an integer value indicating which button the user clicked.
53
Page 59
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Constant Description
_MB_OK OK button was clicked.
_MB_CANCEL Cancel button was clicked.
_MB_YES Yes button was clicked.
_MB_NO No button was clicked.
_MB_RETRY Retry button was clicked.
_MB_IGNORE Ignore button was clicked.
_MB_ABORT Abort button was clicked.
Remark:
This function works only for VS Engines controlled via the GUI. For VSEs controlled by
COM/Automation clients, it does nothing.
This function "locks" the SASTracer/SATracer application, which means that there is no access to
other application features until the dialog box is closed. In order to prevent too many MsgBox calls—in
the case of a script not written correctly—VSE keeps track of all function calls demanding user
interaction and doesn't show dialog boxes if a customizable limit was exceeded (returns _MB_OK in
this case).
if( result != _MB_YES )
ScriptDone();
… # Go on…
}
54
Page 60
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
19.2 InputBox()
Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns a
CSL list object (see the CSL manual for details about list objects) or a string containing the contents of
the text box.
Format : InputBox( prompt, title, default_text, return_type )
Parameters:
prompt - Required. String expression displayed as the message in the dialog box.
title - Optional. String expression displayed in the title bar of the dialog box. If you omit
title, the script name is placed in the title bar.
default_text - Optional. String expression displayed in the text box as the default
response if no other input is provided. If you omit default_text, the text box is
displayed empty.
return_type – Optional. It specifies the contents of the return object.
The return_type argument values are:
Constant Value Description
_IB_LIST 0 CSL list object will be returned ( by Default ).
_IB_STRING 1 String input as it was typed in the text box
Return Values:
Depending upon the return_type argument, this function returns either a CSL list object or the
text typed in the text box as it is.
In case of return_type = _IB_LIST (by default), the text in the text box is considered as a set of list
items delimited by ',' (only hexadecimal, decimal, and string items are currently supported).
Text example:
Will produce a CSL list object of5 items:
NOTE: Although the dialog box input text parser tries to determine a type of list item automatically, a text enclosed
in quote signs "" is always considered as a string.
Hello world !!!, 12, Something, 0xAA, 10, "1221"
list = [ "Hello world !!!", 12, "Something", 0xAA, 10, "1221" ];
list [0] = "Hello world !!!"
list [1] = 12
list [2] = "Something"
list [3] = 0xAA
list [4] = 10
list [5] = "1212"
55
Page 61
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
Remark:
This function works only for VS Engines controlled via the GUI. For VSEs controlled by
COM/Automation clients, it does nothing.
This function "locks" the SASTracer/SATracer application, which means that there is no access to
other application features until the dialog box is closed. In order to prevent too many InputBox calls—
in the case of a script not written correctly—VSE keeps track of all function calls demanding user
interaction and doesn't show dialog boxes if a customizable limit was exceeded (returns null object in
that case).
Example:
…
if( Something )
{
…
v = InputBox( "Enter the list", "Some stuff", "Hello world !!!, 0x12AAA,
Some, 34" );
ReportText ( FormatEx( "input = %s, 0x%X, %s, %d", v[0],v[1],v[2],v[3]
) );
… # Go on…
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
19.3 GetUserDlgLimit()
This function returns the current limit of user dialogs allowed in the verification script. If the
script reaches this limit, no user dialogs will be shown and the script will not stop. By default this limit
is set to 20.
Format : GetUserDlgLimit()
Example:
…
result = MsgBox( Format( "UserDlgLimit = %d", GetUserDlgLimit() ),
_MB_OKCANCEL | _MB_EXCLAMATION, "Some Title !!!" );
SetUserDlgLimit( 2 ); # set the limit to 2
…
19.4 SetUserDlgLimit()
This function sets the current limit of user dialogs allowed in the verification script. If the script
reaches this limit, no user dialogs will be shown and script will not stop. By default this limit is set to
20.
Format : SetUserDlgLimit()
Example:
…
result = MsgBox( Format( "UserDlgLimit = %d", GetUserDlgLimit() ),
_MB_OKCANCEL | _MB_EXCLAMATION, "Some Title !!!" );
SetUserDlgLimit( 2 ); # set the limit to 2
…
57
Page 63
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
20 String Manipulation/formating Functions
20.1 FormatEx()
Write formatted data to a string. FormatEx() is used to control the way that arguments will
print out. The format string may contain conversion specifications that affect the way in which the
arguments in the value string are returned. Format conversion characters, flag characters and field
width modifiers are used to define the conversion specifications.
Format : FormatEx ( format_string, argument_list )
Parameters:
format_string - Format-control string
argument_list- Optional list of arguments to fill in the format string
Return Values:
Formatted string .
Format conversion characters:
Code Type Output
c Integer Character
d Integer Signed decimal integer
i Integer Signed decimal integer
o Integer Unsigned octal integer
u Integer Unsigned decimal integer
x Integer Unsigned hexadecimal integer, using "abcdef."
X Integer Unsigned hexadecimal integer, using "ABCDEF."
s String String
Remark:
A conversion specification begins with a percent sign (%) and ends with a conversion character.
The following optional items can be included, in order, between the % and the conversion character to
further control argument formatting:
• Flag characters are used to further specify the formatting. There are five flag characters: A minus sign (-) will
cause an argument to be left-aligned in its field. Without the minus sign, the default position of the argument is
right-aligned.
• A plus sign (+) will insert a plus sign before a positive signed integer. This only works with the conversion
characters d and i.
58
Page 64
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
• A space will insert a space before a positive signed integer. This only works with the conversion characters d and
i. If both a space and a plus sign are used, the space flag will be ignored.
• A hash mark (
#) will prepend a 0 to an octal number when used with the conversion character o. If # is used with
xor X, it will prepend 0xor 0Xto a hexadecimal number.
• A zero (
• Field width specification is a positive integer that defines the field width, in spaces, of the converted argument. If
the number of characters in the argument is smaller than the field width, then the field is padded with spaces. If the
argument has more characters than the field width has spaces, then the field will expand to accommodate the
argument.
0) will pad the field with zeros instead of with spaces.
Example:str = "String";
i = 12;
hex_i = 0xAABBCCDD;
…
formatted_str = FormatEx( "%s, %d, 0x%08X", str, i, hex_i );
# formatted_str = "String, 12, 0xAABBCCDD"
59
Page 65
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
21 Miscellaneous Functions
21.1 ScriptForDisplayOnly()
Specifies that the script is designed for displaying information only and that its author doesn’t
care about verification script result. Such a script will have a result of DONE after execution.
Format : ScriptForDisplayOnly ()
Example:
ScriptForDisplayOnly();
21.2 Sleep()
Asks VSE not to send any events to a script until the timestamp of the next event is greater than
the timestamp of the current event plus sleeping time.
main VSE file containing definitions of some generic and SAS/SATAspecific VSE script functions provided by LeCroy (must be included in
every script)
file containing definitions of some important generic and SAS/SATAspecific VSE global constants
template file for new verification scripts.
file of user global variable and constant definitions (In this file, it is useful
to enter definitions of constants, variables, and functions to be used in many
scripts you write.)
OOB definitions and utilities
Primitives definitions and utilities
SMP Frames definitions and utilities
SSP Frames definitions and utilities
STP Frames definitions and utilities
Address Frames definitions and utilities
ATA Commands definitions and utilities
Sample script that outputs all frames
Sample script that outputs all data payloads
Sample script that outputs all ATA Commands
Sample script that outputs all frames
Sample script that outputs all frames
62
Page 68
LeCroy Corporation Verification Script Engine Reference Manual Version 1.01
How to Contact LeCroy
Type of Service Contract
Call for technical support… US and Canada: 1 (800) 909-2282
Worldwide: 1 (408) 727-6600
Fax your questions… Worldwide: 1 (408) 727-6622
Write a letter … LeCroy Corporation
Customer Support
3385 Scott Blvd.
Santa Clara, CA 95054
Send e-mail… support@lecroy.com
Visit LeCroy web site… http://www.lecroy.com/
63
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.