From bac7e386c01b819c7ef2365a1377a7f8ccd8ca40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sat, 25 Jul 2026 07:17:43 +0200 Subject: [PATCH] rsz: preserve buffers on hierarchical module boundaries in canRemoveBuffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When global placement performs timing-driven buffer removal (Resizer::removeBuffers), canRemoveBuffer checks whether a candidate buffer can be removed. If the buffer is situated on a hierarchical module boundary where its input pin and output pin belong to different dbModNets, removing the buffer flattens the net without updating hierarchical module port/net bindings, disconnecting downstream module inputs. Check whether input_modnet != output_modnet in canRemoveBuffer and return false to preserve hierarchical boundary buffers. Also ensure removeBuffer only merges distinct dbModNets (survivor_modnet != removed_modnet). Signed-off-by: Øyvind Harboe --- src/rsz/src/Resizer.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rsz/src/Resizer.cc b/src/rsz/src/Resizer.cc index 9914f332f11..3932f3e52a4 100644 --- a/src/rsz/src/Resizer.cc +++ b/src/rsz/src/Resizer.cc @@ -2782,6 +2782,11 @@ bool Resizer::canRemoveBuffer(sta::Instance* buffer, sta::Pin* output_pin = db_network_->findPin(buffer, output_port); sta::Net* input_net = db_network_->net(input_pin); sta::Net* output_net = db_network_->net(output_pin); + odb::dbModNet* input_modnet = db_network_->hierNet(input_pin); + odb::dbModNet* output_modnet = db_network_->hierNet(output_pin); + if (input_modnet != output_modnet) { + return false; + } odb::dbNet* input_db_net = db_network_->findFlatDbNet(input_net); odb::dbNet* output_db_net = db_network_->findFlatDbNet(output_net); if ((input_db_net != nullptr && input_db_net->isDoNotTouch()) @@ -2902,7 +2907,8 @@ bool Resizer::removeBuffer(sta::Instance* buffer) sta_->disconnectPin(input_pin); sta_->disconnectPin(output_pin); - if (survivor_modnet != nullptr && removed_modnet != nullptr) { + if (survivor_modnet != nullptr && removed_modnet != nullptr + && survivor_modnet != removed_modnet) { survivor_modnet->mergeModNet(removed_modnet); } else if (survivor_modnet != nullptr) { survivor_modnet->connectTermsOf(db_removed);