P rotocol s olutions g roup 3385 s cott b lvd s anta c lara , ca 95054 verification script engine for lecroy usb protocol suite™ reference manual manual version 1.2 for usb protocol suite version 3.71 december 2009.
Lecroy corporation verification script engine reference manual page 2 of 107 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 re...
Lecroy corporation verification script engine reference manual page 3 of 107 contents 1 introduction ..............................................................................................................................................6 2 verification script structure ..........................
Lecroy corporation verification script engine reference manual page 4 of 107 9 packet and script decoded fields retrieving functions................................................... 55 9.1 g et d ecoded p kt f ield ()....................................................................................
Lecroy corporation verification script engine reference manual page 5 of 107 19 trace file exporting functions ................................................................................................ 88 19.1 c reate t race f ile ()................................................................
Lecroy corporation verification script engine reference manual page 6 of 107 1 introduction this document describes the lecroy usb protocol suite™ verification script engine (vse), which allows users to perform complicated custom analyses of traffic recorded using the lecroy protocol analyzers. The ...
Lecroy corporation verification script engine reference manual page 7 of 107 2 verification script structure writing verification scripts is easy, if you understand how the application interacts with running scripts and if you follow some rules imposed by the verification script syntax. The main fil...
Lecroy corporation verification script engine reference manual page 8 of 107 ###################################################################################### # global variables and constants # # define your verification script-specific global variables and constant in this section. # (optional...
Lecroy corporation verification script engine reference manual page 9 of 107 ###################################################################################### # processevent() # # # # # main script function called by the application when the next waited event # # occurs in the evaluated trace. ...
Lecroy corporation verification script engine reference manual page 10 of 107 3 interaction between application and verification script the following steps describe the interaction between the application and a verification script run over a recorded trace: 1. Before sending any information to the s...
Lecroy corporation verification script engine reference manual page 11 of 107 onstartscript() starting vse running … verification script call.. Application (run verification script) processevent() call.. (if expected event ) processevent() call.. (if expected event ) processevent() call.. (if expect...
Lecroy corporation verification script engine reference manual page 12 of 107 4 running verification scripts from application to run a verification script over a trace, you select the main menu item report > run verification scripts or click the run verification scripts button on the main tool bar (...
Lecroy corporation verification script engine reference manual page 13 of 107 the run verification scripts dialog opens where you choose then run one or several verification scripts: verification script list. N ame for scripts are file names w ithout extension. Verification script description. Descr...
Lecroy corporation verification script engine reference manual page 14 of 107 4.1 running verification scripts push the button run scripts after you select scripts to run. Vse starts running the selected verification scripts, shows script report information in the output windows, and presents the re...
Lecroy corporation verification script engine reference manual page 15 of 107 right-clicking the script list displays some additional operations over selected scripts: run verification script(s): start running selected script(s). Edit script: edit selected scripts in the editor application specified...
Lecroy corporation verification script engine reference manual page 16 of 107 4.2 vse gui settings after choosing settings, the following dialog appears: this option (if set) allows editor applications to edit all included files (extension : *.Inc) along with main verification script files (extensio...
Lecroy corporation verification script engine reference manual page 17 of 107 5 verification script engine input context members all verification scripts have input contexts, special structures that can be used inside of the scripts. The application fills their members. The verification script input...
Lecroy corporation verification script engine reference manual page 18 of 107 5.2 trace event-dependent set of members this set of members is defined and can be used only for a specific event or after calling functions that provide values of variables: 5.2.1 usb packet-specific set of members member...
Lecroy corporation verification script engine reference manual page 19 of 107 5.2.1.1 usb bus condition-specific set of members note: valid for bus condition trace events only, undefined for other events. In.Buscondition : type of bus condition events. The table below describes the current list of p...
Lecroy corporation verification script engine reference manual page 20 of 107 5.2.1.2 usb2 packet-specific set of members note: valid for usb2 packets only, undefined for other events. The following input context members apply to most of the usb2 packets. In.Pid : packet identifier value for the pac...
Lecroy corporation verification script engine reference manual page 21 of 107 5.2.1.2.1 usb2 token packet members in.Addr : value of the address (addr) field of the token packet. In.Endp : value of the endpoint (endp) field of the token packet. 5.2.1.2.2 usb2 start of frame packet members in.Frmnum ...
Lecroy corporation verification script engine reference manual page 22 of 107 5.2.1.2.5 link power management extended token members in.Hird: value of the host initiated resume duration field. In.Blinkstate: value of the blinkstate field for the lpm extended token. In.Bremotewake: value of the bremo...
Lecroy corporation verification script engine reference manual page 23 of 107 5.2.1.3 usb3 packet-specific set of members note 1: valid for usb3 packets only, undefined for other events. Note 2: the system does not pass all possible fields of usb3 packets as members of input context. If a script nee...
Lecroy corporation verification script engine reference manual page 24 of 107 5.2.1.3.6 skip packet members in.Count: count of symbols in the skip sequence 5.2.1.3.7 logical idle packet members in.Count: count of symbols in the logical idle sequence 5.2.1.3.8 link management packet members in.Subtyp...
Lecroy corporation verification script engine reference manual page 25 of 107 5.2.1.3.11 data packet members in.Addr: address of the device which is the recipient of this data packet in.Endp: endpoint number on the device which is the recipient of this data packet in.Dir: direction for the specified...
Lecroy corporation verification script engine reference manual page 26 of 107 5.2.1.3.12 getting values of the fields not present in input context as mentioned earlier, not all the possible fields of usb3 packets are passed as members of input context. The following are examples of using gethexpktfi...
Lecroy corporation verification script engine reference manual page 27 of 107 # hex value val = gethexpktfield ( “nump” ); str = formatex( “\tnump(hex) = 0x%x”, val ); reporttext( str ); } if( in.Traceevent == _usb3_dp_pkt ) { # example of using decoded packet information for dps. # ‘seqn’ field #...
Lecroy corporation verification script engine reference manual page 28 of 107 5.2.2 transaction-specific set of members in.Tratoken : token pid for the transaction. Possible values are: const pid_out = 0x87; const pid_in = 0x96; const pid_setup = 0xb4; const pid_split = 0x1e; const pid_ping = 0x2d; ...
Lecroy corporation verification script engine reference manual page 29 of 107 in.Split : signals that the transaction is a start-split or complete-split. In.Hubaddr : value of the hub address field, the usb device address of the hub supporting the specified full- /low-speed device for this full-/low...
Lecroy corporation verification script engine reference manual page 30 of 107 5.2.3 split transaction-specific set of members all the input context members that are defined for usb2 transactions are also applicable to split transactions. In addition to those, split transactions define the following ...
Lecroy corporation verification script engine reference manual page 31 of 107 5.2.4 transfer-specific set of members in.Xfertype : type of transfer. Repeats the trace event value for the transfer. In.Addr : device address value for this usb transfer. In.Endp : device endpoint number value for this u...
Lecroy corporation verification script engine reference manual page 32 of 107 6 verification script engine output context members all verification scripts have output contexts, special structures that can be used inside of the application. The scripts fill their members. The verification script outp...
Lecroy corporation verification script engine reference manual page 33 of 107 7 verification script engine events vse defines a large group of trace “events” that can be passed to a verification script for evaluating, retrieving, and displaying some contained information. The information about the t...
Lecroy corporation verification script engine reference manual page 34 of 107 7.1 packet level events the table below describes the current list of packet level (lowest level of transactions) events and values (application-defined constants) for in.Traceevent: types of packets in.Traceevent usb2 pac...
Lecroy corporation verification script engine reference manual page 35 of 107 7.2 transaction level events the table below describes the current list of transaction level events and values (application-defined constants) for in.Traceevent: types of transactions in.Traceevent setup transactions _t_se...
Lecroy corporation verification script engine reference manual page 36 of 107 8 sending functions this topic contains information about the special group of vse functions that specify the events the verification script should expect to receive. 8.1 sendlevel() this function specifies that events of ...
Lecroy corporation verification script engine reference manual page 37 of 107 8.2 sendlevelonly() this function specifies that only events of a specified transaction level should be sent to the script. Currently only frame level events can be sent to verification scripts. Format: sendlevelonly(level...
Lecroy corporation verification script engine reference manual page 38 of 107 8.3 dontsendlevel() this function specifies that events of a specified transaction level should not be sent to the script. Currently only frame level events can be sent to verification scripts. Format: dontsendlevel(level)...
Lecroy corporation verification script engine reference manual page 39 of 107 8.4 sendchannel() this function specifies that events on the specified channel should be sent to the script. Format: sendchannel(channel) parameters: channel can be one of following values: _usb2: usb2 traffic (value = 1) ...
Lecroy corporation verification script engine reference manual page 40 of 107 8.5 sendchannelonly() this function specifies that only events occuring on a specified channel should be sent to the script. Format: sendchannelonly(channel) parameters: channel can be one of following values: _usb2: usb2 ...
Lecroy corporation verification script engine reference manual page 41 of 107 8.6 dontsendchannel() this function specifies that events occuring on a specified channel should not be sent to the script. Format: dontsendchannel (channel) parameters: channel can be one of following values: _usb2: usb2 ...
Lecroy corporation verification script engine reference manual page 42 of 107 8.7 sendallchannels() this function specifies that events occuring on all channels should be sent to the script. Format: sendallchannels () example: … sendallchannels (); # send events from all channels..
Lecroy corporation verification script engine reference manual page 43 of 107 8.8 sendtraceevent() this function specifies the events to be sent to a script. Format: sendtraceevent(event) parameters: event can have one of the trace event values defined in chapter 7 “ verification script engine event...
Lecroy corporation verification script engine reference manual page 44 of 107 8.9 dontsendtraceevent() this function specifies that the event specified in this function should not be sent to a script. Format: dontsendtraceevent (event) parameters: event see sendtraceevent() for all possible values. ...
Lecroy corporation verification script engine reference manual page 45 of 107 8.10 sendtraceeventonly() this function specifies that only the event specified in this function is sent to the script. Format: sendtraceeventonly(event) parameters: event see sendtraceevent() for all possible values remar...
Lecroy corporation verification script engine reference manual page 46 of 107 8.11 sendalltraceevents() this function specifies that all trace events relevant for the selected transaction level are sent to the script. Format: sendalltraceevents () example: … sendalltraceevents (); # send all types o...
Lecroy corporation verification script engine reference manual page 47 of 107 8.12 senddirection() this function specifies more precise tuning for sending events only for a specified direction of the link. Format: senddirection (direction) parameters: direction can have one of the following values: ...
Lecroy corporation verification script engine reference manual page 48 of 107 8.13 sendusb2busconditions() this function specifies more precise tuning for usb2 bus condition events. Only selected bus condition events are sent. Format: sendusb2busconditions (condition) parameters: condition specifies...
Lecroy corporation verification script engine reference manual page 49 of 107 8.14 sendusb2tokenpackets() this function specifies more precise tuning for usb2 token packets. Format: sendusb2tokenpackets (pid, address, endpoint) parameters: pid specifies that only token packets with the specified pid...
Lecroy corporation verification script engine reference manual page 50 of 107 8.15 sendusb2datapackets () this function specifies more precise tuning for data packets. Format: sendusb2datapackets(pid) parameters: pid specifies that only data packets with the specified data pid are sent. The value _a...
Lecroy corporation verification script engine reference manual page 51 of 107 8.16 sendusb2hskpackets() this function specifies more precise tuning for handshake packets. Format: sendusb2hskpackets(pid) parameters: pid specifies that only data packets with the specified data pid are sent. The value ...
Lecroy corporation verification script engine reference manual page 52 of 107 8.17 sendtransaction() this function works on the transaction level and allows specifying more precise tuning for the transaction events that are sent to the script. Format: sendtransaction(tra_type, xfer_type, address, en...
Lecroy corporation verification script engine reference manual page 53 of 107 8.18 sendtransfer() this function works on the transfer level and allows specifying more precise tuning for the transfer events that are sent to the script. Format: sendtransfer(xfer_type, address, endpoint, completed, onl...
Lecroy corporation verification script engine reference manual page 54 of 107 8.19 sendpktswithbadcrc() this function instructs vse to send packets with bad crc to the script. By default, packets with bad crc are not sent to verification scripts. • to determine whether a packet has an crc5 or crc16 ...
Lecroy corporation verification script engine reference manual page 55 of 107 9 packet and script decoded fields retrieving functions this group of functions covers vse generic capability to extract information about data payload fields decoded with catc script language (csl) at transfer level and a...
Lecroy corporation verification script engine reference manual page 56 of 107 9.2 gethexpktfield() extracts the raw hexadecimal value of the usb3 packet field. Format : gethexpktfield ( fld_name ) parameters fld_name name of the field supposedly existing in the current packet return values if the fi...
Lecroy corporation verification script engine reference manual page 57 of 107 9.3 getdecodedscriptfield() extracts information about the script decoded field and determines how it is shown in the usb protocol suite trace view or the “view … fields” dialog. Format : getdecodedscriptfield ( fld_name )...
Lecroy corporation verification script engine reference manual page 58 of 107 9.4 gethexscriptfield() extracts the raw hexadecimal value of the script decoded field. Format : gethexscriptfield ( fld_name ) parameters fld_name name of the field supposedly existing in the current transfer return value...
Lecroy corporation verification script engine reference manual page 59 of 107 10 timer functions this group of functions covers vse capability to work with timers, internal routines that repeatedly measure a timing interval between different events. 10.1 vse time object a vse time object presents ti...
Lecroy corporation verification script engine reference manual page 60 of 107 10.2 settimer() starts a timing calculation from the event at which this function was called. Format: sendtimer(timer_id = 0) parameters: timer_id unique timer identifier. Example: settimer(); # start timing for timer with...
Lecroy corporation verification script engine reference manual page 61 of 107 10.3 killtimer() stops a timing calculation for a specific timer and frees related resources. Format: killtimer(timer_id = 0) parameters: timer_id unique timer identifier. Example: killtimer(); # stop timing for timer with...
Lecroy corporation verification script engine reference manual page 62 of 107 10.4 gettimertime() retrieves a timing interval from the specific timer. Format: gettimertime (timer_id = 0) parameters: timer_id unique timer identifier. Return values: returns a vse time object from a timer with id = tim...
Lecroy corporation verification script engine reference manual page 63 of 107 11 time construction functions this group of functions is used to construct vse time objects. 11.1 time() constructs a verification script time object. Format: time(nanoseconds) time(seconds, nanoseconds) parameters: nanos...
Lecroy corporation verification script engine reference manual page 64 of 107 12 time calculation functions this group of functions covers vse capability to work with “time”, the vse time objects. 12.1 addtime() adds two vse time objects. Format: addtime(time1, time2) parameters: time_1 vse time obj...
Lecroy corporation verification script engine reference manual page 65 of 107 12.2 subtracttime() subtracts two vse time objects. Format: subtracttime (time1, time2) parameters: time_1 vse time object presenting first time interval time_2 vse time object presenting second time interval return values...
Lecroy corporation verification script engine reference manual page 66 of 107 12.3 multimebyint() multiplies a vse time object by an integer value. Format: multimebyint (time, mult) parameters: time vse time object mult multiplier, integer value return values: returns a vse time object representing ...
Lecroy corporation verification script engine reference manual page 67 of 107 12.4 divtimebyint() divides a vse time object by an integer value. Format: divtimebyint (time, div) parameters: time vse time object div divider, integer value return values: returns a vse time object representing time int...
Lecroy corporation verification script engine reference manual page 68 of 107 13 time logical functions this group of functions covers vse capability to compare vse time objects. 13.1 isequaltime() verifies that one vse time object is equal to another vse time object. Format: isequaltime (time1, tim...
Lecroy corporation verification script engine reference manual page 69 of 107 13.2 islesstime() verifies that one vse time object is less than another vse time object. Format: islesstime (time1, time2) parameters: time_1 vse time object representing the first time interval time_2 vse time object rep...
Lecroy corporation verification script engine reference manual page 70 of 107 13.3 isgreatertime() verifies that one vse time object is greater than another vse time object. Format: isgreatertime (time1, time2) parameters: time_1 vse time object representing the first time interval time_2 vse time o...
Lecroy corporation verification script engine reference manual page 71 of 107 13.4 istimeininterval() verifies that a vse time object is greater than a minimum vse time object and less than a maximum vse time object. Format: istimeininterval(min_time, time, max_time) parameters: min_time vse time ob...
Lecroy corporation verification script engine reference manual page 72 of 107 14 time text functions this group of functions covers vse capability to convert vse time objects into text strings. 14.1 timetotext() converts a vse time object into text. Format: timetotext (time) parameters: time vse tim...
Lecroy corporation verification script engine reference manual page 73 of 107 15 output functions this group of functions covers vse capability to present information in the output window. 15.1 reporttext() outputs text in the output window related to the verification script. Format: reporttext (tex...
Lecroy corporation verification script engine reference manual page 74 of 107 15.2 enableoutput() enables showing information in the output window and sending com reporting notifications to com clients. Format: enableoutput () example: enableoutput ();.
Lecroy corporation verification script engine reference manual page 75 of 107 15.3 disableoutput() disables showing information in the output window and sending com reporting notifications to com clients. Format: disableoutput () example: disableoutput ();.
Lecroy corporation verification script engine reference manual page 76 of 107 16 information functions 16.1 gettracename() this function returns the filename of the trace file being processed by vse. Format: gettracename(filepath_compatible) parameters: filepath_compatible if this parameter is prese...
Lecroy corporation verification script engine reference manual page 77 of 107 16.2 getscriptname() this function returns the name of the verification script where this function is called. Format: getscriptname() example: reporttext(“current script = ” + getscriptname());.
Lecroy corporation verification script engine reference manual page 78 of 107 16.3 getapplicationfolder() this function returns the full path to the folder where the application was started. Format: getapplicationfolder() example: reporttext(“application folder = ” + getapplicationfolder ());.
Lecroy corporation verification script engine reference manual page 79 of 107 16.4 getcurrenttime() this function returns the string representation of the current system time. Format: getcurrenttime() example: # yields current time in format “may 18, 2006, 5:49 pm” reporttext(getcurrenttime());.
Lecroy corporation verification script engine reference manual page 80 of 107 17 navigation functions 17.1 gotoevent() this function forces the application to jump to some trace event and shows it in the main trace view. Format: gotoevent(level, index) gotoevent() parameters: level transaction level...
Lecroy corporation verification script engine reference manual page 81 of 107 17.2 setmarker() this function sets a marker for some trace event. Format: setmarker(marker_text ) setmarker(marker_text, level, index) parameters: marker_text text of the marker level transaction level of the event to jum...
Lecroy corporation verification script engine reference manual page 82 of 107 18 file functions this group of functions covers vse capabilities to work with external files..
Lecroy corporation verification script engine reference manual page 83 of 107 18.1 openfile() this function opens a file for writing. Format: openfile(file_path, append, mode) parameters: file_path full path to the file to open. (for ‘\’ use ‘\\’) append this parameter (if present and not equal to 0...
Lecroy corporation verification script engine reference manual page 84 of 107 18.2 closefile() this function closes an opened file. Format: closefile(file_handle) parameters: file_handle file “handle” example: … set file_handle = 0; … file_handle = openfile(“d:\\log.Txt”); # opens file. # the previo...
Lecroy corporation verification script engine reference manual page 85 of 107 18.3 writestring() this function writes a text string to the file. Format: writestring(file_handle, text_string) parameters: file_handle file “handle” text_string text string remarks: if the file_handle parameter refers to...
Lecroy corporation verification script engine reference manual page 86 of 107 18.4 write() this function writes data to the file. Format: write(file_handle, value, num_of_bytes) parameters: file_handle "handle" to the file previously opened by openfile() value data to write num_of_bytes optional par...
Lecroy corporation verification script engine reference manual page 87 of 107 18.5 showinbrowser() this function opens a file in the windows explorer. If the extension of the file has the application registered to open files with such extensions, it is launched. For instance, if internet explorer is...
Lecroy corporation verification script engine reference manual page 88 of 107 19 trace file exporting functions this group of functions covers vse capabilities to export data into trace files..
Lecroy corporation verification script engine reference manual page 89 of 107 19.1 createtracefile() this function creates a trace file. Format: createtracefile( file_path ) parameters: file_path full path to the trace file to be created. (for ‘\’ use ‘\\’ ) return values: the “handle” to the trace ...
Lecroy corporation verification script engine reference manual page 90 of 107 19.2 closetracefile() this function closes an open trace file. All attempts to add trace data to a closed trace file are ignored. Format: closetracefile( tracefile_handle ) parameters: tracefile_handle trace file “handle” ...
Lecroy corporation verification script engine reference manual page 91 of 107 19.3 addeventtotracefile() this function adds the current trace event (such as frames) to the trace file. Format: addeventtotracefile ( tracefile_handle ) parameters: tracefile_handle trace file “handle” returned by the cr...
Lecroy corporation verification script engine reference manual page 92 of 107 19.4 opentracefile() this function opens a trace file in the application. Format: opentracefile (tracefile_path) parameters: tracefile_path path to a trace file to open. Remarks: if tracefile_path contains just a file name...
Lecroy corporation verification script engine reference manual page 93 of 107 20 com/automation communication functions this group of functions covers vse capabilities to communicate with com/automation™ clients connected to the application. (see the automation manual for details about how to connec...
Lecroy corporation verification script engine reference manual page 94 of 107 21 user input functions 21.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) parameter...
Lecroy corporation verification script engine reference manual page 95 of 107 return values: this function returns an integer value indicating which button was clicked. Constant description _mb_ok ok button was clicked. _mb_cancel cancel button was clicked. _mb_yes yes button was clicked. _mb_no no ...
Lecroy corporation verification script engine reference manual page 96 of 107 21.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 or string containing the contents of the text box. Format: inputbox(prompt, title, defaul...
Lecroy corporation verification script engine reference manual page 97 of 107 note: although the dialog box input text parser tries to determine a type of list item automatically, text enclosed in quote signs " " is always considered to be a string. Remark: this function works only for vs engines co...
Lecroy corporation verification script engine reference manual page 98 of 107 21.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 are shown and the script does not stop. By default, this ...
Lecroy corporation verification script engine reference manual page 99 of 107 21.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 are shown and the script does not stop. By default, this lim...
Lecroy corporation verification script engine reference manual page 100 of 107 22 string manipulation/formating functions 22.1 formatex() writes formatted data to a string. Format is used to control the way that arguments print out. The format string may contain conversion specifications that affect...
Lecroy corporation verification script engine reference manual page 101 of 107 remarks: 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 contro...
Lecroy corporation verification script engine reference manual page 102 of 107 23 miscellaneous functions 23.1 scriptfordisplayonly() specifies that the script is designed for displaying information only and that its author doesn’t care about the verification script result. Such a script has a resul...
Lecroy corporation verification script engine reference manual page 103 of 107 23.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 a sleeping time. Format: sleep(time) parameters: time vse time object ...
Lecroy corporation verification script engine reference manual page 104 of 107 23.3 converttohtml() this function replaces spaces with “   ” and carriage return symbols with “ ” in a text string. Format: converttohtml(text_string) parameters: text_string text string example: str = “hello world !...
Lecroy corporation verification script engine reference manual page 105 of 107 23.4 pause() pauses script running. Later, script execution can be resumed or cancelled. Format: pause() example: … if(something_interesting()) { gotoevent(); # jump to the trace view. Pause(); # pause script execution. }...
Lecroy corporation verification script engine reference manual page 106 of 107 24 the important vse script files the vse working files are located in the ..\scripts\vfscripts subfolder of the main application folder. The current version of vse includes following files: file description vstools.Inc m...
Lecroy corporation verification script engine reference manual page 107 of 107 how to contact lecroy type of service contract call for technical support… us and canada: 1 (800) 909-7112 worldwide: 1 (408) 653-1260 fax your questions… worldwide: 1 (408) 727-6622 write a letter … lecroy protocol solut...