@@ -2961,19 +2961,23 @@ void dbNetwork::staToDb(const Cell* cell,
29612961//
29622962dbMaster* dbNetwork::staToDb (const Cell* cell) const
29632963{
2964- const ConcreteCell* ccell = reinterpret_cast <const ConcreteCell*>(cell);
2965- auto master = reinterpret_cast <dbMaster*>(ccell->extCell ());
2966- assert (!master || master->getObjectType () == odb::dbMasterObj);
2964+ if (isConcreteCell (cell)) {
2965+ const ConcreteCell* ccell = reinterpret_cast <const ConcreteCell*>(cell);
2966+ auto master = reinterpret_cast <dbMaster*>(ccell->extCell ());
2967+ assert (!master || master->getObjectType () == odb::dbMasterObj);
2968+ return master;
2969+ }
2970+
2971+ dbMaster* master = nullptr ;
2972+ dbModule* module = nullptr ;
2973+ staToDb (cell, master, module );
29672974 return master;
29682975}
29692976
29702977// called only on db cells.
29712978dbMaster* dbNetwork::staToDb (const LibertyCell* cell) const
29722979{
2973- const ConcreteCell* ccell = cell;
2974- auto master = reinterpret_cast <dbMaster*>(ccell->extCell ());
2975- assert (!master || master->getObjectType () == odb::dbMasterObj);
2976- return master;
2980+ return staToDb (reinterpret_cast <const Cell*>(cell));
29772981}
29782982
29792983dbMTerm* dbNetwork::staToDb (const Port* port) const
@@ -3172,6 +3176,26 @@ PortDirection* dbNetwork::dbToSta(const dbSigType& sig_type,
31723176
31733177// //////////////////////////////////////////////////////////////
31743178
3179+ LibertyCell* dbNetwork::libertyCell (Cell* cell) const
3180+ {
3181+ if (isConcreteCell (cell) == false ) {
3182+ dbMaster* master = nullptr ;
3183+ dbModule* module = nullptr ;
3184+ staToDb (cell, master, module );
3185+ if (master) {
3186+ cell = reinterpret_cast <Cell*>(master->staCell ());
3187+ } else if (module ) {
3188+ return nullptr ; // dbModule does not have the corresponding LibertyCell
3189+ }
3190+ }
3191+ return ConcreteNetwork::libertyCell (cell);
3192+ }
3193+
3194+ const LibertyCell* dbNetwork::libertyCell (const Cell* cell) const
3195+ {
3196+ return libertyCell (const_cast <Cell*>(cell));
3197+ }
3198+
31753199LibertyCell* dbNetwork::libertyCell (dbInst* inst)
31763200{
31773201 return libertyCell (dbToSta (inst));
0 commit comments