Foreach_in_collection, Usage, Options – Altera Quartus II Scripting User Manual

Page 302: Description, Example, Foreach_in_collection –172

Advertising
background image

3–172

Chapter 3: Tcl Packages & Commands

misc

Quartus II Scripting Reference Manual

© July 2013

Altera Corporation

foreach_in_collection

Usage

foreach_in_collection <variable_name> <collection> <body>

Options

<variable_name>: Variable name

<collection>: Collection

<body>: Body

Description

Accesses each element of a collection.

Some Tcl commands return a collection. The following table shows examples of commands that return a
collection:

The command is used in the following format:

foreach_in_collection <variable name> <collection> {

# This is the body of "foreach_in_collection"
...
}

Unlike a Tcl list, a collection is a container specific to the Quartus II software, whose elements can be
accessed by using the "foreach_in_collection" command.

Example

## Get a collection of global assignments
set collection_of_global_assignments [get_all_global_assignments -name *]
## Display the collection string representation
puts $collection_of_global_assignments
## Iterate through the collection and display
## the information for each global assignment
foreach_in_collection global $collection_of_global_assignments {

set sect_id [lindex $global 0]
set name [lindex $global 1]
set value [lindex $global 2]

## Now, display the content of the global assignment

Tcl package

Tcl commands (returning a collection)

::quartus::project

get_all_quartus_defaults
get_all_global_assignments
get_all_instance_assignments
get_all_parameters
get_names assignment_group (only for the "-get_members"
and "-get_exceptions" options)

::quartus::chip_editor

get_nodes
get_iports
get_oports

::quartus::advanced_timing

get_timing_nodes
get_timing_edges

Advertising