Skip to content

Commit a70a71e

Browse files
authored
Merge pull request #7771 from The-OpenROAD-Project-staging/odb-fix-swap-master
dbSta: Fix swap master callbacks after sta change
2 parents b0236ae + 45bddde commit a70a71e

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/dbSta/src/dbSta.cc

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ class dbStaCbk : public dbBlockCallBackObj
166166
void inDbBTermSetSigType(dbBTerm* bterm, const dbSigType& sig_type) override;
167167

168168
private:
169+
// for inDbInstSwapMasterBefore/inDbInstSwapMasterAfter
170+
bool swap_master_arcs_equiv_ = false;
171+
169172
dbSta* sta_;
170173
dbNetwork* network_ = nullptr;
171174
Logger* logger_;
@@ -724,7 +727,10 @@ void dbSta::deleteInstance(Instance* inst)
724727

725728
void dbSta::replaceCell(Instance* inst, Cell* to_cell, LibertyCell* to_lib_cell)
726729
{
727-
Sta::replaceCell(inst, to_cell, to_lib_cell);
730+
// do not call `Sta::replaceCell` as sta's before/after hooks are called
731+
// from db callbacks
732+
NetworkEdit* network = networkCmdEdit();
733+
network->replaceCell(inst, to_cell);
728734
}
729735

730736
void dbSta::deleteNet(Net* net)
@@ -923,20 +929,25 @@ void dbStaCbk::inDbInstSwapMasterBefore(dbInst* inst, dbMaster* master)
923929
LibertyCell* to_lib_cell = network_->libertyCell(network_->dbToSta(master));
924930
LibertyCell* from_lib_cell = network_->libertyCell(inst);
925931
Instance* sta_inst = network_->dbToSta(inst);
926-
if (sta::equivCells(from_lib_cell, to_lib_cell)) {
932+
933+
swap_master_arcs_equiv_ = sta::equivCellsArcs(from_lib_cell, to_lib_cell);
934+
935+
if (swap_master_arcs_equiv_) {
927936
sta_->replaceEquivCellBefore(sta_inst, to_lib_cell);
928937
} else {
929-
logger_->error(STA,
930-
1000,
931-
"instance {} swap master {} is not equivalent",
932-
inst->getConstName(),
933-
master->getConstName());
938+
sta_->replaceCellBefore(sta_inst, to_lib_cell);
934939
}
935940
}
936941

937942
void dbStaCbk::inDbInstSwapMasterAfter(dbInst* inst)
938943
{
939-
sta_->replaceEquivCellAfter(network_->dbToSta(inst));
944+
Instance* sta_inst = network_->dbToSta(inst);
945+
946+
if (swap_master_arcs_equiv_) {
947+
sta_->replaceEquivCellAfter(sta_inst);
948+
} else {
949+
sta_->replaceCellAfter(sta_inst);
950+
}
940951
}
941952

942953
void dbStaCbk::inDbNetDestroy(dbNet* db_net)

0 commit comments

Comments
 (0)