Skip to content

Commit

Permalink
Added custom dbSta converter call to get iterm from pin with error check
Browse files Browse the repository at this point in the history
Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Dec 9, 2024
1 parent 16003fa commit bbfe645
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/dbSta/include/db_sta/dbNetwork.hh
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class dbNetwork : public ConcreteNetwork
dbBTerm*& bterm,
dbModITerm*& moditerm,
dbModBTerm*& modbterm) const;
dbITerm* staToDb(const Pin* pin) const;

dbNet* staToDb(const Net* net) const;
void staToDb(const Net* net, dbNet*& dnet, dbModNet*& modnet) const;
Expand Down
17 changes: 17 additions & 0 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2339,6 +2339,23 @@ void dbNetwork::staToDb(const Pin* pin,
}
}

// Get the iterm for a pin and error check
dbITerm* dbNetwork::staToDb(const Pin* pin) const
{
dbITerm* ret = nullptr;
if (pin) {
dbObject* obj = reinterpret_cast<dbObject*>(const_cast<Pin*>(pin));
dbObjectType type = obj->getObjectType();
if (type == dbITermObj) {
ret = static_cast<dbITerm*>(obj);
}
}
if (ret == nullptr) {
logger_->critical(ORD, 2023, "pin is not an ITerm");
}
return ret;
}

dbBTerm* dbNetwork::staToDb(const Term* term) const
{
return reinterpret_cast<dbBTerm*>(const_cast<Term*>(term));
Expand Down
16 changes: 3 additions & 13 deletions src/rsz/src/Resizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -911,19 +911,9 @@ void Resizer::bufferOutput(const Pin* top_pin, LibertyCell* buffer_cell)
Pin* buffer_ip_pin = nullptr;
Pin* buffer_op_pin = nullptr;
getBufferPins(buffer, buffer_ip_pin, buffer_op_pin);
// get the iterms. Note this are never null (makeBuffer call above
// properly instantiates
// them and we know to always expect an iterm.).
odb::dbITerm* buffer_ip_pin_iterm = db_network_->flatPin(buffer_ip_pin);
assert(buffer_ip_pin_iterm);
odb::dbITerm* buffer_op_pin_iterm = db_network_->flatPin(buffer_op_pin);
assert(buffer_op_pin_iterm);
//
// axiom: we have created a buffer above therefore we rationally
// expect it to have valid iterms.
// If the iterm creation fails an assert is thrown elsewhere.
// But we put the above in to make it clear (and hopefully
// to fool coverity).

odb::dbITerm* buffer_ip_pin_iterm = db_network_->staToDb(buffer_ip_pin);
odb::dbITerm* buffer_op_pin_iterm = db_network_->staToDb(buffer_op_pin);

if (flat_op_net) {
buffer_ip_pin_iterm->connect(flat_op_net);
Expand Down

0 comments on commit bbfe645

Please sign in to comment.