Getting User Input - 2020.2 English

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

Document ID
Release Date
2020.2 English
In a traditional tclsh shell, your input is typically captured using the stdin channel. For example:
gets stdin answer

In the Vivado IDE, the Tcl code can be executed in different environments that are most of the time incompatible with the stdin channel. Unless you know that the script will only be executed in Vivado Tcl mode on a local shell, stdin cannot be used to get user input.

Your input is typically used to alter the behavior of a script or set values for parameters. In this regard, getting some information through stdin is unreliable and prone to errors (typos, wrong value, etc.).

It is recommended that you provide custom values to a script through a configuration file that can be easily read by the Tcl script. A configuration file can be as simple as a list of Tcl variables in a file that can be imported in a script using the command: source

Such a configuration file can be used whether the Vivado IDE is run in batch mode or using a remote machine (LSF, etc.).