Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/dbSta/src/dbSta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ class dbStaCbk : public dbBlockCallBackObj
void inDbBTermSetSigType(dbBTerm* bterm, const dbSigType& sig_type) override;

private:
// for inDbInstSwapMasterBefore/inDbInstSwapMasterAfter
bool swap_master_arcs_equiv_ = false;

dbSta* sta_;
dbNetwork* network_ = nullptr;
Logger* logger_;
Expand Down Expand Up @@ -724,7 +727,10 @@ void dbSta::deleteInstance(Instance* inst)

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

void dbSta::deleteNet(Net* net)
Expand Down Expand Up @@ -923,20 +929,25 @@ void dbStaCbk::inDbInstSwapMasterBefore(dbInst* inst, dbMaster* master)
LibertyCell* to_lib_cell = network_->libertyCell(network_->dbToSta(master));
LibertyCell* from_lib_cell = network_->libertyCell(inst);
Instance* sta_inst = network_->dbToSta(inst);
if (sta::equivCells(from_lib_cell, to_lib_cell)) {

swap_master_arcs_equiv_ = sta::equivCellsArcs(from_lib_cell, to_lib_cell);

if (swap_master_arcs_equiv_) {
sta_->replaceEquivCellBefore(sta_inst, to_lib_cell);
} else {
logger_->error(STA,
1000,
"instance {} swap master {} is not equivalent",
inst->getConstName(),
master->getConstName());
sta_->replaceCellBefore(sta_inst, to_lib_cell);
}
}

void dbStaCbk::inDbInstSwapMasterAfter(dbInst* inst)
{
sta_->replaceEquivCellAfter(network_->dbToSta(inst));
Instance* sta_inst = network_->dbToSta(inst);

if (swap_master_arcs_equiv_) {
sta_->replaceEquivCellAfter(sta_inst);
} else {
sta_->replaceCellAfter(sta_inst);
}
}

void dbStaCbk::inDbNetDestroy(dbNet* db_net)
Expand Down