User`s manual
List processing
ModelSim Xilinx User’s Manual Tcl and ModelSim 10-249
Environment variables can also be set using the env array:
set env(SHELL) /bin/csh
See "Simulator state variables" (A-283) for more information about VSIM-defined
variables.
System commands
To pass commands to the DOS window, use the Tcl exec command:
echo The date is [exec date]
List processing
In Tcl a "list" is a set of strings in curly braces separated by spaces. Several Tcl
commands are available for creating lists, indexing into lists, appending to lists,
getting the length of lists and shifting lists. These commands are:
Two other commands, lsearch and lsort, are also available for list manipulation.
See the Tcl man pages (Main window: Help > Tcl Man Pages) for more
information on these commands.
See also the ModelSim Tcl command: lecho
(CR-61)
Command syntax Description
lappend var_name val1 val2 ... appends val1, val2, etc. to list var_name
lindex list_name index return the index-th element of list_name; the first element is 0
linsert list_name index val1 val2 ... inserts val1, val2, etc. just before the index-th element of
list_name
list val1, val2 ... returns a Tcl list consisting of val1, val2, etc.
llength list_name returns the number of elements in list_name
lrange list_name first last returns a sublist of list_name, from index first to index last;
first or last may be "end", which refers to the last element in
the list
lreplace list_name first last val1, val2, ... replaces elements first through last with val1, val2, etc.