Filter a list, resulting in new list
Syntax
filter [‑regexp] [‑nocase] [‑quiet] [‑verbose] [<objects>] [<filter>]
Returns
New list
Usage
Name | Description |
---|---|
[-regexp]
|
Operators =~ and !~ use regular expressions |
[-nocase]
|
Perform case-insensitive matching (valid only when -regexp specified) |
[-quiet]
|
Ignore command errors |
[-verbose]
|
Suspend message limits during command execution |
[<objects>]
|
List of objects to filter |
[<filter>]
|
Filter list with expression |
Categories
Description
Takes a list of objects, and returns a reduced list of objects that match the specified filter search pattern.
Arguments
-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.
-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.
<objects>
- (Optional) A list of objects that should be filtered to reduce the set to the desired results. The list of objects can be obtained by using one of the many get_*
commands such as get_parts
.
<filter> - (Optional) The expression to use for filtering. The specified pattern filters the list of objects returned based on property values on the objects. You can find out which properties are on an object with the report_property
or list_property
command. Any property/value pair can be used as a filter. For example, in the case of the "part" object, "DEVICE", "FAMILY" and "SPEED" 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}
Examples
The following example returns a list of parts filtered for the specified speed grade:
filter [get_parts] {speed == -3}
The following example filters parts based according to speed grade -3 OR speed grade -2. All parts matching either speed grade will be returned.
filter [get_parts] {speed == -3 || speed == -2}
The following example uses regular expression and returns a list of VStatus ports in the design, with zero or more wildcards, and the numbers 0 to 9 appearing one or more times within square brackets:
filter -regexp [get_ports] {NAME =~ VStatus.*\[[0-9]+\]}