Quartus® Prime Pro Edition User Guide: Design Compilation

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

1.3.2.1. Scripting Routine Tasks Using Tcl Commands

The following examples enumerate how you can easily script a few routine tasks, such as attribute-based object filtering, name-based searching, or traversing object relationships, using different features of the get command:

Retrieving Top-level Input Ports (highlighted in the schematic)

In some scenarios, you may need a list of top-level ports. For example, to ensure all input ports are constrained with set_input_delay, you must retrieve all ports in the design and filter based on direction using the dni::get_ports tcl command, as shown in the following:
dni::get_ports -filter direction==input

The tcl command returns a collection of input ports in the design, such as PI_1, PI_2, and PI_3. You can use the returned collection to pass or chain into other get_object commands. To access members of the collection, use collection iterators, such as foreach_in_collection. For example:

foreach_in_collection p [dni::get_ports -filter direction=input] { puts $p }
port::top::PI_1
port::top::PI_2
port::top::PI_3

Retrieving the inst_1 Instance

Within your design, you can search for a specific object (for example, instance) by name. To find an instance, use the dni::get_cells tcl command, as shown in the following:
dni::get_cells inst_1

The tcl command returns the inst_1 instance in the design. You can use the returned instance to pass or chain into other get_object commands. For example:

foreach_in_collection p [dni::get_cells inst_1] { puts [dni::get_property -name name -object $p] }
inst_1

Retrieving the in_1 Instance Port of the inst_1 Instance

During connectivity traversal, you may want to find a specific instance pin of an instance. In such scenarios, use the -of_object interface of the dni::get_pins command to traverse instance-to-instance pin relationship as shown in the following:
dni::get_pins -of_objects [dni::get_cells inst_1] -filter name==in_1

The tcl command returns in_1 instance port of the inst_1 instance in the design. You can use the returned instance port to pass or chain into other get_object commands. For example:

foreach_in_collection p [dni::get_pins -of_objects [dni::get_cells inst_1] -filter name==in_1] { puts $p }
inst_port::top::inst_1|in_1

Retrieving Nets of the inst_1|out1 Instance

During connectivity trace, you may want to traverse all nets connected to an instance. In such a scenario, use the -of_objects interface of the dni::get_nets command to traverse nets connected to an instance. For example:

dni::get_nets -of_objects [dni::get_cells inst_1|out_1]

The tcl command returns nets of the inst_1|out1 instance in the design. You can use the returned collection to pass or chain into other commands. For example:

foreach_in_collection p [dni::get_nets -of_objects [dni::get_cells inst_1|out_1] ] { puts $p }
inst_port::top::inst_1|out_1|Net_7
inst_port::top::inst_1|out_1|Net_6
inst_port::top::inst_1|out_1|Net_8

Listing the Properties Available on the net Object Type

The tcl interface allows you to access object schema via the dni::list_properties tcl command. You can use this command to list accessible properties of any object type as follows:
dni::list_properties -type net
name parent_name number_of_ports ports net_bus_name source_file source_line is_user_declared