Running Vitis HLS from the Command Line - 2022.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2022-12-07
Version
2022.2 English

Vitis™ HLS can be run from the GUI, as previously discussed, interactively from the command line, or in batch mode from a Tcl script. This section discusses running the tool interactively, or in batch mode.

Running Vitis HLS Interactively

You can launch Vitis HLS using the -i option to open the tool in interactive mode.

$ vitis_hls -i
When running interactively, the tool displays a command line prompt for you to enter commands:
vitis_hls>
You can use the help command to get a list of commands that you can use in this mode, as described in Vitis HLS Command Reference.
vitis_hls> help

Help for any individual command is provided by using the command name as an option to the help command. For example, help for the add_files command can be returned with:

vitis_hls> help add_files

Vitis HLS also supports an auto-complete feature by pressing the tab key at any point when entering commands. The tool displays the possible matches based on typed characters to complete the command, or command option. Entering more characters improves the filtering of the possible matches.

Type the exit or quit command to quit Vitis HLS.

Tip: On the Windows OS, the Vitis HLS command prompt is implemented using the Minimalist GNU for Windows (minGW) environment, that supports both standard Windows DOS commands, and a subset of Linux commands. For example, both the Linux ls command and the DOS dir command is used to list the contents of a directory. Linux paths in a Makefile expand into minGW paths. Therefore, in all Makefile files you must put the path name in quotes to prevent any path substitutions, for example FOO := ":/".

Running Vitis HLS in Batch Mode

Vitis™ HLS can also be run in batch mode, by specifying a Tcl script for the tool to run when launching as follows:
vitis_hls -f tcl_script.tcl

Commands embedded in the specified Tcl script are executed in the specified sequence. If the Tcl script includes the exit or quit command, then the tool exits at that point, completing the batch process. If the Tcl script does not end with the exit command, Vitis HLS returns to the command prompt, letting you continue in interactive mode.

All of the Tcl commands used when creating a project in the GUI are written to the solution/script.tcl file within the project. You can use this script as a starting point for developing your own batch scripts. An example script is provided below:
open_project dct
set_top dct
add_files ../dct_src/dct.cpp
add_files -tb ../dct_src/out.golden.dat -cflags "-Wno-unknown-pragmas" -csimflags "-Wno-unknown-pragmas"
add_files -tb ../dct_src/in.dat -cflags "-Wno-unknown-pragmas" -csimflags "-Wno-unknown-pragmas"
add_files -tb ../dct_src/dct_test.cpp -cflags "-Wno-unknown-pragmas" -csimflags "-Wno-unknown-pragmas"
open_solution "solution1" -flow_target vitis
set_part {xcvu11p-flga2577-1-e}
create_clock -period 10 -name default
source "./dct/solution1/directives.tcl"
csim_design
csynth_design
cosim_design
export_design -format ip_catalog

When opening a legacy Vitis™ HLS project in Vitis HLS, you must specify the -upgrade or -reset option.

  • -upgrade will perform conversion of a Vivado HLS project to a Vitis HLS project.
  • -reset will restore the project to its initial state.
Tip: The open_project command will return an error when opening a Vitis HLS project unless the -upgrade or -reset option is used.