Xilinx 8.2i Life Jacket User Manual


 
86 www.xilinx.com Development System Reference Guide
Chapter 3: Tcl
R
Note: See also the collection set command for more information on property values for the
collection command.
index (extract a collection object)
Given a collection and an index into it, the collection index command extracts the object at
the specified index and returns the object, if the index is in range. The base collection is
unchanged.
The range for an index is zero (0) to one less (-1) the size of the collection obtained with the
collection sizeof command. See “sizeof (show the number of objects in a collection).”
collection index <collection_variable> <index>
collection is the name of the Xilinx Tcl command.
index is the name of the collection subcommand.
collection_variable specifies the name of the collection for index.
index specifies the index into the collection. Index values are 0 to -1, unless the size of the
collection was defined with the collection sizeof command.
Note:
Xilinx-specific Tcl commands that create a collection of objects do not impose a specific order
on the collection, but they do generate the objects in the same, predictable order each time.
Applications that support sorting collections, can impose a specific order on a collection.
properties (list available collection properties)
The collection properties command displays a list of the supported properties for all
collections in the current ISE project. You can set the value of any property with the
collection set command.
% collection properties
collection is the name of the Xilinx Tcl command.
Example: % set colVar [search * -type instance]
% set item [collection index $colVar 2]
% object name $item
Description: In this example, the collection index command extracts the third object
in the collection of instances.
In the first line, the set command is used to create a collection variable
named colVar. The nested search command defines the value of the
collection for colVar, which in this case is all of the instances in the
current design.
In the second line, the set command is used to create a variable
named item. The nested collection index command obtains the third
object (starting with index 0, 1, 2 . . .) in the given collection.
The last line of this example uses the object name command to return
the value of the item variable, which is the specified value of index.
Tcl Return: The object at the specified index.