From d1321d66f0995340dd13ad7bae014c50a6e22fd7 Mon Sep 17 00:00:00 2001 From: andyfox-rushc Date: Wed, 20 Mar 2024 16:16:34 -0700 Subject: [PATCH] Cleanups :private methods, work in progress Signed-off-by: Andy Fox Signed-off-by: andyfox-rushc --- src/odb/include/odb/db.h | 87 +++--------- src/odb/src/codeGenerator/schema.json | 3 +- .../codeGenerator/schema/chip/dbModBterm.json | 5 +- .../codeGenerator/schema/chip/dbModIterm.json | 10 +- src/odb/src/db/dbBlock.cpp | 27 ++-- src/odb/src/db/dbModBTerm.cpp | 101 +++---------- src/odb/src/db/dbModITerm.cpp | 134 +----------------- src/odb/src/db/dbModITerm.h | 1 - src/odb/src/db/dbModNet.cpp | 20 ++- src/odb/src/db/dbModule.cpp | 42 +----- src/odb/src/db/dbModuleModBTermItr.cpp | 1 + src/odb/src/db/dbModuleModInstItr.cpp | 1 + src/odb/src/db/dbModuleModInstModITermItr.cpp | 1 + src/odb/src/db/dbModuleModNetItr.cpp | 1 + 14 files changed, 78 insertions(+), 356 deletions(-) diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index ab16c04eb24..8f6116ba5bd 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -913,8 +913,6 @@ class dbBlock : public dbObject /// dbSet getChildren(); - void getChildModules(std::vector& child_modules); - /// /// Find a specific child-block of this block. /// Returns nullptr if the object was not found. @@ -1722,12 +1720,15 @@ class dbBTerm : public dbObject /// void setSpecial(); + /// /// Get the net of this block-terminal. /// dbNet* getNet(); - // AF + /// + /// Get the mod net of this block-terminal. dbModNet* getModNet(); + /// /// Disconnect the block-terminal from it's net. /// @@ -3244,15 +3245,7 @@ class dbInst : public dbObject dbMaster* master, const char* name, bool physical_only = false, - dbModule* = nullptr); - - /// - /// Create a new instance within the specified region. - /// If physicalOnly is true the instance can't bee added to a dbModule. - /// If false, it will be added to the top module. - /// Returns nullptr if an instance with this name already exists. - /// Returns nullptr if the master is not FROZEN. - /// If db module present then the dbinst is added to that module + dbModule* parent_module = nullptr); static dbInst* create(dbBlock* block, dbMaster* master, @@ -3315,7 +3308,6 @@ class dbITerm : public dbObject /// dbNet* getNet(); - // AF dbModNet* getModNet(); /// @@ -3470,7 +3462,7 @@ class dbITerm : public dbObject void connect(dbNet* net); // connect this iterm to a dbmodNet - // AF. + void connect(dbModNet* net); /// @@ -7491,38 +7483,18 @@ class dbModBTerm : public dbObject dbModNet* getNet() const; - void setNextNetModbterm(dbModBTerm* next_net_modbterm); - - dbModBTerm* getNextNetModbterm() const; - - void setPrevNetModbterm(dbModBTerm* prev_net_modbterm); - - dbModBTerm* getPrevNetModbterm() const; - - void setNextEntry(dbModBTerm* next_entry); - - dbModBTerm* getNextEntry() const; - // User Code Begin dbModBTerm - void setSigType(dbSigType& type); + void setSigType(dbSigType type); dbSigType getSigType(); void setIoType(dbIoType type); dbIoType getIoType(); - - static dbModBTerm* create(dbModule* parentModule, const char* name); - - void connect(dbModNet*); + void connect(dbModNet* net); void disconnect(); - - char* getName(); - void staSetPort(void* p); void* staPort(); - private: - void setFlags(uint flags); - uint getFlags() const; + static dbModBTerm* create(dbModule* parentModule, const char* name); // User Code End dbModBTerm }; @@ -7561,37 +7533,18 @@ class dbModInst : public dbObject class dbModITerm : public dbObject { public: + const char* getName() const; + dbModInst* getParent() const; void setNet(dbModNet* net); dbModNet* getNet() const; - void setNextNetModiterm(dbModITerm* next_net_moditerm); - - dbModITerm* getNextNetModiterm() const; - - void setPrevNetModiterm(dbModITerm* prev_net_moditerm); - - dbModITerm* getPrevNetModiterm() const; - - void setNextEntry(dbModITerm* next_entry); - - dbModITerm* getNextEntry() const; - // User Code Begin dbModITerm - void setSigType(dbSigType& type); - dbSigType getSigType(); - void setIoType(dbIoType& type); - dbIoType getIoType(); + bool connect(dbModNet* modnet); static dbModITerm* create(dbModInst* parentInstance, const char* name); - bool connect(dbModNet*); - char* getName(); - - private: - void setFlags(uint flags); - uint getFlags() const; // User Code End dbModITerm }; @@ -7607,9 +7560,8 @@ class dbModNet : public dbObject dbSet getITerms(); dbSet getBTerms(); - static dbModNet* create(dbModule* parentModule, const char* name); + dbModNet* create(dbModule* parentModule, const char* name); const char* getName() const; - dbModBTerm* connectedToModBTerm(); // User Code End dbModNet }; @@ -7623,9 +7575,11 @@ class dbModule : public dbObject dbModInst* getModInst() const; // User Code Begin dbModule - std::string getHierarchicalName(std::string& separator); std::string getHierarchicalName() const; - std::string hierarchicalNameR(std::string& separator); + + // Get a mod net by name + dbModNet* getModNet(const char* net_name); + // Adding an inst to a new module will remove it from its previous // module. void addInst(dbInst* inst); @@ -7635,7 +7589,6 @@ class dbModule : public dbObject dbSet getChildren(); dbSet getModInsts(); dbSet getModNets(); - dbModNet* getModNet(const char* net_name); dbSet getModBTerms(); dbSet getInsts(); @@ -7651,10 +7604,8 @@ class dbModule : public dbObject static dbModule* getModule(dbBlock* block_, uint dbid_); - unsigned getModInstCount(); - unsigned getDbInstCount(); - - bool findPortIx(const char* port_name, unsigned& ix); + int getModInstCount(); + int getDbInstCount(); void staSetCell(void* cell); void* getStaCell(); diff --git a/src/odb/src/codeGenerator/schema.json b/src/odb/src/codeGenerator/schema.json index 495207d7604..d1422436595 100644 --- a/src/odb/src/codeGenerator/schema.json +++ b/src/odb/src/codeGenerator/schema.json @@ -24,7 +24,8 @@ "parentObject": "dbModBTerm", "tableName": "modbterm_tbl", "reversible": "true", - "orderReversed": "true", + "orderReversed": "true", + "flags":["private"], "sequential": 0, "includes": ["dbModBTerm.h", "dbModule.h"] }, diff --git a/src/odb/src/codeGenerator/schema/chip/dbModBterm.json b/src/odb/src/codeGenerator/schema/chip/dbModBterm.json index 6adea6a6771..f891332e26b 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModBterm.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModBterm.json @@ -10,7 +10,7 @@ { "name":"_flags", "type":"uint", - "flags":["no-set","no-get"] + "flags":["private"] }, { "name":"_parent", @@ -26,16 +26,19 @@ { "name":"_next_net_modbterm", "type":"dbId<_dbModBTerm>", + "flags":["private"], "parent":"dbBlock" }, { "name":"_prev_net_modbterm", "type":"dbId<_dbModBTerm>", + "flags":["private"], "parent":"dbBlock" }, { "name":"_next_entry", "type":"dbId<_dbModBTerm>", + "flags":["private"], "parent":"dbBlock" } ], diff --git a/src/odb/src/codeGenerator/schema/chip/dbModIterm.json b/src/odb/src/codeGenerator/schema/chip/dbModIterm.json index 75ec73a66e4..b021c0090b3 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModIterm.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModIterm.json @@ -5,13 +5,8 @@ { "name":"_name", "type":"char *", - "flags":["no-set","no-get"] + "flags":["no-set"] }, - { - "name":"_flags", - "type":"uint", - "flags":["no-set","no-get"] - }, { "name":"_parent", "type":"dbId<_dbModInst>", @@ -26,16 +21,19 @@ { "name":"_next_net_moditerm", "type":"dbId<_dbModITerm>", + "flags":["private"], "parent":"dbBlock" }, { "name":"_prev_net_moditerm", "type":"dbId<_dbModITerm>", + "flags":["private"], "parent":"dbBlock" }, { "name":"_next_entry", "type":"dbId<_dbModITerm>", + "flags":["private"], "parent":"dbBlock" } diff --git a/src/odb/src/db/dbBlock.cpp b/src/odb/src/db/dbBlock.cpp index 1de3590bcfe..5d7ef02bb0e 100644 --- a/src/odb/src/db/dbBlock.cpp +++ b/src/odb/src/db/dbBlock.cpp @@ -620,9 +620,9 @@ _dbBlock::_dbBlock(_dbDatabase* db, const _dbBlock& block) _dbBlock::~_dbBlock() { - if (_name) { + if (_name) free((void*) _name); - } + delete _bterm_tbl; delete _iterm_tbl; delete _net_tbl; @@ -693,12 +693,11 @@ _dbBlock::~_dbBlock() _cbitr = _callbacks.begin(); (*_cbitr)->removeOwner(); } - if (_journal) { + if (_journal) delete _journal; - } - if (_journal_pending) { + + if (_journal_pending) delete _journal_pending; - } } void dbBlock::clear() @@ -4060,16 +4059,6 @@ dbTech* dbBlock::getTech() return (dbTech*) block->getTech(); } -void dbBlock::getChildModules(std::vector& child_modules) -{ - _dbBlock* block = (_dbBlock*) this; - std::vector contents; - block->_module_tbl->getObjects(contents); - for (auto dbm : contents) { - child_modules.push_back((dbModule*) dbm); - } -} - void dbBlock::dumpDebug() { _dbBlock* block = (_dbBlock*) this; @@ -4144,10 +4133,12 @@ void dbBlock::dumpDebug() dbModBTerm* module_port = *mod_bterm_iter; printf("\t\tPort %s Net %s (%d)\n", module_port->getName(), - module_port->getNet() + ((_dbModNet*) module_port->getNet()) ? ((_dbModNet*) module_port->getNet())->_name : "No-modnet", - module_port->getNet() ? module_port->getNet()->getId() : -1); + ((_dbModNet*) module_port->getNet()) + ? ((_dbModNet*) module_port->getNet())->getId() + : -1); printf("\t\tPort parent %s\n\n", module_port->getParent()->getName()); } printf("\t\tModBTermPorts ---\n"); diff --git a/src/odb/src/db/dbModBTerm.cpp b/src/odb/src/db/dbModBTerm.cpp index 8ef2915aa6f..c234d86e48b 100644 --- a/src/odb/src/db/dbModBTerm.cpp +++ b/src/odb/src/db/dbModBTerm.cpp @@ -191,72 +191,8 @@ dbModNet* dbModBTerm::getNet() const return (dbModNet*) par->_modnet_tbl->getPtr(obj->_net); } -void dbModBTerm::setNextNetModbterm(dbModBTerm* next_net_modbterm) -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - - obj->_next_net_modbterm = next_net_modbterm->getImpl()->getOID(); -} - -dbModBTerm* dbModBTerm::getNextNetModbterm() const -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - if (obj->_next_net_modbterm == 0) { - return nullptr; - } - _dbBlock* par = (_dbBlock*) obj->getOwner(); - return (dbModBTerm*) par->_modbterm_tbl->getPtr(obj->_next_net_modbterm); -} - -void dbModBTerm::setPrevNetModbterm(dbModBTerm* prev_net_modbterm) -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - - obj->_prev_net_modbterm = prev_net_modbterm->getImpl()->getOID(); -} - -dbModBTerm* dbModBTerm::getPrevNetModbterm() const -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - if (obj->_prev_net_modbterm == 0) { - return nullptr; - } - _dbBlock* par = (_dbBlock*) obj->getOwner(); - return (dbModBTerm*) par->_modbterm_tbl->getPtr(obj->_prev_net_modbterm); -} - -void dbModBTerm::setNextEntry(dbModBTerm* next_entry) -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - - obj->_next_entry = next_entry->getImpl()->getOID(); -} - -dbModBTerm* dbModBTerm::getNextEntry() const -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - if (obj->_next_entry == 0) { - return nullptr; - } - _dbBlock* par = (_dbBlock*) obj->getOwner(); - return (dbModBTerm*) par->_modbterm_tbl->getPtr(obj->_next_entry); -} - // User Code Begin dbModBTermPublicMethods -void dbModBTerm::setFlags(uint flags) -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - - obj->_flags = flags; -} - -uint dbModBTerm::getFlags() const -{ - _dbModBTerm* obj = (_dbModBTerm*) this; - return obj->_flags; -} - struct dbModBTermFlags_str { dbIoType::Value _iotype : 4; @@ -270,33 +206,37 @@ typedef union dbModBTermFlags uint uint_val; } dbModBTermFlagsU; -void dbModBTerm::setSigType(dbSigType& type) +void dbModBTerm::setSigType(dbSigType type) { + _dbModBTerm* _dbmodbterm = (_dbModBTerm*) this; dbModBTermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); + cur_flags.uint_val = _dbmodbterm->_flags; cur_flags.flags._sigtype = type.getValue(); - setFlags(cur_flags.uint_val); + _dbmodbterm->_flags = cur_flags.uint_val; } dbSigType dbModBTerm::getSigType() { + _dbModBTerm* _dbmodbterm = (_dbModBTerm*) this; dbModBTermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); + cur_flags.uint_val = _dbmodbterm->_flags; return dbSigType(cur_flags.flags._sigtype); } void dbModBTerm::setIoType(dbIoType type) { + _dbModBTerm* _dbmodbterm = (_dbModBTerm*) this; dbModBTermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); + cur_flags.uint_val = _dbmodbterm->_flags; cur_flags.flags._iotype = type.getValue(); - setFlags(cur_flags.uint_val); + _dbmodbterm->_flags = cur_flags.uint_val; } dbIoType dbModBTerm::getIoType() { + _dbModBTerm* _dbmodbterm = (_dbModBTerm*) this; dbModBTermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); + cur_flags.uint_val = _dbmodbterm->_flags; return dbIoType(cur_flags.flags._iotype); } @@ -313,11 +253,9 @@ dbModBTerm* dbModBTerm::create(dbModule* parentModule, const char* name) std::string str_name(name); _dbModBTerm* modbterm = block->_modbterm_tbl->create(); // defaults - ((dbModBTerm*) modbterm)->setFlags(0U); - dbIoType io_typ = dbIoType::INPUT; - ((dbModBTerm*) modbterm)->setIoType(io_typ); - dbSigType sig_typ = dbSigType::SIGNAL; - ((dbModBTerm*) modbterm)->setSigType(sig_typ); + modbterm->_flags = 0U; + ((dbModBTerm*) modbterm)->setIoType(dbIoType::INPUT); + ((dbModBTerm*) modbterm)->setSigType(dbSigType::SIGNAL); modbterm->_net = 0; modbterm->_next_net_modbterm = 0; modbterm->_prev_net_modbterm = 0; @@ -331,12 +269,6 @@ dbModBTerm* dbModBTerm::create(dbModule* parentModule, const char* name) return (dbModBTerm*) modbterm; } -char* dbModBTerm::getName() -{ - _dbModBTerm* _bterm = (_dbModBTerm*) this; - return _bterm->_name; -} - void dbModBTerm::connect(dbModNet* net) { _dbModule* _module = (_dbModule*) (net->getParent()); @@ -344,9 +276,8 @@ void dbModBTerm::connect(dbModNet* net) _dbModNet* _modnet = (_dbModNet*) net; _dbModBTerm* _modbterm = (_dbModBTerm*) this; // already connected - if (_modbterm->_net == net->getId()) { + if (_modbterm->_net == net->getId()) return; - } _modbterm->_net = net->getId(); // append to net mod bterms. Do this by pushing onto head of list. if (_modnet->_modbterms != 0) { @@ -360,6 +291,8 @@ void dbModBTerm::connect(dbModNet* net) } _modbterm->_prev_net_modbterm = 0; // previous of head always zero _modnet->_modbterms = getId(); // set new head + // printf("Mod net now connected to %d modbterms\n", + // net -> getModBTerms().size()); return; } diff --git a/src/odb/src/db/dbModITerm.cpp b/src/odb/src/db/dbModITerm.cpp index d988260adb1..9827bb3d4d6 100644 --- a/src/odb/src/db/dbModITerm.cpp +++ b/src/odb/src/db/dbModITerm.cpp @@ -50,9 +50,6 @@ bool _dbModITerm::operator==(const _dbModITerm& rhs) const if (_name != rhs._name) { return false; } - if (_flags != rhs._flags) { - return false; - } if (_parent != rhs._parent) { return false; } @@ -83,7 +80,6 @@ void _dbModITerm::differences(dbDiff& diff, { DIFF_BEGIN DIFF_FIELD(_name); - DIFF_FIELD(_flags); DIFF_FIELD(_parent); DIFF_FIELD(_net); DIFF_FIELD(_next_net_moditerm); @@ -96,7 +92,6 @@ void _dbModITerm::out(dbDiff& diff, char side, const char* field) const { DIFF_OUT_BEGIN DIFF_OUT_FIELD(_name); - DIFF_OUT_FIELD(_flags); DIFF_OUT_FIELD(_parent); DIFF_OUT_FIELD(_net); DIFF_OUT_FIELD(_next_net_moditerm); @@ -113,7 +108,6 @@ _dbModITerm::_dbModITerm(_dbDatabase* db) _dbModITerm::_dbModITerm(_dbDatabase* db, const _dbModITerm& r) { _name = r._name; - _flags = r._flags; _parent = r._parent; _net = r._net; _next_net_moditerm = r._next_net_moditerm; @@ -124,7 +118,6 @@ _dbModITerm::_dbModITerm(_dbDatabase* db, const _dbModITerm& r) dbIStream& operator>>(dbIStream& stream, _dbModITerm& obj) { stream >> obj._name; - stream >> obj._flags; stream >> obj._parent; stream >> obj._net; stream >> obj._next_net_moditerm; @@ -136,7 +129,6 @@ dbIStream& operator>>(dbIStream& stream, _dbModITerm& obj) dbOStream& operator<<(dbOStream& stream, const _dbModITerm& obj) { stream << obj._name; - stream << obj._flags; stream << obj._parent; stream << obj._net; stream << obj._next_net_moditerm; @@ -158,6 +150,12 @@ _dbModITerm::~_dbModITerm() // //////////////////////////////////////////////////////////////////// +const char* dbModITerm::getName() const +{ + _dbModITerm* obj = (_dbModITerm*) this; + return obj->_name; +} + dbModInst* dbModITerm::getParent() const { _dbModITerm* obj = (_dbModITerm*) this; @@ -185,113 +183,7 @@ dbModNet* dbModITerm::getNet() const return (dbModNet*) par->_modnet_tbl->getPtr(obj->_net); } -void dbModITerm::setNextNetModiterm(dbModITerm* next_net_moditerm) -{ - _dbModITerm* obj = (_dbModITerm*) this; - - obj->_next_net_moditerm = next_net_moditerm->getImpl()->getOID(); -} - -dbModITerm* dbModITerm::getNextNetModiterm() const -{ - _dbModITerm* obj = (_dbModITerm*) this; - if (obj->_next_net_moditerm == 0) { - return nullptr; - } - _dbBlock* par = (_dbBlock*) obj->getOwner(); - return (dbModITerm*) par->_moditerm_tbl->getPtr(obj->_next_net_moditerm); -} - -void dbModITerm::setPrevNetModiterm(dbModITerm* prev_net_moditerm) -{ - _dbModITerm* obj = (_dbModITerm*) this; - - obj->_prev_net_moditerm = prev_net_moditerm->getImpl()->getOID(); -} - -dbModITerm* dbModITerm::getPrevNetModiterm() const -{ - _dbModITerm* obj = (_dbModITerm*) this; - if (obj->_prev_net_moditerm == 0) { - return nullptr; - } - _dbBlock* par = (_dbBlock*) obj->getOwner(); - return (dbModITerm*) par->_moditerm_tbl->getPtr(obj->_prev_net_moditerm); -} - -void dbModITerm::setNextEntry(dbModITerm* next_entry) -{ - _dbModITerm* obj = (_dbModITerm*) this; - - obj->_next_entry = next_entry->getImpl()->getOID(); -} - -dbModITerm* dbModITerm::getNextEntry() const -{ - _dbModITerm* obj = (_dbModITerm*) this; - if (obj->_next_entry == 0) { - return nullptr; - } - _dbBlock* par = (_dbBlock*) obj->getOwner(); - return (dbModITerm*) par->_moditerm_tbl->getPtr(obj->_next_entry); -} - // User Code Begin dbModITermPublicMethods -void dbModITerm::setFlags(uint flags) -{ - _dbModITerm* obj = (_dbModITerm*) this; - - obj->_flags = flags; -} - -uint dbModITerm::getFlags() const -{ - _dbModITerm* obj = (_dbModITerm*) this; - return obj->_flags; -} - -struct dbModITermFlags_str -{ - dbIoType::Value _iotype : 4; - dbSigType::Value _sigtype : 4; - uint _spare_bits : 24; -}; - -typedef union dbModITermFlags -{ - struct dbModITermFlags_str flags; - uint uint_val; -} dbModITermFlagsU; - -void dbModITerm::setSigType(dbSigType& type) -{ - dbModITermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); - cur_flags.flags._sigtype = type.getValue(); - setFlags(cur_flags.uint_val); -} - -dbSigType dbModITerm::getSigType() -{ - dbModITermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); - return dbSigType(cur_flags.flags._sigtype); -} - -void dbModITerm::setIoType(dbIoType& type) -{ - dbModITermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); - cur_flags.flags._iotype = type.getValue(); - setFlags(cur_flags.uint_val); -} - -dbIoType dbModITerm::getIoType() -{ - dbModITermFlagsU cur_flags; - cur_flags.uint_val = getFlags(); - return dbIoType(cur_flags.flags._iotype); -} dbModITerm* dbModITerm::create(dbModInst* parentInstance, const char* name) { @@ -303,11 +195,6 @@ dbModITerm* dbModITerm::create(dbModInst* parentInstance, const char* name) moditerm->_next_net_moditerm = 0; moditerm->_prev_net_moditerm = 0; - ((dbModITerm*) moditerm)->setFlags(0U); - dbIoType io_typ = dbIoType::INPUT; - ((dbModITerm*) moditerm)->setIoType(io_typ); - dbSigType sig_typ = dbSigType::SIGNAL; - ((dbModITerm*) moditerm)->setSigType(sig_typ); moditerm->_name = strdup(name); ZALLOCATED(moditerm->_name); @@ -324,9 +211,8 @@ bool dbModITerm::connect(dbModNet* net) _dbModNet* _modnet = (_dbModNet*) net; _dbBlock* _block = (_dbBlock*) _moditerm->getOwner(); // already connected. - if (_moditerm->_net == _modnet->getId()) { + if (_moditerm->_net == _modnet->getId()) return true; - } _moditerm->_net = _modnet->getId(); // append to net moditerms if (_modnet->_moditerms != 0) { @@ -343,12 +229,6 @@ bool dbModITerm::connect(dbModNet* net) return true; } -char* dbModITerm::getName() -{ - _dbModITerm* _iterm = (_dbModITerm*) this; - return _iterm->_name; -} - // User Code End dbModITermPublicMethods } // namespace odb // Generator Code End Cpp diff --git a/src/odb/src/db/dbModITerm.h b/src/odb/src/db/dbModITerm.h index b446cc1f4ee..9b793dcc07c 100644 --- a/src/odb/src/db/dbModITerm.h +++ b/src/odb/src/db/dbModITerm.h @@ -61,7 +61,6 @@ class _dbModITerm : public _dbObject void out(dbDiff& diff, char side, const char* field) const; char* _name; - uint _flags; dbId<_dbModInst> _parent; dbId<_dbModNet> _net; dbId<_dbModITerm> _next_net_moditerm; diff --git a/src/odb/src/db/dbModNet.cpp b/src/odb/src/db/dbModNet.cpp index d0550270e13..cb0ee10d85e 100644 --- a/src/odb/src/db/dbModNet.cpp +++ b/src/odb/src/db/dbModNet.cpp @@ -197,6 +197,14 @@ dbModNet* dbModNet::create(dbModule* parentModule, const char* name) modnet->_parent = parent->getOID(); // dbmodule modnet->_next_entry = parent->_modnets; parent->_modnets = modnet->getOID(); + // printf("Creating modnet %s (%u) in %s (%p)\n", + // modnet -> _name, + // modnet -> getOID(), + // ((dbModule*)parent) -> getName(), + // ((dbModule*)parent) + // ); + // dbSet modnets = ((dbModule*)parent) -> getModNets(); + // printf("# modnets %u\n",modnets.size()); return (dbModNet*) modnet; } @@ -228,18 +236,6 @@ dbSet dbModNet::getITerms() return dbSet(_mod_net, _block->_module_modnet_iterm_itr); } -dbModBTerm* dbModNet::connectedToModBTerm() -{ - const char* net_name = getName(); - dbSet modbterms = getModBTerms(); - for (dbModBTerm* mbterm : modbterms) { - const char* mbterm_name = mbterm->getName(); - if (!strcmp(mbterm_name, net_name)) - return mbterm; - } - return nullptr; -} - // User Code End dbModNetPublicMethods } // namespace odb // Generator Code End Cpp diff --git a/src/odb/src/db/dbModule.cpp b/src/odb/src/db/dbModule.cpp index 280b9db8c54..a0abdebf608 100644 --- a/src/odb/src/db/dbModule.cpp +++ b/src/odb/src/db/dbModule.cpp @@ -206,40 +206,18 @@ dbModInst* dbModule::getModInst() const // User Code Begin dbModulePublicMethods -std::string dbModule::getHierarchicalName(std::string& separator) -{ - std::string ret = hierarchicalNameR(separator); - // strip out the top module name - size_t first_ix = ret.find_first_of('/'); - if (first_ix != std::string::npos) - ret = ret.substr(first_ix + 1); - return ret; -} - -std::string dbModule::hierarchicalNameR(std::string& separator) -{ - dbBlock* block = getOwner(); - if (this == block->getTopModule()) { - return (std::string(getName())); - } - dbModInst* local_inst = getModInst(); - std::string local_name = local_inst->getName(); - dbModule* parent = local_inst->getParent(); - return parent->hierarchicalNameR(separator) + separator + local_name; -} - -unsigned dbModule::getModInstCount() +int dbModule::getModInstCount() { _dbModule* module = (_dbModule*) this; _dbBlock* block = (_dbBlock*) module->getOwner(); - return (dbSet(module, block->_module_modinst_itr)).size(); + return (int) ((dbSet(module, block->_module_modinst_itr)).size()); } -unsigned dbModule::getDbInstCount() +int dbModule::getDbInstCount() { _dbModule* module = (_dbModule*) this; _dbBlock* block = (_dbBlock*) module->getOwner(); - return dbSet(module, block->_module_inst_itr).size(); + return (int) (dbSet(module, block->_module_inst_itr).size()); } void dbModule::addInst(dbInst* inst) @@ -476,18 +454,6 @@ dbModBTerm* dbModule::findModBTerm(const char* name) return nullptr; } -bool dbModule::findPortIx(const char* port_name, unsigned& ix) -{ - std::string port_name_str(port_name); - ix = 0; - for (dbModBTerm* mod_bterm : getModBTerms()) { - if (!strcmp(mod_bterm->getName(), port_name)) - return true; - ix++; - } - return false; -} - std::string dbModule::getHierarchicalName() const { dbModInst* inst = getModInst(); diff --git a/src/odb/src/db/dbModuleModBTermItr.cpp b/src/odb/src/db/dbModuleModBTermItr.cpp index e8cd6a80b52..4f1d3c18ad2 100644 --- a/src/odb/src/db/dbModuleModBTermItr.cpp +++ b/src/odb/src/db/dbModuleModBTermItr.cpp @@ -33,6 +33,7 @@ // Generator Code Begin Cpp #include "dbModuleModBTermItr.h" +#include "dbModBTerm.h" #include "dbModBTerm.h" #include "dbModule.h" #include "dbTable.h" diff --git a/src/odb/src/db/dbModuleModInstItr.cpp b/src/odb/src/db/dbModuleModInstItr.cpp index ef8839cf6d3..ffd37cc1f25 100644 --- a/src/odb/src/db/dbModuleModInstItr.cpp +++ b/src/odb/src/db/dbModuleModInstItr.cpp @@ -33,6 +33,7 @@ // Generator Code Begin Cpp #include "dbModuleModInstItr.h" +#include "dbModInst.h" #include "dbModInst.h" #include "dbModule.h" #include "dbTable.h" diff --git a/src/odb/src/db/dbModuleModInstModITermItr.cpp b/src/odb/src/db/dbModuleModInstModITermItr.cpp index 57b25065653..bda5f096fe9 100644 --- a/src/odb/src/db/dbModuleModInstModITermItr.cpp +++ b/src/odb/src/db/dbModuleModInstModITermItr.cpp @@ -33,6 +33,7 @@ // Generator Code Begin Cpp #include "dbModuleModInstModITermItr.h" +#include "dbModITerm.h" #include "dbModITerm.h" #include "dbModInst.h" #include "dbModule.h" diff --git a/src/odb/src/db/dbModuleModNetItr.cpp b/src/odb/src/db/dbModuleModNetItr.cpp index 16de8605bf1..723934d7cb4 100644 --- a/src/odb/src/db/dbModuleModNetItr.cpp +++ b/src/odb/src/db/dbModuleModNetItr.cpp @@ -33,6 +33,7 @@ // Generator Code Begin Cpp #include "dbModuleModNetItr.h" +#include "dbModNet.h" #include "dbModNet.h" #include "dbModule.h" #include "dbTable.h"