Using the Command Line - 2021.2 English

Vivado Design Suite User Guide: Programming and Debugging

Document ID
UG908
Release Date
2021-10-22
Version
2021.2 English

To write the SVF file using the Vivado Tcl mode or the Tcl Console in the Vivado IDE use the write_hw_svf command.

The SVF chain, direct FPGA and indirect flash programming operations are captured in a temporary file. When the write_hw_svf command is called, the temporary file is moved to the filename passed to the command. After the write_hw_svfcommand is called, the temporary file is reset and a subsequent programing operation is added to the beginning of the SVF file sequence.

The following code segment shows the Tcl commands used to create a file named my_xcku9p.svf containing the direct programming of a xcku9p device:

create_hw_target my_svf_target
open_hw_target
set device0 [create_hw_device -part xcku9p]
set_property PROGRAM.FILE {my_xcku9p.bit} $device0
program_hw_devices $device0
write_hw_svf my_xcku9p.svf
close_hw_target

In this sample code the xcku9p device is created using create_hw_device command whose return value is set to a temporary variable called device0. This temporary value is then used to reference the object when setting the PROGRAM.FILE property to the file my_xcku9p.bit file. Next, the program_hw_device command is called using the device0 reference. When this program_hw_device command runs, it creates a temporary SVF file with the SVF operations necessary to program the my_xcku9p.bit file on the xcku9p. Lastly, the write_hw_svf command takes the temporary file and moves it to the final target destination, myxcku9p.svf. At this point, the SVF file creation process is complete and the target can be closed.

Tip: A final note on writing SVF files is that you should first create all the devices for the JTAG chain and then perform the programming operations. If you happen to interleave create_hw_device commands in between programming commands you will produce an output SVF file that has two different chain sequences.
  • Example of Incorrect SVF File Creation Steps:
    create_hw_target my_svf_target
    open_hw_target
    set device0 [create_hw_device -part xcku9p]
    set_property PROGRAM.FILE {my_xcku9p1.bit} $device0
    # this program command will produce SVF instructions 
    #  which account for only device0 in chain
    program_hw_devices $device0
    set device1 [create_hw_device -part xcku9p]
    set_property PROGRAM.FILE {my_xcku9p2.bit} $device1
    # this program command will produce SVF instructions 
    #  which account for device0 and device1 in chain
    program_hw_devices $device1
    write_hw_svf my_bad_xcku9p.svf
    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 SVF instructions. Therefore, if you attempt to play this SVF file on a chain with two devices, the first programming operations fail because the live chain gets two devices and not one as the command expected.

To correct this problem you run the create_hw_device commands first. Then after the chain is completely defined, perform the program operations as shown below:

  • Example of Correct SVF File Creation Steps
    create_hw_target my_svf_target
    open_hw_target
    # create device chain first
    set device0 [create_hw_device -part xcku9p]
    set device1 [create_hw_device -part xcku9p]
    # program device0
    set_property PROGRAM.FILE {my_xcku9p1.bit} $device0
    program_hw_devices $device0
    # program device1
    set_property PROGRAM.FILE {my_xcku9p2.bit} $device1
    program_hw_devices $device1
    write_hw_svf my_good_xcku9p.svf
    close_hw_target