get_objects - 2022.1 English

Vivado Design Suite Tcl Command Reference Guide (UG835)

Document ID
UG835
Release Date
2022-05-05
Version
2022.1 English

Get a list of HDL objects in one or more HDL scopes as per the specified pattern

Syntax

get_objects [‑filter <arg>] [‑r] [‑local] [‑regexp] [‑nocase] [‑quiet]
    [‑verbose] [<patterns>...]

Returns

Returns all the objects found given the specified pattern.

Usage

Name Description
[-filter] filters <patterns> according to the specified property-matching expressions
[-r] Searches recursively for objects
[-local] Searches objects in the subprogram frame selected for the current scope
[-regexp] Search using regular expressions, search design objects from which to create wave objects by design object name. The application supplying the design objects determines how the match is to be performed. Items must be strings.
[-nocase] Perform a case insensitive match (only used with regexp)
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution
[<patterns>] Patterns to search for. Default is * where all HDL objects are returned

Categories

Description

Returns a list of HDL objects matching the specified search pattern in one or more HDL scopes.

HDL objects include HDL signals, variables, or constants as defined in the Verilog or VHDL test bench and source files. An HDL signal includes Verilog wire or reg entities, and VHDL signals. Examples of HDL variables include Verilog real, realtime, time, and event. HDL constants include Verilog parameters and localparams, and VHDL generic and constants.

The HDL scope, or scope, is defined by a declarative region in the HDL code such as a module, function, task, process, or begin-end blocks in Verilog. VHDL scopes include entity/architecture definitions, block, function, procedure, and process blocks.

Arguments

-r - (Optional) Apply the command to the current scope, and all sub-scopes of the current scope.

-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_objects based on property values on the objects. You can find the properties on an object with the report_property or list_property commands. In the case of the HDL object, "NAME", "SCOPE" and "TYPE" 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. 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}
-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 HDL objects against the specified patterns. The default pattern is the wildcard '*' which returns all the children in the current scope. The search pattern can be defined in two ways:
  • <patterns> - Specifies only the search pattern for the objects to get. This method returns all objects in the current scope (and any sub-scopes when -recursive is used).
  • <scope>/<pattern> - Specifies the scope of interest, relative to the current scope, and the pattern for objects to locate. In this case, the specified <scope>, and any sub-scopes of it if -recursive is used, are identified starting from the current scope. Then all objects matching the search <pattern> are identified and returned.

Examples

The following example specifies the current_scope, then gets all HDL objects in that scope:
current_scope ./cpuEngine
get_objects
The following example returns the count of all objects in the current scope, and then returns the count of all objects in the current scope, and all sub-scopes of it:
llength [get_objects]
   182
llength [get_objects -recursive ]
   2182
The following example specifies the <scope>/<pattern> search pattern as discussed above. Notice that the cpuEngine scope and various sub-scopes of it are identified, then objects matching the cl* pattern in those scopes are returned:
get_objects -recursive -filter {type == internal_signal} cpuEngine/cl*
   /top/cpuEngine/clk_i
   /top/cpuEngine/iwb_biu/clk
   /top/cpuEngine/iwb_biu/clmode
   /top/cpuEngine/or1200_cpu/clk
   ...
   /top/cpuEngine/or1200_immu_top/or1200_immu_tlb/itlb_mr_ram/clk
Search the current scope, and all sub-scopes, for any internal signals whose names start with cl or ma:
get_objects -recursive -filter {type == internal_signal} ma* cl*