Allow boolean attributes to be used in `get_* -filter` expressions without comparison
This commit is contained in:
parent
f54ab5b170
commit
5120bb98e1
24
sdc/Sdc.tcl
24
sdc/Sdc.tcl
|
|
@ -408,25 +408,21 @@ proc current_design { {design ""} } {
|
|||
|
||||
# Generic get_* filter.
|
||||
proc filter_objs { filter objects filter_function object_type } {
|
||||
set filter_regexp1 {@?([a-zA-Z_]+) *(==|!=|=~|!~) *([0-9a-zA-Z_\*]+)}
|
||||
set filter_regexp1 {@?([a-zA-Z_]+) *((==|!=|=~|!~) *([0-9a-zA-Z_\*]+))?}
|
||||
set filter_or_regexp "($filter_regexp1) *\\|\\| *($filter_regexp1)"
|
||||
set filter_and_regexp "($filter_regexp1) *&& *($filter_regexp1)"
|
||||
set filtered_objects {}
|
||||
# Ignore sub-exprs in filter_regexp1 for expr2 match var.
|
||||
if { [regexp $filter_or_regexp $filter ignore expr1 \
|
||||
ignore ignore ignore expr2] } {
|
||||
regexp $filter_regexp1 $expr1 ignore attr_name op arg
|
||||
set filtered_objects1 [$filter_function $attr_name $op $arg $objects]
|
||||
regexp $filter_regexp1 $expr2 ignore attr_name op arg
|
||||
set filtered_objects2 [$filter_function $attr_name $op $arg $objects]
|
||||
if { [regexp $filter_or_regexp $filter ignore expr1 ignore ignore ignore ignore expr2] } {
|
||||
set filtered_objects1 [filter_objs $expr1 $objects $filter_function $object_type]
|
||||
set filtered_objects2 [filter_objs $expr2 $objects $filter_function $object_type]
|
||||
set filtered_objects [concat $filtered_objects1 $filtered_objects2]
|
||||
} elseif { [regexp $filter_and_regexp $filter ignore expr1 \
|
||||
ignore ignore ignore expr2] } {
|
||||
regexp $filter_regexp1 $expr1 ignore attr_name op arg
|
||||
set filtered_objects [$filter_function $attr_name $op $arg $objects]
|
||||
regexp $filter_regexp1 $expr2 ignore attr_name op arg
|
||||
set filtered_objects [$filter_function $attr_name $op $arg $filtered_objects]
|
||||
} elseif { [regexp $filter_regexp1 $filter ignore attr_name op arg] } {
|
||||
} elseif { [regexp $filter_and_regexp $filter ignore expr1 ignore ignore ignore ignore expr2] } {
|
||||
set filtered_objects [filter_objs $expr1 $objects $filter_function $object_type]
|
||||
set filtered_objects [filter_objs $expr2 $filtered_objects $filter_function $object_type]
|
||||
} elseif { [regexp $filter_regexp1 $filter ignore attr_name ignore op arg] } {
|
||||
set op [expr {($op == "") ? "==" : $op}]
|
||||
set arg [expr {($arg == "") ? "1" : $arg}]
|
||||
set filtered_objects [$filter_function $attr_name $op $arg $objects]
|
||||
} else {
|
||||
sta_error 350 "unsupported $object_type -filter expression."
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@ get_clocks
|
|||
clk
|
||||
get_clocks 2
|
||||
vclk
|
||||
get_clocks 3
|
||||
vclk
|
||||
get_clocks 4
|
||||
get_clocks 5
|
||||
vclk
|
||||
get_clocks 6
|
||||
vclk
|
||||
get_clocks 7
|
||||
clk
|
||||
get_lib_cells
|
||||
asap7_small/BUFx2_ASAP7_75t_R
|
||||
get_lib_cells 2
|
||||
|
|
|
|||
|
|
@ -12,6 +12,16 @@ puts "get_clocks"
|
|||
report_object_full_names [get_clocks -filter is_virtual==0 *]
|
||||
puts "get_clocks 2"
|
||||
report_object_full_names [get_clocks -filter is_virtual==1 *]
|
||||
puts "get_clocks 3"
|
||||
report_object_full_names [get_clocks -filter is_virtual *]
|
||||
puts "get_clocks 4"
|
||||
report_object_full_names [get_clocks -filter is_virtual&&is_generated *]
|
||||
puts "get_clocks 5"
|
||||
report_object_full_names [get_clocks -filter is_virtual&&is_generated==0 *]
|
||||
puts "get_clocks 6"
|
||||
report_object_full_names [get_clocks -filter is_virtual||is_generated *]
|
||||
puts "get_clocks 7"
|
||||
report_object_full_names [get_clocks -filter is_virtual==0||is_generated *]
|
||||
puts "get_lib_cells"
|
||||
report_object_full_names [get_lib_cells -filter is_buffer==1 *]
|
||||
puts "get_lib_cells 2"
|
||||
|
|
|
|||
Loading…
Reference in New Issue