From ee14c3eb23a904b9e77a268a1801ac0fcd629c24 Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Tue, 23 May 2023 16:19:10 +0300 Subject: [PATCH] Add `RSZ_DONT_TOUCH` list (#1798) --- configuration/general.tcl | 1 + docs/source/reference/configuration.md | 3 +- scripts/openroad/common/resizer.tcl | 79 +++++++++++++-------- scripts/openroad/resizer.tcl | 4 +- scripts/openroad/resizer_routing_design.tcl | 4 +- scripts/openroad/resizer_routing_timing.tcl | 4 +- scripts/openroad/resizer_timing.tcl | 4 +- 7 files changed, 60 insertions(+), 39 deletions(-) diff --git a/configuration/general.tcl b/configuration/general.tcl index 981e0e38..88525314 100755 --- a/configuration/general.tcl +++ b/configuration/general.tcl @@ -16,6 +16,7 @@ set ::env(CLOCK_PERIOD) "10.0" set ::env(USE_GPIO_PADS) 0 set ::env(RSZ_DONT_TOUCH_RX) "$^" +set ::env(RSZ_DONT_TOUCH) "" # Flow Controls set ::env(LEC_ENABLE) 0 diff --git a/docs/source/reference/configuration.md b/docs/source/reference/configuration.md index 2a197fd2..8ad4f3af 100644 --- a/docs/source/reference/configuration.md +++ b/docs/source/reference/configuration.md @@ -140,7 +140,8 @@ These variables worked initially, but they were too sky130 specific and will be |Variable|Description| |-|-| | `RSZ_LIB` | Points to the lib file, corresponding to the typical corner, that is used during resizer optimizations. This is copy of `LIB_SYNTH_COMPLETE`.
Default: automatically generated in `$::env(synthesis_tmpfiles)/resizer_.lib` | -| `RSZ_DONT_TOUCH_RX` | A single regular expression designating nets as "don't touch" by resizer optimizations.
Default: `$^` (matches nothing.) | +| `RSZ_DONT_TOUCH_RX` | A single regular expression designating nets or instances as "don't touch" by resizer optimizations.
Default: `$^` (matches nothing.) | +| `RSZ_DONT_TOUCH` | A list of nets or instances to set as "don't touch".
Default: Empty. | | `LIB_RESIZER_OPT` | **Deprecated: use `RSZ_LIB`**: Points to the lib file, corresponding to the typical corner, that is used during resizer optimizations. This is copy of `LIB_SYNTH_COMPLETE`.
Default: automatically generated in `$::env(synthesis_tmpfiles)/resizer_.lib` | ### Placement diff --git a/scripts/openroad/common/resizer.tcl b/scripts/openroad/common/resizer.tcl index b04c7123..2157effa 100644 --- a/scripts/openroad/common/resizer.tcl +++ b/scripts/openroad/common/resizer.tcl @@ -11,39 +11,58 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -proc set_dont_touch_rx {net_pattern} { - if { $::env(RSZ_USE_OLD_REMOVER) == 1} { - return - } - if { $net_pattern == {^$} } { - # Save some compute - return - } - variable odb_block [[[::ord::get_db] getChip] getBlock] - set odb_nets [odb::dbBlock_getNets $::odb_block] - foreach net $odb_nets { - set net_name [odb::dbNet_getName $net] - if { [regexp "$net_pattern" $net_name full] } { - puts "\[INFO\] Net '$net_name' matched don't touch regular expression, setting as don't touch..." - set_dont_touch "$net_name" +proc set_dont_touch_wrapper {} { + if { [info exists ::env(RSZ_DONT_TOUCH_RX)] && \ + ($::env(RSZ_USE_OLD_REMOVER) != 1 || $net_pattern != {^$}) } { + + set pattern $::env(RSZ_DONT_TOUCH_RX) + variable odb_block [[[::ord::get_db] getChip] getBlock] + set odb_nets [odb::dbBlock_getNets $::odb_block] + set odb_instances [odb::dbBlock_getInsts $odb_block] + foreach net $odb_nets { + set net_name [odb::dbNet_getName $net] + if { [regexp "$pattern" $net_name full] } { + puts "\[INFO\] Net '$net_name' matched don't touch regular expression, setting as don't touch..." + set_dont_touch "$net_name" + } } + foreach instance $odb_instances { + set instance_name [odb::dbInst_getName $instance] + if { [regexp "$pattern" $instance_name full] } { + puts "\[INFO\] Instance '$instance_name' matched don't touch regular expression, setting as don't touch..." + set_dont_touch "$instance_name" + } + } + } + + if { [info exists ::env(RSZ_DONT_TOUCH_LIST)] } { + set_dont_touch $::env(RSZ_DONT_TOUCH_LIST) } } -proc unset_dont_touch_rx {net_pattern} { - if { $::env(RSZ_USE_OLD_REMOVER) == 1} { - return - } - if { $net_pattern == {^$} } { - # Save some compute - return - } - variable odb_block [[[::ord::get_db] getChip] getBlock] - set odb_nets [odb::dbBlock_getNets $::odb_block] - foreach net $odb_nets { - set net_name [odb::dbNet_getName $net] - if { [regexp "$net_pattern" $net_name full] } { - unset_dont_touch "$net_name" +proc unset_dont_touch_wrapper {} { + if { [info exists ::env(RSZ_DONT_TOUCH_RX)] && \ + ($::env(RSZ_USE_OLD_REMOVER) != 1 || $net_pattern != {^$}) } { + + set pattern $::env(RSZ_DONT_TOUCH_RX) + variable odb_block [[[::ord::get_db] getChip] getBlock] + set odb_nets [odb::dbBlock_getNets $::odb_block] + set odb_instances [odb::dbBlock_getInsts $odb_block] + foreach net $odb_nets { + set net_name [odb::dbNet_getName $net] + if { [regexp "$pattern" $net_name full] } { + unset_dont_touch "$net_name" + } + } + foreach instance $odb_instances { + set instance_name [odb::dbInst_getName $instance] + if { [regexp "$pattern" $instance_name full] } { + unset_dont_touch "$instance_name" + } } } -} \ No newline at end of file + + if { [info exists ::env(RSZ_DONT_TOUCH_LIST)] } { + uset_dont_touch $::env(RSZ_DONT_TOUCH_LIST) + } +} diff --git a/scripts/openroad/resizer.tcl b/scripts/openroad/resizer.tcl index f3bb4bba..83f0d2be 100644 --- a/scripts/openroad/resizer.tcl +++ b/scripts/openroad/resizer.tcl @@ -24,7 +24,7 @@ estimate_parasitics -placement # set don't touch nets source $::env(SCRIPTS_DIR)/openroad/common/resizer.tcl -set_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +set_dont_touch_wrapper # set don't use cells if { [info exists ::env(DONT_USE_CELLS)] } { @@ -70,7 +70,7 @@ if { [catch {check_placement -verbose} errmsg] } { exit 1 } -unset_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +unset_dont_touch_wrapper write diff --git a/scripts/openroad/resizer_routing_design.tcl b/scripts/openroad/resizer_routing_design.tcl index c44a074a..6a20333a 100644 --- a/scripts/openroad/resizer_routing_design.tcl +++ b/scripts/openroad/resizer_routing_design.tcl @@ -18,7 +18,7 @@ set_propagated_clock [all_clocks] # set don't touch nets source $::env(SCRIPTS_DIR)/openroad/common/resizer.tcl -set_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +set_dont_touch_wrapper # set don't use cells if { [info exists ::env(DONT_USE_CELLS)] } { @@ -68,7 +68,7 @@ if { [catch {check_placement -verbose} errmsg] } { exit 1 } -unset_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +unset_dont_touch_wrapper write diff --git a/scripts/openroad/resizer_routing_timing.tcl b/scripts/openroad/resizer_routing_timing.tcl index 294c0194..5253a7c0 100644 --- a/scripts/openroad/resizer_routing_timing.tcl +++ b/scripts/openroad/resizer_routing_timing.tcl @@ -18,7 +18,7 @@ set_propagated_clock [all_clocks] # set don't touch nets source $::env(SCRIPTS_DIR)/openroad/common/resizer.tcl -set_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +set_dont_touch_wrapper # set don't use cells if { [info exists ::env(DONT_USE_CELLS)] } { @@ -72,7 +72,7 @@ if { [catch {check_placement -verbose} errmsg] } { exit 1 } -unset_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +unset_dont_touch_wrapper write diff --git a/scripts/openroad/resizer_timing.tcl b/scripts/openroad/resizer_timing.tcl index 2952359d..ea34d172 100644 --- a/scripts/openroad/resizer_timing.tcl +++ b/scripts/openroad/resizer_timing.tcl @@ -18,7 +18,7 @@ set_propagated_clock [all_clocks] # set don't touch nets source $::env(SCRIPTS_DIR)/openroad/common/resizer.tcl -set_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +set_dont_touch_wrapper # set don't use cells if { [info exists ::env(DONT_USE_CELLS)] } { @@ -59,7 +59,7 @@ if { [catch {check_placement -verbose} errmsg] } { exit 1 } -unset_dont_touch_rx "$::env(RSZ_DONT_TOUCH_RX)" +unset_dont_touch_wrapper write