diff --git a/src/dbSta/include/db_sta/dbNetwork.hh b/src/dbSta/include/db_sta/dbNetwork.hh index 8b85f43d03e..bd90306da24 100644 --- a/src/dbSta/include/db_sta/dbNetwork.hh +++ b/src/dbSta/include/db_sta/dbNetwork.hh @@ -128,6 +128,7 @@ class dbNetwork : public ConcreteNetwork dbBTerm*& bterm) const; dbBTerm* staToDb(const Term* term) const; dbMaster* staToDb(const Cell* cell) const; + void staToDb(const Cell* cell, dbMaster*& master, dbModule*& module) const; dbMaster* staToDb(const LibertyCell* cell) const; dbMTerm* staToDb(const Port* port) const; dbMTerm* staToDb(const LibertyPort* port) const; diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index b59594209fb..0e6a5acec4f 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -115,6 +115,11 @@ Library* DbLibraryIterator1::next() return reinterpret_cast(iter_->next()); } +// +// check the leaves accessible from the network +// match those accessible from block. +// + //////////////////////////////////////////////////////////////// class DbInstanceChildIterator : public InstanceChildIterator @@ -552,7 +557,17 @@ Instance* dbNetwork::parent(const Instance* instance) const bool dbNetwork::isLeaf(const Instance* instance) const { - return instance != top_instance_; + if (instance == top_instance_) { + return false; + } + dbMaster* db_master; + dbModule* db_module; + Cell* cur_cell = cell(instance); + staToDb(cur_cell, db_master, db_module); + if (db_module) { + return false; + } + return true; } Instance* dbNetwork::findInstance(const char* path_name) const @@ -1451,6 +1466,24 @@ dbBTerm* dbNetwork::staToDb(const Term* term) const return reinterpret_cast(const_cast(term)); } +void dbNetwork::staToDb(const Cell* cell, + dbMaster*& master, + dbModule*& module) const +{ + module = nullptr; + master = nullptr; + if (findLibertyCell(name(cell))) { + master = reinterpret_cast(const_cast(cell)); + } else { + if (block_) { + if (block_->findModule(name(cell))) + module = reinterpret_cast(const_cast(cell)); + else + master = reinterpret_cast(const_cast(cell)); + } + } +} + dbMaster* dbNetwork::staToDb(const Cell* cell) const { const ConcreteCell* ccell = reinterpret_cast(cell);