Skip to content

Commit

Permalink
Api to check for leaves turned on. Signed-off-by: Andy Fox <andy@rush…
Browse files Browse the repository at this point in the history
…c.com>

Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed May 14, 2024
1 parent 78936db commit c9d75f5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
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 @@ -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;
Expand Down
35 changes: 34 additions & 1 deletion src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ Library* DbLibraryIterator1::next()
return reinterpret_cast<Library*>(iter_->next());
}

//
// check the leaves accessible from the network
// match those accessible from block.
//

////////////////////////////////////////////////////////////////

class DbInstanceChildIterator : public InstanceChildIterator
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1451,6 +1466,24 @@ dbBTerm* dbNetwork::staToDb(const Term* term) const
return reinterpret_cast<dbBTerm*>(const_cast<Term*>(term));
}

void dbNetwork::staToDb(const Cell* cell,
dbMaster*& master,
dbModule*& module) const
{
module = nullptr;
master = nullptr;
if (findLibertyCell(name(cell))) {
master = reinterpret_cast<dbMaster*>(const_cast<Cell*>(cell));
} else {
if (block_) {
if (block_->findModule(name(cell)))
module = reinterpret_cast<dbModule*>(const_cast<Cell*>(cell));
else
master = reinterpret_cast<dbMaster*>(const_cast<Cell*>(cell));
}
}
}

dbMaster* dbNetwork::staToDb(const Cell* cell) const
{
const ConcreteCell* ccell = reinterpret_cast<const ConcreteCell*>(cell);
Expand Down

0 comments on commit c9d75f5

Please sign in to comment.