Skip to content

Commit 6078623

Browse files
committed
cts: Deleted dangling dbModNet for top-level clock port.
- Fixes #8166 Signed-off-by: Jaehyun Kim <[email protected]>
1 parent a85402c commit 6078623

File tree

8 files changed

+52
-7
lines changed

8 files changed

+52
-7
lines changed

src/cts/include/cts/TritonCTS.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Unit;
3434
class LibertyCell;
3535
class Vertex;
3636
class Graph;
37+
class Pin;
3738
} // namespace sta
3839

3940
namespace stt {
@@ -114,6 +115,7 @@ class TritonCTS
114115
// db functions
115116
bool masterExists(const std::string& master) const;
116117
void populateTritonCTS();
118+
void destroyClockModNet(sta::Pin* pin_driver);
117119
void writeClockNetsToDb(TreeBuilder* builder,
118120
std::set<odb::dbNet*>& clkLeafNets);
119121
void writeClockNDRsToDb(TreeBuilder* builder);

src/cts/src/TritonCTS.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,18 @@ void TritonCTS::computeITermPosition(odb::dbITerm* term, int& x, int& y) const
13931393
}
13941394
};
13951395

1396+
void TritonCTS::destroyClockModNet(sta::Pin* pin_driver)
1397+
{
1398+
if (pin_driver == nullptr || network_->hasHierarchy() == false) {
1399+
return;
1400+
}
1401+
1402+
odb::dbModNet* mod_net = network_->hierNet(pin_driver);
1403+
if (mod_net) {
1404+
odb::dbModNet::destroy(mod_net);
1405+
}
1406+
}
1407+
13961408
void TritonCTS::writeClockNetsToDb(TreeBuilder* builder,
13971409
std::set<odb::dbNet*>& clkLeafNets)
13981410
{
@@ -1406,6 +1418,12 @@ void TritonCTS::writeClockNetsToDb(TreeBuilder* builder,
14061418

14071419
disconnectAllSinksFromNet(topClockNet);
14081420

1421+
// If exists, remove the dangling dbModNet related to the topClockNet because
1422+
// topClockNet has no load pin now.
1423+
// After CTS, the driver pin will drive only a few of root clock buffers.
1424+
// So the hierarchical net (dbModNet) is not needed any more.
1425+
destroyClockModNet(pin_driver);
1426+
14091427
// re-connect top buffer that separates macros from registers
14101428
if (builder->getTreeType() == TreeType::RegisterTree) {
14111429
odb::dbInst* topRegBuffer

src/dbSta/src/dbNetwork.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,7 @@ void dbNetwork::disconnectPin(Pin* pin, Net* net)
25912591
iterm->disconnectDbNet();
25922592
}
25932593
if (mod_net) {
2594-
iterm->disconnectModNet();
2594+
iterm->disconnectDbModNet();
25952595
}
25962596
} else if (bterm) {
25972597
if (db_net) {

src/odb/include/odb/db.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3202,7 +3202,7 @@ class dbITerm : public dbObject
32023202
/// Disconnect just the mod net
32033203
///
32043204

3205-
void disconnectModNet();
3205+
void disconnectDbModNet();
32063206

32073207
///
32083208
/// Get the average of the centers for the iterm shapes
@@ -8284,6 +8284,7 @@ class dbModNet : public dbObject
82848284
unsigned connectionCount();
82858285
const char* getName() const;
82868286
void rename(const char* new_name);
8287+
void disconnectAllTerms();
82878288

82888289
static dbModNet* getModNet(dbBlock* block, uint id);
82898290
static dbModNet* create(dbModule* parentModule, const char* base_name);

src/odb/src/db/dbITerm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void dbITerm::connect(dbModNet* mod_net)
403403
// accidentally blow away prior flat net connections)
404404

405405
if (iterm->_mnet != 0) {
406-
disconnectModNet();
406+
disconnectDbModNet();
407407
}
408408

409409
iterm->_mnet = _mod_net->getId();
@@ -623,7 +623,7 @@ void dbITerm::disconnectDbNet()
623623
//
624624
// Disconnect the mod net and allow journaling
625625
//
626-
void dbITerm::disconnectModNet()
626+
void dbITerm::disconnectDbModNet()
627627
{
628628
_dbITerm* iterm = (_dbITerm*) this;
629629
_dbBlock* block = (_dbBlock*) iterm->getOwner();

src/odb/src/db/dbJournal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ void dbJournal::redo_disconnectObject()
782782
} else if (net_id != 0) {
783783
iterm->disconnectDbNet();
784784
} else if (mnet_id != 0) {
785-
iterm->disconnectModNet();
785+
iterm->disconnectDbModNet();
786786
}
787787
break;
788788
}
@@ -2080,7 +2080,7 @@ void dbJournal::undo_connectObject()
20802080
iterm->disconnectDbNet();
20812081
}
20822082
if (mnet_id != 0) {
2083-
iterm->disconnectModNet();
2083+
iterm->disconnectDbModNet();
20842084
}
20852085
break;
20862086
}

src/odb/src/db/dbModInst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ dbModInst* dbModInst::swapMaster(dbModule* new_module)
587587
// iterm may be connected to another hierarchical instance
588588
dbModNet* other_mod_net = old_iterm->getModNet();
589589
if (other_mod_net != old_mod_net) {
590-
old_iterm->disconnectModNet();
590+
old_iterm->disconnectDbModNet();
591591
old_iterm->connect(old_mod_net); // Reconnect old mod net for later use
592592
debugRDPrint1(" disconnected old iterm {} from other mod net {}",
593593
old_iterm->getName(),

src/odb/src/db/dbModNet.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,28 @@ void dbModNet::rename(const char* new_name)
178178
parent->_modnet_hash[new_name] = obj->getOID();
179179
}
180180

181+
void dbModNet::disconnectAllTerms()
182+
{
183+
// Disconnect all terminals.
184+
// - The loops are structured this way to handle the modification of the dbSet
185+
// during iteration.
186+
while (!getITerms().empty()) {
187+
getITerms().begin()->disconnectDbModNet();
188+
}
189+
190+
while (!getBTerms().empty()) {
191+
getBTerms().begin()->disconnectDbModNet();
192+
}
193+
194+
while (!getModITerms().empty()) {
195+
getModITerms().begin()->disconnect();
196+
}
197+
198+
while (!getModBTerms().empty()) {
199+
getModBTerms().begin()->disconnect();
200+
}
201+
}
202+
181203
dbModNet* dbModNet::getModNet(dbBlock* block, uint id)
182204
{
183205
_dbBlock* block_ = (_dbBlock*) block;
@@ -225,6 +247,8 @@ void dbModNet::destroy(dbModNet* mod_net)
225247
_dbBlock* block = (_dbBlock*) _modnet->getOwner();
226248
_dbModule* module = block->_module_tbl->getPtr(_modnet->_parent);
227249

250+
mod_net->disconnectAllTerms();
251+
228252
// journalling
229253
if (block->_journal) {
230254
block->_journal->beginAction(dbJournal::DELETE_OBJECT);

0 commit comments

Comments
 (0)