To write the STAPL file using the Vivado Tcl
mode or the Tcl Console in the Vivado IDE, use the write_hw_stapl
command.
The STAPL chain direct FPGA/SoC operations are captured in a temporary
file. When the write_hw_stapl
command is called, the
temporary file is moved to the filename passed to the command. After the write_hw_stapl
command is called, the temporary file is
reset, and a subsequent programming operation is added to the beginning of the STAPL
file sequence.
The following code segment shows the Tcl commands used to create a file named my_vc1902.stapl containing the direct programming of an xcvc1902 device:
create_hw_target -stapl my_stapl_target
open_hw_target
set device0 [create_hw_device -part xcvc1902]
set_property PROGRAM.FILE {my_xcvc1902.pdi} $device0
program_hw_devices $device0
current_hw_device [lindex [get_hw_devices] 1]
write_hw_stapl my_xcvc1902.stapl
close_hw_target
In this sample code, the xcvc1902 device is created using the create_hw_device
command, whose return value is set to a
temporary variable called device0. This temporary value is used to reference the object
when setting the PROGRAM.FILE property to the file my_xcvc1902.pdi file. Next, the program_hw_device
command is called using the device0 reference. When this
program_hw_device
command runs, it creates a
temporary STAPL file with the STAPL operations necessary to program the my_xcvc1902.pdi file on the xcvc1902. Lastly, the write_hw_stapl
command takes the temporary file to the
final target destination, my_xcvc1902.stapl. At
this point, the STAPL file creation process is complete, and the target can be
closed.
create_hw_device
commands between
programming commands, you produce an output STAPL file with two different chain
sequences.Example of Incorrect STAPL File Creation Steps:
create_hw_target -stapl my_stapl_target
open_hw_target
set device0 [create_hw_device -part xcvc1902]
set_property PROGRAM.FILE {my_xcvc1902_1.pdi} $device0
# this program command will produce stapl instructions
# which account for only device0 in chain
program_hw_devices $device0
set device1 [create_hw_device -part xcvc1902]
set_property PROGRAM.FILE {my_xcvc1902_2.pdi} $device1
# this program command will produce stapl instructions
# which account for device0 and device1 in chain
program_hw_devices $device1
write_hw_stapl my_bad_xcvc1902.stapl
close_hw_target
The first program command only captures the chain definition containing the first device. The second program command includes both devices in the chain when writing out the STAPL instructions. Therefore, if you attempt to play this STAPL file on a chain with two devices, the first programming operations fail because the live chain gets two devices, not one, as the command expected.
create_hw_device
commands first. After the chain is completely defined,
perform the program operations as
follows:create_hw_target -stapl my_stapl_target
open_hw_target
# create device chain first
set device0 [create_hw_device -part xcvc1902]
set device1 [create_hw_device -part xcvc1902]
# program device0
set_property PROGRAM.FILE {my_xcvc1902_1.bit} $device0
program_hw_devices $device0
# program device1
set_property PROGRAM.FILE {my_xcvc1902_2.bit} $device1
program_hw_devices $device1
write_hw_stapl my_good_xcvc1902.stapl
close_hw_target