From 175f68584faa384af0c87d21cc9a82de8eb39e58 Mon Sep 17 00:00:00 2001 From: Akash Levy Date: Mon, 12 Aug 2024 19:40:49 -0700 Subject: [PATCH] Revisions based on feedback --- doc/messages.txt | 5 ++ sdc/Sdc.i | 6 +-- sdc/Sdc.tcl | 8 +-- tcl/Sta.tcl | 30 +---------- test/get_filter.ok | 104 +++++++++++++++++++++++++++++++++++++++ test/get_filter.tcl | 31 ++++++++++++ test/regression_vars.tcl | 2 +- test/sdc_filter.ok | 39 --------------- test/sdc_filter.tcl | 40 --------------- 9 files changed, 149 insertions(+), 116 deletions(-) create mode 100644 test/get_filter.ok create mode 100644 test/get_filter.tcl delete mode 100644 test/sdc_filter.ok delete mode 100644 test/sdc_filter.tcl diff --git a/doc/messages.txt b/doc/messages.txt index 76d0a8be..60e088cc 100644 --- a/doc/messages.txt +++ b/doc/messages.txt @@ -529,3 +529,8 @@ 1655 SpefReader.cc:513 %s not connected to net %s. 1656 SpefReader.cc:517 pin %s not found. 1657 SpefReader.cc:634 %s. +2351 Sdc.tcl:538 unsupported clock -filter expression. +2354 Sdc.tcl:608 unsupported liberty cell -filter expression. +2357 Sdc.tcl:681 unsupported liberty port -filter expression. +2351 Sdc.tcl:720 unsupported liberty library -filter expression. +2361 Sdc.tcl:810 unsupported net -filter expression. diff --git a/sdc/Sdc.i b/sdc/Sdc.i index f0ab443e..00a85189 100644 --- a/sdc/Sdc.i +++ b/sdc/Sdc.i @@ -1354,9 +1354,9 @@ filter_lib_pins(const char *property, LibertyLibrarySeq filter_liberty_libraries(const char *property, - const char *op, - const char *pattern, - LibertyLibrarySeq *libs) + const char *op, + const char *pattern, + LibertyLibrarySeq *libs) { return filter_objects(property, op, pattern, libs); } diff --git a/sdc/Sdc.tcl b/sdc/Sdc.tcl index c61aff3b..3b4cafaf 100644 --- a/sdc/Sdc.tcl +++ b/sdc/Sdc.tcl @@ -406,7 +406,7 @@ proc current_design { {design ""} } { ################################################################ -# Generic filter_objs command. +# Generic get_* filter. proc filter_objs { filter objects filter_function filter_type error_code } { set filter_regexp1 {@?([a-zA-Z_]+) *(==|!=|=~|!~) *([0-9a-zA-Z_\*]+)} set filter_or_regexp "($filter_regexp1) *\\|\\| *($filter_regexp1)" @@ -605,7 +605,7 @@ proc get_lib_cells { args } { } } if [info exists keys(-filter)] { - set cells [filter_objs $keys(-filter) $cells filter_lib_cells "liberty cells" 2354] + set cells [filter_objs $keys(-filter) $cells filter_lib_cells "liberty cell" 2354] } return $cells } @@ -876,7 +876,7 @@ proc get_pins { args } { } } if [info exists keys(-filter)] { - set pins [filter_objs $keys(-filter) $pins filter_pins "pin" 2363] + set pins [filter_objs $keys(-filter) $pins filter_pins "pin" 364] } return $pins } @@ -921,7 +921,7 @@ proc get_ports { args } { } } if [info exists keys(-filter)] { - set ports [filter_objs $keys(-filter) $ports filter_ports "port" 2366] + set ports [filter_objs $keys(-filter) $ports filter_ports "port" 367] } return $ports } diff --git a/tcl/Sta.tcl b/tcl/Sta.tcl index e377c259..5bc0a661 100644 --- a/tcl/Sta.tcl +++ b/tcl/Sta.tcl @@ -171,7 +171,7 @@ proc get_timing_edges_cmd { cmd cmd_args } { cmd_usage_error $cmd } if [info exists keys(-filter)] { - set arcs [filter_timing_arcs1 $keys(-filter) $arcs] + set arcs [filter_objs $keys(-filter) $arcs "timing arc" 541] } return $arcs } @@ -260,34 +260,6 @@ proc get_timing_arcs_to { to_pin_arg } { return $edges } -proc filter_timing_arcs1 { filter objects } { - variable filter_regexp1 - variable filter_or_regexp - variable filter_and_regexp - 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_timing_arcs $attr_name $op $arg $objects] - regexp $filter_regexp1 $expr2 ignore attr_name op arg - set filtered_objects2 [filter_timing_arcs $attr_name $op $arg $objects] - 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_timing_arcs $attr_name $op $arg $objects] - regexp $filter_regexp1 $expr2 ignore attr_name op arg - set filtered_objects [filter_timing_arcs $attr_name $op \ - $arg $filtered_objects] - } elseif { [regexp $filter_regexp1 $filter ignore attr_name op arg] } { - set filtered_objects [filter_timing_arcs $attr_name $op $arg $objects] - } else { - sta_error 541 "unsupported -filter expression." - } - return $filtered_objects -} - ################################################################ define_cmd_args "report_clock_properties" {[clocks]} diff --git a/test/get_filter.ok b/test/get_filter.ok new file mode 100644 index 00000000..5ee30826 --- /dev/null +++ b/test/get_filter.ok @@ -0,0 +1,104 @@ +Warning: asap7_simple.lib.gz line 71510, when attribute inside table model. +Warning: asap7_simple.lib.gz line 71986, when attribute inside table model. +Warning: asap7_simple.lib.gz line 72462, when attribute inside table model. +Warning: asap7_simple.lib.gz line 72938, when attribute inside table model. +Warning: asap7_simple.lib.gz line 73414, when attribute inside table model. +Warning: asap7_simple.lib.gz line 74830, when attribute inside table model. +Warning: asap7_simple.lib.gz line 71029, timing group from output port. +Warning: asap7_simple.lib.gz line 71505, timing group from output port. +Warning: asap7_simple.lib.gz line 71981, timing group from output port. +Warning: asap7_simple.lib.gz line 72457, timing group from output port. +Warning: asap7_simple.lib.gz line 72933, timing group from output port. +Warning: asap7_simple.lib.gz line 73409, timing group from output port. +Warning: asap7_simple.lib.gz line 73885, timing group from output port. +Warning: asap7_simple.lib.gz line 82276, when attribute inside table model. +Warning: asap7_simple.lib.gz line 83692, when attribute inside table model. +Warning: asap7_simple.lib.gz line 81795, timing group from output port. +Warning: asap7_simple.lib.gz line 82271, timing group from output port. +Warning: asap7_simple.lib.gz line 82747, timing group from output port. +get_cells +u1 + +get_clocks +clk + +vclk + +get_lib_cells +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx10_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx12_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx12f_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx16f_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx24_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx2_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx3_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx4_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx4f_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx5_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx6f_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx8_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB1xp67_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB2xp67_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB3xp67_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB4xp67_ASAP7_75t_R + +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx10_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx11_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx12_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx14_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx16_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx20_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx5p33_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx6p67_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx8_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx9p33_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx11_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx13_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx1_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx2_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx3_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx4_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx5_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx6_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx8_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVxp33_ASAP7_75t_R +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVxp67_ASAP7_75t_R + +get_lib_pins +A + +Y + +get_libs +asap7sc7p5t_INVBUF_RVT_TT_ccs_211120 + +get_nets +r1q +r2q + +get_pins +r1/CLK +r1/D +r2/CLK +r2/D +r3/CLK +r3/D +u1/A +u2/A +u2/B + +r1/Q +r2/Q +r3/Q +u1/Y +u2/Y + +get_ports +clk1 +clk2 +clk3 +in1 +in2 + +out + diff --git a/test/get_filter.tcl b/test/get_filter.tcl new file mode 100644 index 00000000..6ff36917 --- /dev/null +++ b/test/get_filter.tcl @@ -0,0 +1,31 @@ +# Read in design and libraries +read_liberty asap7_invbuf.lib.gz +read_liberty asap7_seq.lib.gz +read_liberty asap7_simple.lib.gz +read_verilog reg1_asap7.v +link_design top +create_clock -name clk -period 500 {clk1 clk2 clk3} +create_clock -name vclk -period 1000 + +# Test filters for each SDC command +puts "get_cells" +puts [report_object_full_names [get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *]] +puts "get_clocks" +puts [report_object_full_names [get_clocks -filter is_virtual==0 *]] +puts [report_object_full_names [get_clocks -filter is_virtual==1 *]] +puts "get_lib_cells" +puts [report_object_full_names [get_lib_cells -filter is_buffer==1 *]] +puts [report_object_full_names [get_lib_cells -filter is_inverter==1 *]] +puts "get_lib_pins" +puts [report_object_full_names [get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*]] +puts [report_object_full_names [get_lib_pins -filter direction==output BUFx2_ASAP7_75t_R/*]] +puts "get_libs" +puts [report_object_full_names [get_libs -filter name==asap7sc7p5t_INVBUF_RVT_TT_ccs_211120 *]] +puts "get_nets" +puts [report_object_full_names [get_nets -filter name=~*q *]] +puts "get_pins" +puts [report_object_full_names [get_pins -filter direction==input *]] +puts [report_object_full_names [get_pins -filter direction==output *]] +puts "get_ports" +puts [report_object_full_names [get_ports -filter direction==input *]] +puts [report_object_full_names [get_ports -filter direction==output *]] diff --git a/test/regression_vars.tcl b/test/regression_vars.tcl index a31563b1..97e197ba 100644 --- a/test/regression_vars.tcl +++ b/test/regression_vars.tcl @@ -125,7 +125,7 @@ record_sta_tests { prima3 verilog_attribute liberty_arcs_one2one - sdc_filter + get_filter } define_test_group fast [group_tests all] diff --git a/test/sdc_filter.ok b/test/sdc_filter.ok deleted file mode 100644 index f5d4d834..00000000 --- a/test/sdc_filter.ok +++ /dev/null @@ -1,39 +0,0 @@ -Warning: asap7_simple.lib.gz line 71510, when attribute inside table model. -Warning: asap7_simple.lib.gz line 71986, when attribute inside table model. -Warning: asap7_simple.lib.gz line 72462, when attribute inside table model. -Warning: asap7_simple.lib.gz line 72938, when attribute inside table model. -Warning: asap7_simple.lib.gz line 73414, when attribute inside table model. -Warning: asap7_simple.lib.gz line 74830, when attribute inside table model. -Warning: asap7_simple.lib.gz line 71029, timing group from output port. -Warning: asap7_simple.lib.gz line 71505, timing group from output port. -Warning: asap7_simple.lib.gz line 71981, timing group from output port. -Warning: asap7_simple.lib.gz line 72457, timing group from output port. -Warning: asap7_simple.lib.gz line 72933, timing group from output port. -Warning: asap7_simple.lib.gz line 73409, timing group from output port. -Warning: asap7_simple.lib.gz line 73885, timing group from output port. -Warning: asap7_simple.lib.gz line 82276, when attribute inside table model. -Warning: asap7_simple.lib.gz line 83692, when attribute inside table model. -Warning: asap7_simple.lib.gz line 81795, timing group from output port. -Warning: asap7_simple.lib.gz line 82271, timing group from output port. -Warning: asap7_simple.lib.gz line 82747, timing group from output port. -get_cells -u1 -get_clocks -clk -vclk -get_lib_cells -asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx10_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx12_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx12f_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx16f_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx24_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx2_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx3_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx4_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx4f_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx5_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx6f_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/BUFx8_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB1xp67_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB2xp67_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB3xp67_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/HB4xp67_ASAP7_75t_R -asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx10_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx11_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx12_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx14_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx16_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx20_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx5p33_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx6p67_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx8_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/CKINVDCx9p33_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx11_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx13_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx1_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx2_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx3_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx4_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx5_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx6_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVx8_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVxp33_ASAP7_75t_R asap7sc7p5t_INVBUF_RVT_TT_ccs_211120/INVxp67_ASAP7_75t_R -get_lib_pins -A -Y -get_libs -asap7sc7p5t_INVBUF_RVT_TT_ccs_211120 -get_nets -r1q r2q -get_pins -r1/CLK r1/D r2/CLK r2/D r3/CLK r3/D u1/A u2/A u2/B -r1/Q r2/Q r3/Q u1/Y u2/Y -get_ports -in1 in2 clk1 clk2 clk3 -out diff --git a/test/sdc_filter.tcl b/test/sdc_filter.tcl deleted file mode 100644 index 7dc4c1a3..00000000 --- a/test/sdc_filter.tcl +++ /dev/null @@ -1,40 +0,0 @@ -# Helper functions -proc get_full_names { collection } { - set full_names {} - foreach name $collection { - lappend full_names [get_full_name $name] - } - return $full_names -} - -# Read in design and libraries -read_liberty asap7_invbuf.lib.gz -read_liberty asap7_seq.lib.gz -read_liberty asap7_simple.lib.gz -read_verilog reg1_asap7.v -link_design top -create_clock -name clk -period 500 {clk1 clk2 clk3} -create_clock -name vclk -period 1000 - -# Test filters for each SDC command -puts "get_cells" -puts [get_full_names [get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *]] -puts "get_clocks" -puts [get_full_names [get_clocks -filter is_virtual==0 *]] -puts [get_full_names [get_clocks -filter is_virtual==1 *]] -puts "get_lib_cells" -puts [get_full_names [get_lib_cells -filter is_buffer==1 *]] -puts [get_full_names [get_lib_cells -filter is_inverter==1 *]] -puts "get_lib_pins" -puts [get_full_names [get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*]] -puts [get_full_names [get_lib_pins -filter direction==output BUFx2_ASAP7_75t_R/*]] -puts "get_libs" -puts [get_full_names [get_libs -filter name==asap7sc7p5t_INVBUF_RVT_TT_ccs_211120 *]] -puts "get_nets" -puts [get_full_names [get_nets -filter name=~*q *]] -puts "get_pins" -puts [get_full_names [get_pins -filter direction==input *]] -puts [get_full_names [get_pins -filter direction==output *]] -puts "get_ports" -puts [get_full_names [get_ports -filter direction==input *]] -puts [get_full_names [get_ports -filter direction==output *]]