caravel/openlane/mgmt_protect/resizer.patch

100 lines
3.4 KiB
Diff
Raw Normal View History

diff --git a/scripts/openroad/resizer.tcl b/scripts/openroad/resizer.tcl
index ea74dde..843e195 100644
--- a/scripts/openroad/resizer.tcl
+++ b/scripts/openroad/resizer.tcl
@@ -11,6 +11,62 @@
# 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.
+set ::env(OPENLANE_LOG_DEBUG) 1
+proc puts_debug {debug_message} {
+ if { $::env(OPENLANE_LOG_DEBUG) } {
+ puts "\[DEBUG\] $debug_message"
+ }
+}
+
+
+proc set_special {net_name} {
+ puts_debug "1"
+ set odb_net [odb::dbBlock_findNet $::odb_block $net_name]
+ puts_debug "2"
+ odb::dbNet_setSpecial $odb_net
+ puts "\[INFO\] special set on $net_name $odb_net"
+}
+
+proc set_special_multi {net_pattern} {
+ set odb_nets [odb::dbBlock_getNets $::odb_block]
+ set net_pattern_escaped [string map {"\[" "\\\["} $net_pattern]
+ set net_pattern_escaped [string map {"\]" "\\\]"} $net_pattern_escaped]
+ set net_matches {}
+ foreach net $odb_nets {
+ set net_name [odb::dbNet_getName $net]
+ if { [string match $net_pattern_escaped $net_name] } {
+ puts "\[INFO\] $net_name matches $net_pattern"
+ lappend net_matches $net_name
+ }
+ }
+ foreach net $net_matches {
+ puts_debug "setting special multi on $net"
+ set_special "$net"
+ }
+}
+
+proc clear_special_multi {net_pattern} {
+ set odb_nets [odb::dbBlock_getNets $::odb_block]
+ set net_pattern_escaped [string map {"\[" "\\\["} $net_pattern]
+ set net_pattern_escaped [string map {"\]" "\\\]"} $net_pattern_escaped]
+ set net_matches {}
+ foreach net $odb_nets {
+ set net_name [odb::dbNet_getName $net]
+ if { [string match $net_pattern_escaped $net_name] } {
+ lappend net_matches $net_name
+ }
+ }
+ foreach net $net_matches {
+ clear_special $net
+ }
+}
+
+proc clear_special {net_name} {
+ set block [[[::ord::get_db] getChip] getBlock]
+ set odb_net [odb::dbBlock_findNet $block $net_name]
+ odb::dbNet_clearSpecial $odb_net
+ puts "\[INFO\] clear special on $net_name"
+}
foreach lib $::env(LIB_RESIZER_OPT) {
read_liberty $lib
@@ -44,6 +100,12 @@ if { [info exists ::env(DONT_USE_CELLS)] } {
set_dont_use $::env(DONT_USE_CELLS)
}
+variable odb_block [[[::ord::get_db] getChip] getBlock]
+#set_special la_data_out_core\[0\]
+foreach net_pattern $::env(DONT_TOUCH_PORTS) {
+ set_special_multi $net_pattern
+}
+
if { [info exists ::env(PL_RESIZER_BUFFER_INPUT_PORTS)] && $::env(PL_RESIZER_BUFFER_INPUT_PORTS) } {
buffer_ports -inputs
}
@@ -51,6 +113,11 @@ if { [info exists ::env(PL_RESIZER_BUFFER_INPUT_PORTS)] && $::env(PL_RESIZER_BUF
if { [info exists ::env(PL_RESIZER_BUFFER_OUTPUT_PORTS)] && $::env(PL_RESIZER_BUFFER_OUTPUT_PORTS) } {
buffer_ports -outputs
}
+
+foreach net_pattern $::env(DONT_TOUCH_PORTS) {
+ clear_special_multi $net_pattern
+}
+
# Resize
if { [info exists ::env(PL_RESIZER_MAX_WIRE_LENGTH)] && $::env(PL_RESIZER_MAX_WIRE_LENGTH) } {
repair_design -max_wire_length $::env(PL_RESIZER_MAX_WIRE_LENGTH) \
@@ -85,4 +152,4 @@ write_sdc $::env(SAVE_SDC)
# Run post design optimizations STA
estimate_parasitics -placement
set ::env(RUN_STANDALONE) 0
-source $::env(SCRIPTS_DIR)/openroad/sta.tcl
\ No newline at end of file
+source $::env(SCRIPTS_DIR)/openroad/sta.tcl