Quartus® Prime Pro Edition User Guide: Scripting

ID 683432
Date 7/08/2024
Public
Document Table of Contents

2.6.3.1. The foreach_in_collection Command

The foreach_in_collection command is similar to the foreach Tcl command. Use it to iterate through all elements in a collection. The following example prints all instance assignments in an open project.

foreach_in_collection Example

set all_instance_assignments [get_all_instance_assignments -name *]
foreach_in_collection asgn $all_instance_assignments {
	# Information about each assignment is
	# returned in a list. For information
	# about the list elements, refer to Help
	# for the get-all-instance-assignments command.
	set to [lindex $asgn 2]
	set name [lindex $asgn 3]
	set value [lindex $asgn 4]
	puts "Assignment to $to: $name = $value"
}