UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 35254

Tcl - How to run programs from Tcl?

Description

Is there a way to run non-Tcl commands and programs from a Tcl script.

When running non-Tcl commands from my Tcl script, I receive an 'invalid command name' message.

Example:

I encountered the following error when running a Tcl file with a compxlib command.

invalid command name "compxlib"
while executing
"compxlib -s questa -l verilog -arch all -lib all -w -dir C:\work\"
<file "test.tcl" line 1>

Solution

The 'invalid command name' message comes because the program command being executed is not a Tcl command.

Tcl scripts use "exec" to invoke other programs.

For the example above, the error will be removed by adding "exec" as below.

execcompxlib -s questa -l verilog -arch all -lib all -w -dir C:\work\

The user should ensure that the command being executed is in the system PATH or provide the complete path to the executable within the exec command.

AR# 35254
Date Created 04/26/2010
Last Updated 12/15/2012
Status Active
Type General Article