Get a list of cells in the current design
Syntax
get_cells [‑hsc <arg>] [‑hierarchical] [‑regexp] [‑nocase] [‑filter <arg>]
[‑of_objects <args>] [‑match_style <arg>] [‑include_replicated_objects]
[‑quiet] [‑verbose] [<patterns>]
Returns
list of cell 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 cells of these pins, timing paths, nets, bels, clock regions, sites, or drc violations |
[-match_style]
|
Style of pattern matching Default: sdc Values: ucf, sdc |
[-include_replicated_objects]
|
Include replicated objects when searching for patterns. This option is valid only when patterns is specified. |
[-quiet]
|
Ignore command errors |
[-verbose]
|
Suspend message limits during command execution |
[<patterns>]
|
Match cell names against patterns Default: * |
Description
Gets a list of cell objects in the current design that match a specified search pattern. The default command returns a list of all cells in the current_instance of the open design, as specified by the current_instance
command.
You can use the -hierarchical
option to extract cells from the hierarchy of the current design.
The get_cells
command also includes an option to get all replicated cells that are added to a design during physical optimization, or phys_opt_design
. The use of the -include_replicated_objects
option returns the replicated cells of an object when the original cell is returned. You can use this option to ensure that constraints or properties that are applied to a cell are also applied to its replicated cells.
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) Set the hierarchy separator. The default hierarchy separator is '/'.
-hierarchical
- (Optional) Get cells from all levels of the design hierarchy starting from the level of the current_instance, or from the top of the current design. Without this argument, the command will only get cells from the current_instance of the design hierarchy. 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 cell name. For instance, searching for U1/* searches each level of the hierarchy for instances with U1/ in the name. This may not return the intended results. This is illustrated in the examples below.
-regexp
, 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.
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_cells
based on property values on the cells. You can find the properties on an object with the report_property
or list_property
commands. In the case of the "cell" object, "IS_PARTITION", "IS_PRIMITIVE" and "IS_LOC_FIXED" are some of the properties that can be used to filter results.
get_pins * -filter {DIRECTION == IN && NAME !~ "*RESET*"}
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 the cells connected to the specified pins, timing paths, nets, bels, clock regions, sites or DRC violation objects.
-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
- (Optional) Indicates that the search pattern matches UCF constraints or SDC constraints. The default is SDC.
-include_replicated_objects
- (Optional) Include cells that have been added through replication during optimizations. This option is valid only when specified with <patterns>, and returns replicated cell instances that match the pattern. As a default, the get_cells
command does not return replicated cells.
-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.
-verbose
- (Optional) Temporarily override any message limits and return all messages from this command.
set_msg_config
command.Examples
get_cells -regexp -filter { REF_NAME =~ FD.* } .*validFor.*
get_cells -regexp -filter { NAME =~ .*validFor.* && REF_NAME =~ FD.* }
join [get_cells -hier {cpu* fft*}] \n
report_property [lindex [get_cells] 1]
foreach cell [lsort -unique [get_property LIB_CELL [get_cells -hier \
-filter {IS_PRIMITIVE==1}]]] {puts $cell}
-hierarchical
searches, without and with -regexp
:
get_cells -hierarchical *mmcm*
mmcm_replicator_inst_1
mmcm_replicator_inst_1/mmcm_stage[0].mmcm_channel[0].mmcm
get_cells -hierarchical -regexp .*mmcm.*
mmcm_replicator_inst_1
mmcm_replicator_inst_1/mmcm_stage[0].mmcm_channel[0].mmcm
mmcm_replicator_inst_1/mmcm_stage[0].mmcm_channel[0].mmcm/GND
mmcm_replicator_inst_1/mmcm_stage[0].mmcm_channel[0].mmcm/MMCM_Base
-regexp
) because the cell names do not match the search pattern, as it is applied to each level of the hierarchy.report_drc
command on the current design, and returns any cells associated with DRC violations:
report_drc -name drc_1
get_cells -of_objects [get_drc_violations]