Redirecting Output - 2024.1 English

Vivado Design Suite User Guide: Using Tcl Scripting (UG894)

Document ID
Release Date
2024.1 English

Many of the Vivado Design Suite Tcl commands allow you to redirect the information returned by the command to a file with the -file option, for printing or processing outside of the tool; or as a string that can be saved in a variable with the -return_string option for further processing within the Vivado tools.

All of the report commands support the -file option. File output is useful for report commands that output a great deal of information, that might require further review, or support the documentation of a design project, or to pass to downstream processes such as other design disciplines, or other departments. Some of the commands supporting file output include:


For example, to save the results of the report_timing command to a file:

report_timing -delay_type max -file setup_violations.rpt
report_timing -delay_type min -file hold_violations.rpt

A relative or absolute path can be specified as part of the file name. A relative path is relative to the directory from which the Vivado tools are started, or to the current working directory which can be retrieved with the pwd command.

Tip: If the path is not specified as part of the file name, the file is written into the current working directory, or the directory from which the Vivado tools were launched.

To append the content from a command to an existing file, use the -append option in addition to -file. For example, the code below creates one file, all_violations.rpt, that combines the output of two separate commands:

report_timing -delay_type max -file all_violations.rpt
report_timing -delay_type min -file -append all_violations.rpt

After the file has been created, you might need to access the file from the file system, opening the file to read from it, or to write to it. The Vivado Design Suite Tcl Console offers a number of commands for accessing files. See Accessing Files for more information.

All report_* commands also support the -return_string option. This option directs the command to return its output as a string that can be assigned to a Tcl variable. Assigning the command output to a variable is useful for further processing within the Tcl script, to allow extraction of key information to enable flow control, branching, and to set other variables for use in the script.

Some of the commands that support -return_string are:


You can split the returned string from the report on the newline character, \n, to process the string line by line as a list:

set timeLines [split [report_timing -return_string -max_paths 10] \n ]

The Vivado Design Suite Tcl Console also offers many tool for working with strings. See Working with Strings for more information.