Xilinx 8.2i Life Jacket User Manual


 
Development System Reference Guide www.xilinx.com 55
Tcl Fundamentals
R
Tcl Fundamentals
This section provides some very basic information about the syntactic style of Xilinx Tcl
commands. For more information about Tcl in general, please refer to Tcl documentation
easily available on the internet, for example: http://www.tck.tk/doc
, which is the website
for the Tcl Developer Xchange.
In general, Tcl commands are procedural. Each Tcl command is a series of words, with the
first word being the command name. For Xilinx Tcl commands, the command name is
either a noun (e.g., project) or a verb (e.g., search). For commands that are nouns, the
second word on the command line is the verb (e.g., project open). This second word is
called the subcommand.
Subsequent words on the command line are additional parameters to the command. For
Xilinx Tcl commands, required parameters are positional, which means they must always
be specified in an exact order and follow the subcommand. Optional parameters follow
the required parameters, can be specified in any order, and always have a flag that starts
with “-“to indicate the parameter name; for example, -instance <instance-name>.
Tcl is case sensitive. Xilinx Tcl command names are always lower case. If the name is two
words, the words are joined with an underscore (_). Even though Tcl is case sensitive, most
design data (e.g., an instance name), property names, and property values are case
insensitive. To make it less burdensome to type at the command prompt, unique prefixes
are recognized when typing a subcommand, which means only typing the first few letters
of a command name is all that is required for it to be recognized. Unique prefixes are also
recognized for partition properties and property values.
The real power of Tcl is unleashed when it is used for nested commands and for scripting.
The result of any command can be stored in a variable. Values are assigned to variables and
properties with the set command. The set command takes two arguments. The first
argument is the name of the variable and the second argument is the value. It is not
necessary to declare Tcl variables before you use them. If one does not exist, it is created
when the command is executed.
In Tcl, the dollar-sign ($) syntax is used to substitute a variable’s value for its name. For
example, $foo in a Tcl command is replaced by the value of the variable foo.
The result of a command can also be substituted directly into another command. Tcl uses
square brackets [ ] for these nested commands. Tcl interprets everything between square
brackets [ ] as a command and substitutes the command result for the text within the
square brackets [ ].
Tcl provides several ways to quote strings that contain spaces or other special characters
and to manage substitution. Double quotes (“) allow some special characters ([ ] and $) for
substitution. Curly braces { } perform no substitutions.
For very specific command line examples, please see the “Tcl Commands for General
Usage” and “Tcl Commands for Advanced Scripting” sections of this chapter.