diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index ae3b03107d1..7dd5b08114a 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -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); diff --git a/src/dbSta/src/dbReadVerilog.cc b/src/dbSta/src/dbReadVerilog.cc index 43c8c42ca6a..2a268ff5599 100644 --- a/src/dbSta/src/dbReadVerilog.cc +++ b/src/dbSta/src/dbReadVerilog.cc @@ -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) { diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index 3189c06c866..d95e5a206a7 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -953,7 +953,7 @@ class dbBlock : public dbObject dbSet getModInsts(); dbSet getModNets(); dbSet getModBTerms(); - + /// /// Get the Power Domains of this block. /// @@ -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 getModITerms(); @@ -7724,6 +7724,7 @@ class dbModule : public dbObject dbSet getChildren(); dbSet getModInsts(); dbSet getModNets(); + dbModNet* getModNet(const char* net_name); dbSet getModBTerms(); dbSet getInsts(); @@ -7739,14 +7740,10 @@ class dbModule : public dbObject static dbModule* getModule(dbBlock* block_, uint dbid_); - dbModInst* getModInst(dbId); - dbInst* getdbInst(dbId); + unsigned getModInstCount(); unsigned getDbInstCount(); - dbModBTerm* getdbModBTerm(dbId); - dbModBTerm* getdbModBTerm(dbBlock*, dbId); - dbModNet* getModNet(const char* net_name); bool findPortIx(const char* port_name, unsigned& ix); diff --git a/src/odb/src/db/dbModInst.cpp b/src/odb/src/db/dbModInst.cpp index f410d46089e..9e37cf6c658 100644 --- a/src/odb/src/db/dbModInst.cpp +++ b/src/odb/src/db/dbModInst.cpp @@ -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 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 diff --git a/src/odb/src/db/dbModule.cpp b/src/odb/src/db/dbModule.cpp index 52c43c60717..9e9ebe30a9b 100644 --- a/src/odb/src/db/dbModule.cpp +++ b/src/odb/src/db/dbModule.cpp @@ -288,21 +288,6 @@ void dbModule::highestModWithNetNamed(const char* modbterm_name, } } -dbModInst* dbModule::getModInst(dbId 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 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() { @@ -435,6 +420,17 @@ dbSet dbModule::getModNets() return dbSet(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 dbModule::getModInsts() { _dbModule* module = (_dbModule*) this; @@ -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; @@ -547,7 +541,6 @@ std::vector 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; @@ -567,6 +560,8 @@ bool dbModule::findPortIx(const char* port_name, unsigned& ix) return false; } + + std::string dbModule::getHierarchicalName() const { dbModInst* inst = getModInst(); @@ -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 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 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 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