XFP Scripting – PipeTest Walkthrough

The PipeTest XFP file depends on new XFP scripting features introduced with FrontPanel 5.1.

FrontPanel 5.1 includes a new XFP file for interacting with the PipeTest sample that can be used to perform PipeTest transactions without running the C++ sample application.


The PipeTest sample XFP can be used to perform simple read and write transfers of any valid number of bytes with the FPGA module.

To begin using the sample XFP, program the FPGA with the PipeTest sample bitfile through FrontPanel.The “Read Length Bytes” and “Write Length Bytes” fields are used to set the byte lengths of each respective transfer. Valid byte lengths can be found in the API documentation for WriteToPipeIn and ReadFromPipeOut.

Entering a byte length and clicking the corresponding pipe transfer button will begin a transfer. The Status text at the bottom of the window will change to indicate that the transfer is ongoing and when it has completed. If an error is found in the data, the corresponding error counter will increment and an error message will be displayed below the status.

The “Throttle Out” and “Throttle In” fields allow configuration of the 32-bit throttle out and throttle in vectors. The throttle settings are used by the FPGA to control the Block pipe ep_ready signal; each 0 bit in a throttle vector will slow down the transfer by 1/32. A throttle setting of FFFFFFFE will result in a 31/32 speed transfer, whereas a setting of AAAAAAAA will result in a 1/2 speed transfer.

In the initial release the Counter pattern is the only data pattern implemented in this design.

Behind the Scenes

The PipeTest sample XFP consists of two components, the XFP file used to add components to the panel and a corresponding Lua script to implement the PipeTest logic.

PipeTest.xfp is functionally similar to other sample XFP files with the exception of the new name attribute that has been added to some objects in the panel to allow accessing and modifying them from the Lua script. In addition, the two okPushButton objects used to initiate the PipeTest transfers contain a new functionname XML attribute. This attribute is used to execute a Lua function when the button is pressed.

All of the logic behind the PipeTest sample is contained within the PipeTest.lua script. This script is loaded by FrontPanel through the new okScript XML object and an initialization function is run when the panel is loaded in FrontPanel using the okInitScript XML object. More information on Lua scripting can be found in the XML Scripting Overview.