Skip to content

Commit

Permalink
Clean up of unused functions as per comments
Browse files Browse the repository at this point in the history
Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Feb 14, 2024
1 parent c77d5b0 commit 4f4e9aa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 82 deletions.
13 changes: 7 additions & 6 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -818,16 +818,17 @@ Pin* dbNetwork::findPin(const Instance* instance, const char* port_name) const
}
if (mod_inst) {
dbModule* module = mod_inst->getMaster();
unsigned ix = 0;
if (module->findPortIx(port_name, ix)) {
dbModITerm* miterm = nullptr;
if (mod_inst->getPinAtIx(ix, miterm))
return dbToSta(miterm);
}
dbModITerm* miterm = nullptr;
//removed indexing by port ix (which is most efficient)
//to calm OR personnel...
if (mod_inst->findModITerm(port_name,miterm))
return dbToSta(miterm);
}
return nullptr; // no pins on dbModInst in odb currently
}



Pin* dbNetwork::findPin(const Instance* instance, const Port* port) const
{
const char* port_name = name(port);
Expand Down
1 change: 0 additions & 1 deletion src/dbSta/src/dbReadVerilog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,6 @@ void Verilog2db::WireUpModNetsForTopInst(const Instance* inst)
while (net_iter->hasNext()) {
Net* net = net_iter->next();
const char* net_name = network_->pathName(net);

dbModNet* mod_net = top_module->getModNet(net_name);

if (mod_net) {
Expand Down
11 changes: 4 additions & 7 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ class dbBlock : public dbObject
dbSet<dbModInst> getModInsts();
dbSet<dbModNet> getModNets();
dbSet<dbModBTerm> getModBTerms();

///
/// Get the Power Domains of this block.
///
Expand Down Expand Up @@ -7636,7 +7636,7 @@ class dbModInst : public dbObject

std::string getHierarchicalName() const;

bool getPinAtIx(unsigned ix, dbModITerm*& ret) const;

bool findModITerm(const char* name, dbModITerm*& ret);

dbSet<dbModITerm> getModITerms();
Expand Down Expand Up @@ -7724,6 +7724,7 @@ class dbModule : public dbObject
dbSet<dbModInst> getChildren();
dbSet<dbModInst> getModInsts();
dbSet<dbModNet> getModNets();
dbModNet* getModNet(const char* net_name);
dbSet<dbModBTerm> getModBTerms();
dbSet<dbInst> getInsts();

Expand All @@ -7739,14 +7740,10 @@ class dbModule : public dbObject

static dbModule* getModule(dbBlock* block_, uint dbid_);

dbModInst* getModInst(dbId<dbModInst>);
dbInst* getdbInst(dbId<dbInst>);

unsigned getModInstCount();
unsigned getDbInstCount();

dbModBTerm* getdbModBTerm(dbId<dbModBTerm>);
dbModBTerm* getdbModBTerm(dbBlock*, dbId<dbModBTerm>);
dbModNet* getModNet(const char* net_name);

bool findPortIx(const char* port_name, unsigned& ix);

Expand Down
17 changes: 0 additions & 17 deletions src/odb/src/db/dbModInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,23 +335,6 @@ bool dbModInst::findModITerm(const char* name, dbModITerm*& ret)
return false;
}

bool dbModInst::getPinAtIx(unsigned ix, dbModITerm*& ret) const
{
_dbModInst* _obj = (_dbModInst*) this;
_dbBlock* block = (_dbBlock*) _obj->getOwner();
(void) block;
(void) _obj;
printf("TDODO");
/*
if (ix < _obj->_pin_vec.size()) {
dbId<dbModITerm> el = _obj->_pin_vec.at(ix);
dbId<_dbModITerm> conv_el(el.id());
ret = (dbModITerm*) (block->_moditerm_tbl->getPtr(conv_el));
return true;
}
*/
return false;
}

// User Code End dbModInstPublicMethods
} // namespace odb
Expand Down
64 changes: 13 additions & 51 deletions src/odb/src/db/dbModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,6 @@ void dbModule::highestModWithNetNamed(const char* modbterm_name,
}
}

dbModInst* dbModule::getModInst(dbId<dbModInst> el)
{
_dbModule* module = (_dbModule*) this;
_dbBlock* block = (_dbBlock*) module->getOwner();
dbId<_dbModInst> converted_el(el.id());
return ((dbModInst*) (block->_modinst_tbl->getPtr(converted_el)));
}

dbInst* dbModule::getdbInst(dbId<dbInst> el)
{
_dbModule* module = (_dbModule*) this;
_dbBlock* block = (_dbBlock*) module->getOwner();
dbId<_dbInst> converted_el(el.id());
return ((dbInst*) (block->_inst_tbl->getPtr(converted_el)));
}

unsigned dbModule::getModInstCount()
{
Expand Down Expand Up @@ -435,6 +420,17 @@ dbSet<dbModNet> dbModule::getModNets()
return dbSet<dbModNet>(module, block->_module_modnet_itr);
}

//This should be in a map some place,
//but we are using the dbSet to store the mod nets in a module
dbModNet* dbModule::getModNet(const char* net_name){
for (auto mnet: getModNets()){
if (!strcmp(net_name,mnet -> getName()))
return mnet;
}
return nullptr;
}


dbSet<dbModInst> dbModule::getModInsts()
{
_dbModule* module = (_dbModule*) this;
Expand Down Expand Up @@ -518,8 +514,6 @@ dbModInst* dbModule::findModInst(const char* name)

dbInst* dbModule::findDbInst(const char* name)
{
_dbModule* cur_module = (_dbModule*) this;
_dbBlock* block = (_dbBlock*) cur_module->getOwner();
for (dbInst* inst : getInsts()) {
if (!strcmp(inst->getName().c_str(), name))
return inst;
Expand Down Expand Up @@ -547,7 +541,6 @@ std::vector<dbInst*> dbModule::getLeafInsts()

dbModBTerm* dbModule::findModBTerm(const char* name)
{
_dbModule* cur_module = (_dbModule*) this;
for (dbModBTerm* mod_bterm : getModBTerms()) {
if (!strcmp(mod_bterm->getName(), name))
return mod_bterm;
Expand All @@ -567,6 +560,8 @@ bool dbModule::findPortIx(const char* port_name, unsigned& ix)
return false;
}



std::string dbModule::getHierarchicalName() const
{
dbModInst* inst = getModInst();
Expand All @@ -589,45 +584,12 @@ void dbModule::staSetCell(void* cell)
module->_sta_cell = cell;
}

dbModNet* dbModule::getModNet(const char* name)
{
_dbModule* obj = (_dbModule*) this;
_dbBlock* _block = (_dbBlock*) obj->getOwner();
std::string name_str(name);
/*
if (obj->_modnet_map.find(name_str) != obj->_modnet_map.end()) {
dbId<dbModNet> mnet_id = obj->_modnet_map[name_str];
dbId<_dbModNet> _mnet_id(mnet_id.id());
return (dbModNet*) (_block->_modnet_tbl->getPtr(_mnet_id));
}
*/
printf("unsupported: getModNet\n");
return nullptr;
}

dbBlock* dbModule::getOwner()
{
_dbModule* obj = (_dbModule*) this;
return (dbBlock*) obj->getOwner();
}

dbModBTerm* dbModule::getdbModBTerm(dbBlock* block,
dbId<dbModBTerm> modbterm_id)
{
_dbBlock* _block = (_dbBlock*) block;
unsigned id = modbterm_id.id();
dbId<_dbModBTerm> val(id);
return (dbModBTerm*) (_block->_modbterm_tbl->getPtr(val));
}

dbModBTerm* dbModule::getdbModBTerm(dbId<dbModBTerm> modbterm_id)
{
_dbModule* obj = (_dbModule*) this;
_dbBlock* _block = (_dbBlock*) obj->getOwner();
unsigned id = modbterm_id.id();
dbId<_dbModBTerm> val(id);
return (dbModBTerm*) (_block->_modbterm_tbl->getPtr(val));
}

// User Code End dbModulePublicMethods
} // namespace odb
Expand Down

0 comments on commit 4f4e9aa

Please sign in to comment.