get_nets - 2020.2 English

Vivado Design Suite Tcl Command Reference Guide (UG835)

Document ID
UG835
Release Date
2020-11-18
Version
2020.2 English

Get a list of nets in the current design

Syntax

get_nets [‑hsc <arg>] [‑hierarchical] [‑regexp] [‑nocase] [‑filter <arg>]
    [‑of_objects <args>] [‑match_style <arg>]
    [‑top_net_of_hierarchical_group] [‑segments] [‑boundary_type <arg>]
    [‑quiet] [‑verbose] [<patterns>]

Returns

list of net objects

Usage

Name Description
[-hsc] Hierarchy separator Default: /
[-hierarchical] Search level-by-level in current instance
[-regexp] Patterns are full regular expressions
[-nocase] Perform case-insensitive matching (valid only when -regexp specified)
[-filter] Filter list with expression
[-of_objects] Get nets of these pins, ports, cells, timing paths or clocks, drc violations
[-match_style] Style of pattern matching, valid values are ucf, sdc Default: sdc
[-top_net_of_hierarchical_group] Return net segment(s) which belong(s) to the high level of a hierarchical net
[-segments] Return all segments of a net across the hierarchy
[-boundary_type] Return net segment connected to a hierarchical pin which resides at the same level as the pin (upper) or at the level below (lower), or both. Valid values are : upper, lower, both Default: upper
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution
[<patterns>] Match net names against patterns Default: *

Categories

SDC, XDC, Object

Description

Gets a list of nets in the current design that match a specified search pattern. The default command gets a list of all nets in the current_instance of the open design, as specified by the current_instance command.

You can use the -hierarchical option to extract nets from the hierarchy of the current design.

Note: To improve memory and performance, the get_* commands return a container list of a single type of objects (e.g. cells, nets, pins, or ports). You can add new objects to the list (using lappend for instance), but you can only add the same type of object that is currently in the list. Adding a different type of object, or string, to the list is not permitted and will result in a Tcl error.

Arguments

-hsc <arg> - (Optional) The default hierarchy separator is '/'. Use this argument to specify a different hierarchy separator.

-hierarchical - (Optional) Get nets from all levels of the design hierarchy starting at the current instance. Without this argument, the command will only get nets from the current instance, as set by the current_instance command. When using -hierarchical, the search pattern should not contain a hierarchy separator because the search pattern is applied at each level of the hierarchy, not to the full hierarchical net name. For instance, searching for U1/* searches each level of the hierarchy for nets with U1/ in the name. This may not return the intended results. See get_cells for examples of -hierarchical searches.
Note: When used with -regexpr, the specified search string is matched against the full hierarchical name, and the U1/* search pattern will work as intended.
-regexp - (Optional) Specifies that the search <patterns> are written as regular expressions. Both search <patterns> and -filter expressions must be written as regular expressions when this argument is used. Xilinx regular expression Tcl commands are always anchored to the start of the search string. You can add ".*" to the beginning or end of a search string to widen the search to include a substring. See http://perldoc.perl.org/perlre.html for help with regular expression syntax.
Note: The Tcl built-in command regexp is not anchored, and works as a standard Tcl command. For more information refer to http://www.tcl.tk/man/tcl8.5/TclCmd/regexp.htm.

-nocase - (Optional) Perform case-insensitive matching when a pattern has been specified. This argument applies to the use of -regexp only.

-filter <args> - (Optional) Filter the results list with the specified expression. The -filter argument filters the list of objects returned by get_nets based on property values on the nets. You can find the properties on an object with the report_property or list_property commands. In the case of the nets object, "PARENT", "TYPE" and "MARK_DEBUG" are some of the properties that can be used to filter results.

The filter search pattern should be quoted to avoid having to escape special characters that may be found in net, pin, or cell names, or other properties. String matching is case-sensitive and is always anchored to the start and to the end of the search string. The wildcard “*” character can be used at the beginning or at the end of a search string to widen the search to include a substring of the property value.
Note: The filter returns an object if a specified property exists on the object, and the specified pattern matches the property value on the object. In the case of the "*" wildcard character, this will match a property with a defined value of "".
For string comparison, the specific operators that can be used in filter expressions are "equal" (==), "not-equal" (!=), "match" (=~), and "not-match" (!~). Numeric comparison operators <, >, <=, and >= can also be used. Multiple filter expressions can be joined by AND and OR (&& and ||). The following gets input pins that do NOT contain the “RESET” substring within their name:
get_pins * -filter {DIRECTION == IN && NAME !~ "*RESET*"}
Boolean (bool) type properties can be directly evaluated in filter expressions as true or not true:
-filter {IS_PRIMITIVE && !IS_LOC_FIXED}
-of_objects <arg> - (Optional) Get a list of the nets connected to the specified cells, pins, ports, or clocks; or nets associated with specified DRC violation objects.
Note: The -of_objects option requires objects to be specified using the get_* commands, such as get_cells or get_pins, rather than specifying objects by name. In addition, -of_objects cannot be used with a search <pattern>.

-match_style [sdc | ucf] - (Optional) Indicates that the search pattern matches UCF constraints or SDC constraints. The default is SDC.

-top_net_of_hierarchical_group - (Optional) Returns the top-level net segment of a hierarchical net, or nets, or the top-level net segments of all nets. Use this option with -segment to return the top-level net segment from all the segments of a hierarchical net.

-segments - (Optional) Get all the segments of a hierarchical net, across all levels of the hierarchy. This differs from the -hierarchical argument in that it returns all segments of the specified net, rather than just the specified net.
Important: The -segments option is applied after the -filter option has eliminated nets that do not match the filter pattern. Because of this, you may expect to see net segments returned that have already been filtered out of the returned results. To change this behavior, you can use the filter command rather than the -filter option to apply the -segments option to the get_nets command, and then filter the segments returned. See the Examples for more information.
-boundary_type [ upper | lower | both ] - (Optional) Gets the net segment at the level (upper) of a specified hierarchical pin, at the level below (lower) the pin or port, or both the level of and the level below. Valid values are upper, lower, or both. The default value is upper.
Note: This argument must be used with the -of_objects argument to specify the hierarchical pin.
-quiet - (Optional) Execute the command quietly, returning no messages from the command. The command also returns TCL_OK regardless of any errors encountered during execution.
Note: Any errors encountered on the command-line, while launching the command, will be returned. Only errors occurring inside the command will be trapped.
-verbose - (Optional) Temporarily override any message limits and return all messages from this command.
Note: Message limits can be defined with the set_msg_config command.
<patterns> - (Optional) Match nets against the specified patterns. The default pattern is the wildcard '*' which returns a list of all nets in the project. More than one pattern can be specified to find multiple nets based on different search criteria.
Note: You must enclose multiple search patterns in braces, {}, or quotes, "", to present the list as a single element.

Examples

The following example runs the report_drc command on the current design, returns the list of violations in the specified DRC report, and then returns any nets associated with the driverless net rule (NDRV):
report_drc -name drc_1  
get_drc_violations -name drc_1  
get_nets -of_objects [get_drc_violations -name drc_1 NDRV*]
The following example returns a list of nets that have been marked for debug with the connect_debug_port command:
get_nets -hier -filter {MARK_DEBUG==1}
This example returns the net attached to the specified hierarchical pin object, then returns the net segments attached to the pin object, then returns the top-level net segment attached to the pin object:
get_nets \  
   -of [get_pins cpuEngine/or1200_cpu/or1200_sprs/esr_reg[9]_i_3/I0]  
 
get_nets -segments \  
   -of [get_pins cpuEngine/or1200_cpu/or1200_sprs/esr_reg[9]_i_3/I0]  
 
get_nets -top -segments \  
   -of [get_pins cpuEngine/or1200_cpu/or1200_sprs/esr_reg[9]_i_3/I0] 
In the following example, the first command applies the -filter to find nets that have the IS_INTERNAL property, and then -segment is applied to return the segments of those nets. This command returns 0 net segments (and a warning). The second command, returns the segments of all nets, and filters the results to find the segments that have the IS_INTERNAL property, of which there are 448:
llength [get_nets -segments -filter {IS_INTERNAL}]  
WARNING: [Vivado 12-1023] No nets matched for command 'get_nets -segments   
-filter IS_INTERNAL'.  
0  
llength [filter [get_nets -segments] {IS_INTERNAL}]  
448