write_hw_svf - 2022.1 English

Vivado Design Suite Tcl Command Reference Guide (UG835)

Document ID
Release Date
2022.1 English

Generate SVF file for current_hw_target


write_hw_svf [‑force] [‑quiet] [‑verbose] <file_name>


Name Description
[-force] overwrite svf file if it exists
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution
<file_name> SVF filename




The Vivado® hardware manager supports programming of hardware devices through the use of Serial Vector Format (SVF) files. SVF files are ASCII files that contain both programming instructions and configuration data. These files are used by ATE machines and embedded controllers to perform boundary-scan operations. The SVF file captures the JTAG commands needed to program the bitstream directly into a Xilinx® device, or indirectly into a flash memory device. The SVF file can be written using the write_hw_svf command, or applied to an open hw_target through the execute_hw_svf command. Refer to the Vivado Design Suite User Guide: Programming and Debugging (UG908) for more information.

The specific process for creating the hw_svf file is:
  1. Create an SVF target using create_hw_target.
  2. Open the SVF target.
  3. Create one or more devices on the SVF target using create_hw_device.
  4. Program the devices using commands like program_hw_devices.
  5. Write the SVF file of operation commands using write_hw_svf.
In programming the hw_devices in Step 4 above, the SVF commands for the operations are cached to a temporary file. The write_hw_svf command saves the cache by giving it a file name and moving it to the specified file path.
Note: Because this command is essentially flushing the cached SVF commands, after you use the write_hw_svf command, the cache is cleared, and restarted to capture any new device commands.

This command returns a message indicating success, or returns an error if it fails.


-force - (Optional) Overwrite an existing file of the same name.

-quiet - (Optional) Execute the command quietly, returning no messages from the command. The command also returns TCL_OK regardless of any errors encountered during execution.
Note: Any errors encountered on the command-line, while launching the command, will be returned. Only errors occurring inside the command will be trapped.
-verbose - (Optional) Temporarily override any message limits and return all messages from this command.
Note: Message limits can be defined with the set_msg_config command.
<file_name> - Specifies the SVF file name to write. You should specify a suffix (.svf) for the file as one will not be automatically assigned.
Note: If the path is not specified as part of the file name, the file will be written into the current working directory, or the directory from which the tool was launched.


The following example writes an SVF file to specified location:
program_hw_devices [lindex [get_hw_devices] 0]
write_hw_svf C:/Data/k7_design.svf
This example demonstrates the correct order of creating multiple devices on an SVF target. An SVF target is created and opened, then a Xilinx® device, a user part, and a second Xilinx device are created on the current target. The bitstream properties are defined for the two Xilinx devices, the devices are programmed, and an SVF file is written:
create_hw_target my_svf_target
create_hw_device -part xc7k325t
create_hw_device -idcode 01234567 -irlength 8 -mask ffffffff -part userPart1
create_hw_device -part xcku9p
set_property PROGRAM.FILE {C:/Data/k7_design.bit} [lindex [get_hw_devices] 0]
set_property PROGRAM.FILE {C:/Data/ku_design.bit} [lindex [get_hw_devices] 2]
program_hw_devices [lindex [get_hw_devices] 0]
program_hw_devices [lindex [get_hw_devices] 2]
write_hw_svf C:/Data/myDesign.svf
The following example demonstrates creating a device on an SVF target, creating a configuration memory object (hw_cfgmem) associated with that device, programming the device and configuration memory, and saving that command sequence to an SVF file:
create_hw_target my_svf_target
set device [create_hw_device -part xc7k325t]
set_property PROGRAM.FILE {C:/Data/k7_design.bit} $device
create_hw_cfgmem -hw_device $device -mem_dev  [lindex \
[get_cfgmem_parts {28f00am29ew-bpi-x16}] 0]
set cfgMem [current_hw_cfgmem]
set_property PROGRAM.ADDRESS_RANGE  {use_file} $cfgMem
set_property PROGRAM.BLANK_CHECK  0 $cfgMem
set_property PROGRAM.BPI_RS_PINS {none} $cfgMem
set_property PROGRAM.CFG_PROGRAM  1 $cfgMem
set_property PROGRAM.CHECKSUM  0 $cfgMem
set_property PROGRAM.ERASE  1 $cfgMem
set_property PROGRAM.UNUSED_PIN_TERMINATION {pull-none} $cfgMem
set_property PROGRAM.VERIFY  1 $cfgMem
set_property PROGRAM.FILES [list {C:/data/flash.mcs} ] $cfgMem
create_hw_bitstream -hw_device $device [get_property \
program_hw_devices $device
program_hw_cfgmem -hw_cfgmem $cfgMem
write_hw_svf C:/Data/myDesign.svf