diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index e515da4e282..4ccb8bb2d23 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -421,7 +421,7 @@ const char* dbNetwork::name(const Instance* instance) const if (db_inst) { return tmpStringCopy(db_inst->getConstName()); } - return tmpStringCopy(mod_inst->getName().c_str()); + return tmpStringCopy(mod_inst->getName()); } Cell* dbNetwork::cell(const Instance* instance) const diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index b4b1c5ad27d..bfafe8275ec 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -136,7 +136,10 @@ class dbIsolation; class dbLevelShifter; class dbLogicPort; class dbMetalWidthViaMap; +class dbModBTerm; class dbModInst; +class dbModITerm; +class dbModNet; class dbModule; class dbNetTrack; class dbPowerDomain; @@ -863,7 +866,7 @@ class dbBlock : public dbObject /// Get block chip name. /// std::string getName(); - + void dumpDebug(); /// /// Get the block chip name. /// @@ -910,6 +913,8 @@ 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. @@ -946,6 +951,8 @@ class dbBlock : public dbObject /// Get the modinsts of this block. /// dbSet getModInsts(); + dbSet getModNets(); + dbSet getModBTerms(); /// /// Get the Power Domains of this block. @@ -1719,6 +1726,9 @@ class dbBTerm : public dbObject /// dbNet* getNet(); + // AF + dbModNet* getModNet(); + /// Disconnect the block-terminal from it's net. /// void disconnect(); @@ -1726,6 +1736,7 @@ class dbBTerm : public dbObject /// Connect the block-terminal to net. /// void connect(dbNet* net); + void connect(dbModNet* mod_net); /// /// Get the block of this block-terminal. @@ -3227,11 +3238,13 @@ class dbInst : public dbObject /// 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 dbmodule is non null the dbInst is added to that module. + static dbInst* create(dbBlock* block, dbMaster* master, const char* name, - bool physical_only = false); + bool physical_only = false, + dbModule* = nullptr); /// /// Create a new instance within the specified region. @@ -3239,12 +3252,16 @@ class dbInst : public dbObject /// 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 + static dbInst* create(dbBlock* block, dbMaster* master, const char* name, dbRegion* region, - bool physical_only = false); + bool physical_only = false, + dbModule* parent_module = nullptr + + ); /// /// Create a new instance of child_block in top_block. @@ -3298,6 +3315,9 @@ class dbITerm : public dbObject /// dbNet* getNet(); + // AF + dbModNet* getModNet(); + /// /// Get the master-terminal that this instance-terminal is representing. /// @@ -3449,6 +3469,10 @@ class dbITerm : public dbObject /// void connect(dbNet* net); + // connect this iterm to a dbmodNet + // AF. + void connect(dbModNet* net); + /// /// Disconnect this iterm from the net it is connected to. /// @@ -7456,9 +7480,58 @@ class dbMetalWidthViaMap : public dbObject // User Code End dbMetalWidthViaMap }; +class dbModBTerm : public dbObject +{ + public: + const char* getName() const; + + dbModule* getParent() const; + + void setNet(dbModNet* net); + + 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); + dbSigType getSigType(); + void setIoType(dbIoType type); + dbIoType getIoType(); + + static dbModBTerm* create(dbModule* parentModule, const char* name); + + void connect(dbModNet*); + void disconnect(); + + char* getName(); + + void staSetPort(void* p); + void* staPort(); + + private: + void setFlags(uint flags); + uint getFlags() const; + + // User Code End dbModBTerm +}; + class dbModInst : public dbObject { public: + const char* getName() const; + dbModule* getParent() const; dbModule* getMaster() const; @@ -7476,30 +7549,99 @@ class dbModInst : public dbObject static dbModInst* getModInst(dbBlock* block_, uint dbid_); - std::string getName() const; - std::string getHierarchicalName() const; + + bool findModITerm(const char* name, dbModITerm*& ret); + + dbSet getModITerms(); + // User Code End dbModInst }; +class dbModITerm : public dbObject +{ + public: + 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(); + + 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 +}; + +class dbModNet : public dbObject +{ + public: + dbModule* getParent() const; + + // User Code Begin dbModNet + dbSet getModITerms(); + dbSet getModBTerms(); + dbSet getITerms(); + dbSet getBTerms(); + + static dbModNet* create(dbModule* parentModule, const char* name); + const char* getName() const; + dbModBTerm* connectedToModBTerm(); + // User Code End dbModNet +}; + class dbModule : public dbObject { public: const char* getName() const; + void setModInst(dbModInst* mod_inst); + dbModInst* getModInst() const; // User Code Begin dbModule - + std::string getHierarchicalName(std::string& separator); + std::string getHierarchicalName() const; + std::string hierarchicalNameR(std::string& separator); // Adding an inst to a new module will remove it from its previous // module. void addInst(dbInst* inst); - dbSet getInsts(); + dbBlock* getOwner(); dbSet getChildren(); + dbSet getModInsts(); + dbSet getModNets(); + dbModNet* getModNet(const char* net_name); + dbSet getModBTerms(); + dbSet getInsts(); dbModInst* findModInst(const char* name); + dbInst* findDbInst(const char* name); + dbModBTerm* findModBTerm(const char* name); std::vector getLeafInsts(); @@ -7509,7 +7651,15 @@ class dbModule : public dbObject static dbModule* getModule(dbBlock* block_, uint dbid_); - std::string getHierarchicalName() const; + unsigned getModInstCount(); + unsigned getDbInstCount(); + + bool findPortIx(const char* port_name, unsigned& ix); + + void staSetCell(void* cell); + void* getStaCell(); + + private: // User Code End dbModule }; diff --git a/src/odb/include/odb/dbObject.h b/src/odb/include/odb/dbObject.h index ddbf090990c..946ed626900 100644 --- a/src/odb/include/odb/dbObject.h +++ b/src/odb/include/odb/dbObject.h @@ -95,7 +95,10 @@ enum dbObjectType dbLevelShifterObj, dbLogicPortObj, dbMetalWidthViaMapObj, + dbModBTermObj, dbModInstObj, + dbModITermObj, + dbModNetObj, dbModuleObj, dbNetTrackObj, dbPowerDomainObj, diff --git a/src/odb/include/odb/dbStream.h b/src/odb/include/odb/dbStream.h index 39406d88c71..da39539b7c2 100644 --- a/src/odb/include/odb/dbStream.h +++ b/src/odb/include/odb/dbStream.h @@ -46,6 +46,7 @@ #include "map" #include "odb.h" #include "tuple" +#include "vector" namespace odb { @@ -191,7 +192,7 @@ class dbOStream return *this; } else { *this << std::get(tup); - return ((*this).operator<< (tup)); + return ((*this).operator<<(tup)); } } @@ -219,6 +220,17 @@ class dbOStream return *this; } + template + dbOStream& operator<<(const std::vector& m) + { + uint sz = m.size(); + *this << sz; + for (auto val : m) { + *this << val; + } + return *this; + } + template dbOStream& operator<<(const std::array& a) { @@ -249,12 +261,11 @@ class dbOStream *this << (uint32_t) v.index(); *this << std::get(v); } - return ((*this).operator<< (v)); + return ((*this).operator<<(v)); } } double lefarea(int value) { return ((double) value * _lef_area_factor); } - double lefdist(int value) { return ((double) value * _lef_dist_factor); } Position pos() const { return _f.tellp(); } @@ -420,6 +431,20 @@ class dbIStream } return *this; } + + template + dbIStream& operator>>(std::vector& m) + { + uint sz; + *this >> sz; + for (uint i = 0; i < sz; i++) { + T1 val; + *this >> val; + m.push_back(val); + } + return *this; + } + template dbIStream& operator>>(std::array& a) { diff --git a/src/odb/src/codeGenerator/schema.json b/src/odb/src/codeGenerator/schema.json index 40c45fdd001..495207d7604 100644 --- a/src/odb/src/codeGenerator/schema.json +++ b/src/odb/src/codeGenerator/schema.json @@ -17,7 +17,70 @@ "reversible": "true", "orderReversed": "true", "sequential": 0, - "includes": ["dbModule.h"] + "includes": ["dbModInst.h", "dbModule.h"] + }, + { + "name": "dbModuleModBTermItr", + "parentObject": "dbModBTerm", + "tableName": "modbterm_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModBTerm.h", "dbModule.h"] + }, + { + "name": "dbModuleModInstModITermItr", + "parentObject": "dbModITerm", + "tableName": "moditerm_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModITerm.h", "dbModule.h", "dbModInst.h"] + }, + { + "name": "dbModuleModNetItr", + "parentObject": "dbModNet", + "tableName": "modnet_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModNet.h","dbModule.h"] + }, + { + "name": "dbModuleModNetModITermItr", + "parentObject": "dbModITerm", + "tableName": "moditerm_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModNet.h","dbModule.h"] + }, + { + "name": "dbModuleModNetModBTermItr", + "parentObject": "dbModBTerm", + "tableName": "modbterm_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModNet.h","dbModule.h"] + }, + { + "name": "dbModuleModNetBTermItr", + "parentObject": "dbBTerm", + "tableName": "bterm_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModNet.h", "dbModule.h"] + }, + { + "name": "dbModuleModNetITermItr", + "parentObject": "dbITerm", + "tableName": "iterm_tbl", + "reversible": "true", + "orderReversed": "true", + "sequential": 0, + "includes": ["dbModNet.h", "dbModule.h"] }, { "name": "dbGroupModInstItr", diff --git a/src/odb/src/codeGenerator/schema/chip/dbModBterm.json b/src/odb/src/codeGenerator/schema/chip/dbModBterm.json new file mode 100644 index 00000000000..6adea6a6771 --- /dev/null +++ b/src/odb/src/codeGenerator/schema/chip/dbModBterm.json @@ -0,0 +1,44 @@ +{ + "name":"dbModBTerm", + "type":"dbObject", + "fields":[ + { + "name":"_name", + "type":"char *", + "flags":["no-set"] + }, + { + "name":"_flags", + "type":"uint", + "flags":["no-set","no-get"] + }, + { + "name":"_parent", + "type":"dbId<_dbModule>", + "flags":["no-set"], + "parent":"dbBlock" + }, + { + "name":"_net", + "type":"dbId<_dbModNet>", + "parent":"dbBlock" + }, + { + "name":"_next_net_modbterm", + "type":"dbId<_dbModBTerm>", + "parent":"dbBlock" + }, + { + "name":"_prev_net_modbterm", + "type":"dbId<_dbModBTerm>", + "parent":"dbBlock" + }, + { + "name":"_next_entry", + "type":"dbId<_dbModBTerm>", + "parent":"dbBlock" + } + ], + "constructors":[], + "cpp_includes":["dbBlock.h","dbModule.h","dbModNet.h","dbHashTable.hpp"] +} diff --git a/src/odb/src/codeGenerator/schema/chip/dbModInst.json b/src/odb/src/codeGenerator/schema/chip/dbModInst.json index 522c9e4f871..db8fafb8aa5 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModInst.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModInst.json @@ -1,47 +1,56 @@ { - "name":"dbModInst", - "type":"dbObject", - "fields":[ - { - "name":"_name", - "type":"char *", - "flags":["no-set","no-get"] - }, - { - "name":"_next_entry", - "type":"dbId<_dbModInst>", - "flags":["no-set","no-get"] - }, - { - "name":"_parent", - "type":"dbId<_dbModule>", - "flags":["no-set"], - "parent":"dbBlock" - }, - { - "name":"_module_next", - "type":"dbId<_dbModInst>", - "flags":["no-get","no-set"], - "parent":"dbBlock" - }, - { - "name":"_master", - "type":"dbId<_dbModule>", - "flags":["no-set"], - "parent":"dbBlock" - }, - { - "name":"_group_next", - "type":"dbId<_dbModInst>", - "flags":["no-get","no-set"], - "parent":"dbBlock" - }, - { - "name":"_group", - "type":"dbId<_dbGroup>", - "flags":["no-set"], - "parent":"dbBlock" - } - ], - "cpp_includes":["dbBlock.h","dbModule.h","dbHashTable.hpp"] + "name":"dbModInst", + "type":"dbObject", + "fields":[ + { + "name":"_name", + "type":"char *", + "flags":["no-set"] + }, + { + "name":"_next_entry", + "type":"dbId<_dbModInst>", + "flags":["no-set","no-get"] + }, + { + "name":"_parent", + "type":"dbId<_dbModule>", + "flags":["no-set"], + "parent":"dbBlock" }, + { + "name":"_module_next", + "type":"dbId<_dbModInst>", + "flags":["no-get","no-set"], + "parent":"dbBlock" + }, + { + "name":"_master", + "type":"dbId<_dbModule>", + "flags":["no-set"], + "parent":"dbBlock" + }, + { + "name":"_group_next", + "type":"dbId<_dbModInst>", + "flags":["no-get","no-set"], + "parent":"dbBlock" + }, + { + "name":"_group", + "type":"dbId<_dbGroup>", + "flags":["no-set"], + "parent":"dbBlock" + }, + { + "name":"_moditerms", + "type":"dbId<_dbModITerm >", + "flags":["no-get","no-set"], + "parent":"dbBlock" + } + ], + "cpp_includes":["dbBlock.h","dbModule.h","dbHashTable.hpp", "dbModITerm.h"], + "h_includes": [ + "dbVector.h", + "dbSet.h" + ] } diff --git a/src/odb/src/codeGenerator/schema/chip/dbModIterm.json b/src/odb/src/codeGenerator/schema/chip/dbModIterm.json new file mode 100644 index 00000000000..75ec73a66e4 --- /dev/null +++ b/src/odb/src/codeGenerator/schema/chip/dbModIterm.json @@ -0,0 +1,45 @@ +{ + "name":"dbModITerm", + "type":"dbObject", + "fields":[ + { + "name":"_name", + "type":"char *", + "flags":["no-set","no-get"] + }, + { + "name":"_flags", + "type":"uint", + "flags":["no-set","no-get"] + }, + { + "name":"_parent", + "type":"dbId<_dbModInst>", + "flags":["no-set"], + "parent":"dbBlock" + }, + { + "name":"_net", + "type":"dbId<_dbModNet>", + "parent":"dbBlock" + }, + { + "name":"_next_net_moditerm", + "type":"dbId<_dbModITerm>", + "parent":"dbBlock" + }, + { + "name":"_prev_net_moditerm", + "type":"dbId<_dbModITerm>", + "parent":"dbBlock" + }, + { + "name":"_next_entry", + "type":"dbId<_dbModITerm>", + "parent":"dbBlock" + } + + ], + "constructors":[], + "cpp_includes":["dbBlock.h","dbModInst.h","dbModNet.h","dbHashTable.hpp"] +} diff --git a/src/odb/src/codeGenerator/schema/chip/dbModNet.json b/src/odb/src/codeGenerator/schema/chip/dbModNet.json new file mode 100644 index 00000000000..5b13841789a --- /dev/null +++ b/src/odb/src/codeGenerator/schema/chip/dbModNet.json @@ -0,0 +1,49 @@ + { + "name":"dbModNet", + "type":"dbObject", + "fields":[ + { + "name":"_name", + "type":"char *", + "flags":["no-set","no-get"] + }, + { + "name":"_parent", + "type":"dbId<_dbModule>", + "flags":["no-set"], + "parent":"dbBlock" + }, + { + "name":"_next_entry", + "type":"dbId<_dbModNet>", + "flags":["no-set","no-get"] + }, + { + "name": "_moditerms", + "type": "dbId<_dbModITerm>", + "flags":["no-set","no-get"] + }, + { + "name": "_modbterms", + "type": "dbId<_dbModBTerm>", + "flags":["no-set","no-get"] + }, + { + "name": "_iterms", + "type": "dbId<_dbITerm>", + "flags":["no-set","no-get"] + }, + { + "name": "_bterms", + "type": "dbId<_dbBTerm>", + "flags":["no-set","no-get"] + } + + ], + "constructors":[], + "cpp_includes":["dbBlock.h","dbVector.h","dbModule.h","dbModInst.h","dbITerm.h", "dbModITerm.h","dbModBTerm.h","dbHashTable.hpp"], + "h_includes": [ + "dbVector.h" + ] + + } diff --git a/src/odb/src/codeGenerator/schema/chip/dbModule.json b/src/odb/src/codeGenerator/schema/chip/dbModule.json index f18d59a48ae..10e48e66023 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModule.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModule.json @@ -1,35 +1,51 @@ { - "name":"dbModule", - "type":"dbObject", - "fields":[ - { - "name":"_name", - "type":"char *", - "flags":["no-set"] - }, - { - "name":"_next_entry", - "type":"dbId<_dbModule>", - "flags":["no-set","no-get"] - }, - { - "name":"_insts", - "type":"dbId<_dbInst>", - "flags":["no-set","no-get"], - "parent":"dbBlock" - }, - { - "name":"_modinsts", - "type":"dbId<_dbModInst>", - "flags":["no-set","no-get"], - "parent":"dbBlock" - }, - { - "name":"_mod_inst", - "type":"dbId<_dbModInst>", - "flags":["no-set"], - "parent":"dbBlock" - } - ], - "cpp_includes":["dbBlock.h","dbHashTable.hpp"] + "name":"dbModule", + "type":"dbObject", + "fields":[ + { + "name":"_name", + "type":"char *", + "flags":["no-set"] + }, + { + "name":"_next_entry", + "type":"dbId<_dbModule>", + "flags":["no-set","no-get"] + }, + { + "name":"_insts", + "type":"dbId<_dbInst>", + "flags":["no-set","no-get"], + "parent":"dbBlock" + }, + { + "name":"_mod_inst", + "type":"dbId<_dbModInst>", + "parent":"dbBlock" + }, + { + "name":"_modinsts", + "type":"dbId<_dbModInst>", + "flags":["no-set","no-get"], + "parent":"dbBlock" + }, + { + "name":"_modnets", + "type":"dbId<_dbModNet>", + "flags":["no-set","no-get"], + "parent":"dbBlock" + }, + { + "name":"_modbterms", + "type":"dbId<_dbModBTerm>", + "flags":["no-set","no-get"] + } + ], + "cpp_includes":["dbBlock.h","dbHashTable.hpp", "dbModBTerm.h", "dbModInst.h", "dbInst.h"], + "h_includes": [ + "dbVector.h", + "dbSet.h" + ] } + + diff --git a/src/odb/src/db/CMakeLists.txt b/src/odb/src/db/CMakeLists.txt index f68474f7e3d..c38d64e567c 100644 --- a/src/odb/src/db/CMakeLists.txt +++ b/src/odb/src/db/CMakeLists.txt @@ -96,7 +96,10 @@ add_library(db dbLevelShifter.cpp dbLogicPort.cpp dbMetalWidthViaMap.cpp + dbModBTerm.cpp dbModInst.cpp + dbModITerm.cpp + dbModNet.cpp dbModule.cpp dbNetTrack.cpp dbPowerDomain.cpp @@ -129,7 +132,14 @@ add_library(db dbGroupModInstItr.cpp dbGuideItr.cpp dbModuleInstItr.cpp + dbModuleModBTermItr.cpp dbModuleModInstItr.cpp + dbModuleModInstModITermItr.cpp + dbModuleModNetBTermItr.cpp + dbModuleModNetITermItr.cpp + dbModuleModNetItr.cpp + dbModuleModNetModBTermItr.cpp + dbModuleModNetModITermItr.cpp dbNetTrackItr.cpp dbRegionGroupItr.cpp # Generator Code End cpp diff --git a/src/odb/src/db/dbBTerm.cpp b/src/odb/src/db/dbBTerm.cpp index 0b15546a0c7..9f01ea4ba95 100644 --- a/src/odb/src/db/dbBTerm.cpp +++ b/src/odb/src/db/dbBTerm.cpp @@ -51,6 +51,7 @@ #include "dbJournal.h" #include "dbMTerm.h" #include "dbMaster.h" +#include "dbModNet.h" #include "dbNet.h" #include "dbShape.h" #include "dbTable.h" @@ -209,6 +210,8 @@ void _dbBTerm::differences(dbDiff& diff, DIFF_FIELD_NO_DEEP(_next_bterm); DIFF_FIELD_NO_DEEP(_prev_bterm); + DIFF_FIELD_NO_DEEP(_next_modnet_bterm); + DIFF_FIELD_NO_DEEP(_prev_modnet_bterm); DIFF_FIELD_NO_DEEP(_parent_block); DIFF_FIELD_NO_DEEP(_parent_iterm); DIFF_FIELD_NO_DEEP(_bpins); @@ -239,6 +242,8 @@ void _dbBTerm::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD_NO_DEEP(_next_bterm); DIFF_OUT_FIELD_NO_DEEP(_prev_bterm); + DIFF_OUT_FIELD_NO_DEEP(_next_modnet_bterm); + DIFF_OUT_FIELD_NO_DEEP(_prev_modnet_bterm); DIFF_OUT_FIELD_NO_DEEP(_parent_block); DIFF_OUT_FIELD_NO_DEEP(_parent_iterm); DIFF_OUT_FIELD_NO_DEEP(_bpins); @@ -255,8 +260,11 @@ dbOStream& operator<<(dbOStream& stream, const _dbBTerm& bterm) stream << bterm._name; stream << bterm._next_entry; stream << bterm._net; + stream << bterm._mnet; stream << bterm._next_bterm; stream << bterm._prev_bterm; + stream << bterm._next_modnet_bterm; + stream << bterm._prev_modnet_bterm; stream << bterm._parent_block; stream << bterm._parent_iterm; stream << bterm._bpins; @@ -273,8 +281,11 @@ dbIStream& operator>>(dbIStream& stream, _dbBTerm& bterm) stream >> bterm._name; stream >> bterm._next_entry; stream >> bterm._net; + stream >> bterm._mnet; stream >> bterm._next_bterm; stream >> bterm._prev_bterm; + stream >> bterm._next_modnet_bterm; + stream >> bterm._prev_modnet_bterm; stream >> bterm._parent_block; stream >> bterm._parent_iterm; stream >> bterm._bpins; @@ -428,6 +439,34 @@ dbNet* dbBTerm::getNet() return nullptr; } +dbModNet* dbBTerm::getModNet() +{ + _dbBTerm* bterm = (_dbBTerm*) this; + if (bterm->_mnet) { + _dbBlock* block = (_dbBlock*) getBlock(); + _dbModNet* net = block->_modnet_tbl->getPtr(bterm->_mnet); + return (dbModNet*) net; + } + return nullptr; +} + +void dbBTerm::connect(dbModNet* mod_net) +{ + dbModule* parent_module = mod_net->getParent(); + _dbBlock* block = (_dbBlock*) (parent_module->getOwner()); + _dbModNet* _mod_net = (_dbModNet*) mod_net; + _dbBTerm* bterm = (_dbBTerm*) this; + if (bterm->_mnet == _mod_net->getId()) + return; + + if (bterm->_mnet) { + bterm->disconnectModNet(bterm, block); + } + bterm->connectModNet(_mod_net, block); + // printf("Mod net now connected to %d bterms\n", + // mod_net -> getBTerms().size()); +} + void dbBTerm::connect(dbNet* net_) { _dbBTerm* bterm = (_dbBTerm*) this; @@ -713,6 +752,24 @@ dbBTerm* dbBTerm::create(dbNet* net_, const char* name) return (dbBTerm*) bterm; } +void _dbBTerm::connectModNet(_dbModNet* mod_net, _dbBlock* block) +{ + // printf("Connecting mod net %s to bterm %s\n", ((dbModNet*)mod_net) -> + // getName(), + // _name + // ); + _mnet = mod_net->getOID(); + if (mod_net->_bterms != 0) { + _dbBTerm* head = block->_bterm_tbl->getPtr(mod_net->_bterms); + _next_modnet_bterm = mod_net->_bterms; + head->_prev_modnet_bterm = getOID(); + } else { + _next_modnet_bterm = 0; + } + _prev_modnet_bterm = 0; + mod_net->_bterms = getOID(); +} + void _dbBTerm::connectNet(_dbNet* net, _dbBlock* block) { for (auto callback : block->_callbacks) { @@ -812,6 +869,29 @@ void _dbBTerm::disconnectNet(_dbBTerm* bterm, _dbBlock* block) } } +void _dbBTerm::disconnectModNet(_dbBTerm* bterm, _dbBlock* block) +{ + _dbModNet* mod_net = block->_modnet_tbl->getPtr(bterm->_mnet); + uint id = bterm->getOID(); + if (mod_net->_bterms == id) { + mod_net->_bterms = bterm->_next_modnet_bterm; + if (mod_net->_bterms != 0) { + _dbBTerm* t = block->_bterm_tbl->getPtr(mod_net->_bterms); + t->_prev_modnet_bterm = 0; + } + } else { + if (bterm->_next_modnet_bterm != 0) { + _dbBTerm* next = block->_bterm_tbl->getPtr(bterm->_next_modnet_bterm); + next->_prev_modnet_bterm = bterm->_prev_modnet_bterm; + } + if (bterm->_prev_modnet_bterm != 0) { + _dbBTerm* prev = block->_bterm_tbl->getPtr(bterm->_prev_modnet_bterm); + prev->_next_modnet_bterm = bterm->_next_modnet_bterm; + } + } + _mnet = 0; +} + dbSet::iterator dbBTerm::destroy(dbSet::iterator& itr) { dbBTerm* bt = *itr; diff --git a/src/odb/src/db/dbBTerm.h b/src/odb/src/db/dbBTerm.h index ef2b696c9ac..eac5a111c6d 100644 --- a/src/odb/src/db/dbBTerm.h +++ b/src/odb/src/db/dbBTerm.h @@ -43,6 +43,7 @@ namespace odb { class _dbNet; +class _dbModNet; class _dbBox; class _dbBlock; class _dbBPin; @@ -80,8 +81,11 @@ class _dbBTerm : public _dbObject char* _name; dbId<_dbBTerm> _next_entry; dbId<_dbNet> _net; + dbId<_dbModNet> _mnet; dbId<_dbBTerm> _next_bterm; dbId<_dbBTerm> _prev_bterm; + dbId<_dbBTerm> _next_modnet_bterm; + dbId<_dbBTerm> _prev_modnet_bterm; dbId<_dbBlock> _parent_block; // Up hierarchy: TWG dbId<_dbITerm> _parent_iterm; // Up hierarchy: TWG dbId<_dbBPin> _bpins; // Up hierarchy: TWG @@ -94,7 +98,10 @@ class _dbBTerm : public _dbObject ~_dbBTerm(); void connectNet(_dbNet* net, _dbBlock* block); + void connectModNet(_dbModNet* net, _dbBlock* block); void disconnectNet(_dbBTerm* bterm, _dbBlock* block); + void disconnectModNet(_dbBTerm* bterm, _dbBlock* block); + bool operator==(const _dbBTerm& rhs) const; bool operator!=(const _dbBTerm& rhs) const { return !operator==(rhs); } bool operator<(const _dbBTerm& rhs) const; diff --git a/src/odb/src/db/dbBlock.cpp b/src/odb/src/db/dbBlock.cpp index e2b40c22e82..32407fdaf8d 100644 --- a/src/odb/src/db/dbBlock.cpp +++ b/src/odb/src/db/dbBlock.cpp @@ -84,10 +84,20 @@ #include "dbJournal.h" #include "dbLevelShifter.h" #include "dbLogicPort.h" +#include "dbModBTerm.h" +#include "dbModITerm.h" #include "dbModInst.h" +#include "dbModNet.h" #include "dbModule.h" #include "dbModuleInstItr.h" +#include "dbModuleModBTermItr.h" #include "dbModuleModInstItr.h" +#include "dbModuleModInstModITermItr.h" +#include "dbModuleModNetBTermItr.h" +#include "dbModuleModNetITermItr.h" +#include "dbModuleModNetItr.h" +#include "dbModuleModNetModBTermItr.h" +#include "dbModuleModNetModITermItr.h" #include "dbNameCache.h" #include "dbNet.h" #include "dbNetTrack.h" @@ -191,6 +201,15 @@ _dbBlock::_dbBlock(_dbDatabase* db) _modinst_tbl = new dbTable<_dbModInst>( db, this, (GetObjTbl_t) &_dbBlock::getObjectTable, dbModInstObj); + _modbterm_tbl = new dbTable<_dbModBTerm>( + db, this, (GetObjTbl_t) &_dbBlock::getObjectTable, dbModBTermObj); + + _moditerm_tbl = new dbTable<_dbModITerm>( + db, this, (GetObjTbl_t) &_dbBlock::getObjectTable, dbModITermObj); + + _modnet_tbl = new dbTable<_dbModNet>( + db, this, (GetObjTbl_t) &_dbBlock::getObjectTable, dbModNetObj); + _powerdomain_tbl = new dbTable<_dbPowerDomain>( db, this, (GetObjTbl_t) &_dbBlock::getObjectTable, dbPowerDomainObj); @@ -318,6 +337,9 @@ _dbBlock::_dbBlock(_dbDatabase* db) _inst_hash.setTable(_inst_tbl); _module_hash.setTable(_module_tbl); _modinst_hash.setTable(_modinst_tbl); + _modbterm_hash.setTable(_modbterm_tbl); + _moditerm_hash.setTable(_moditerm_tbl); + _modnet_hash.setTable(_modnet_tbl); _powerdomain_hash.setTable(_powerdomain_tbl); _logicport_hash.setTable(_logicport_tbl); _powerswitch_hash.setTable(_powerswitch_tbl); @@ -351,6 +373,17 @@ _dbBlock::_dbBlock(_dbDatabase* db) _module_modinst_itr = new dbModuleModInstItr(_modinst_tbl); + _module_modinstmoditerm_itr = new dbModuleModInstModITermItr(_moditerm_tbl); + + _module_modbterm_itr = new dbModuleModBTermItr(_modbterm_tbl); + + _module_modnet_itr = new dbModuleModNetItr(_modnet_tbl); + + _module_modnet_modbterm_itr = new dbModuleModNetModBTermItr(_modbterm_tbl); + _module_modnet_moditerm_itr = new dbModuleModNetModITermItr(_moditerm_tbl); + _module_modnet_iterm_itr = new dbModuleModNetITermItr(_iterm_tbl); + _module_modnet_bterm_itr = new dbModuleModNetBTermItr(_bterm_tbl); + _region_group_itr = new dbRegionGroupItr(_group_tbl); _group_itr = new dbGroupItr(_group_tbl); @@ -898,6 +931,9 @@ dbOStream& operator<<(dbOStream& stream, const _dbBlock& block) stream << block._inst_hash; stream << block._module_hash; stream << block._modinst_hash; + stream << block._modbterm_hash; + stream << block._moditerm_hash; + stream << block._modnet_hash; stream << block._powerdomain_hash; stream << block._logicport_hash; stream << block._powerswitch_hash; @@ -912,40 +948,46 @@ dbOStream& operator<<(dbOStream& stream, const _dbBlock& block) stream << block._children; stream << block._component_mask_shift; stream << block._currentCcAdjOrder; - stream << NamedTable("bterm_tbl", block._bterm_tbl); - stream << NamedTable("iterm_tbl", block._iterm_tbl); - stream << NamedTable("net_tbl", block._net_tbl); - stream << NamedTable("inst_hdr_tbl", block._inst_hdr_tbl); - stream << NamedTable("inst_tbl", block._inst_tbl); - stream << NamedTable("module_tbl", block._module_tbl); - stream << NamedTable("modinst_tbl", block._modinst_tbl); - stream << NamedTable("powerdomain_tbl", block._powerdomain_tbl); - stream << NamedTable("logicport_tbl", block._logicport_tbl); - stream << NamedTable("powerswitch_tbl", block._powerswitch_tbl); - stream << NamedTable("isolation_tbl", block._isolation_tbl); - stream << NamedTable("levelshifter_tbl", block._levelshifter_tbl); - stream << NamedTable("group_tbl", block._group_tbl); - stream << NamedTable("ap_tbl", block.ap_tbl_); - stream << NamedTable("global_connect_tbl", block.global_connect_tbl_); - stream << NamedTable("guide_tbl", block._guide_tbl); - stream << NamedTable("net_tracks_tbl", block._net_tracks_tbl); - stream << NamedTable("box_tbl", block._box_tbl); - stream << NamedTable("via_tbl", block._via_tbl); - stream << NamedTable("gcell_grid_tbl", block._gcell_grid_tbl); - stream << NamedTable("track_grid_tbl", block._track_grid_tbl); - stream << NamedTable("obstruction_tbl", block._obstruction_tbl); - stream << NamedTable("blockage_tbl", block._blockage_tbl); - stream << NamedTable("wire_tbl", block._wire_tbl); - stream << NamedTable("swire_tbl", block._swire_tbl); - stream << NamedTable("sbox_tbl", block._sbox_tbl); - stream << NamedTable("row_tbl", block._row_tbl); - stream << NamedTable("fill_tbl", block._fill_tbl); - stream << NamedTable("region_tbl", block._region_tbl); - stream << NamedTable("hier_tbl", block._hier_tbl); - stream << NamedTable("bpin_tbl", block._bpin_tbl); - stream << NamedTable("non_default_rule_tbl", block._non_default_rule_tbl); - stream << NamedTable("layer_rule_tbl", block._layer_rule_tbl); - stream << NamedTable("prop_tbl", block._prop_tbl); + + stream << *block._bterm_tbl; + stream << *block._iterm_tbl; + stream << *block._net_tbl; + stream << *block._inst_hdr_tbl; + stream << *block._inst_tbl; + stream << *block._module_tbl; + stream << *block._modinst_tbl; + stream << *block._modbterm_tbl; + stream << *block._moditerm_tbl; + stream << *block._modnet_tbl; + + stream << *block._powerdomain_tbl; + stream << *block._logicport_tbl; + stream << *block._powerswitch_tbl; + stream << *block._isolation_tbl; + stream << *block._levelshifter_tbl; + stream << *block._group_tbl; + stream << *block.ap_tbl_; + stream << *block.global_connect_tbl_; + stream << *block._guide_tbl; + stream << *block._net_tracks_tbl; + stream << *block._box_tbl; + stream << *block._via_tbl; + stream << *block._gcell_grid_tbl; + stream << *block._track_grid_tbl; + stream << *block._obstruction_tbl; + stream << *block._blockage_tbl; + stream << *block._wire_tbl; + stream << *block._swire_tbl; + stream << *block._sbox_tbl; + stream << *block._row_tbl; + stream << *block._fill_tbl; + stream << *block._region_tbl; + stream << *block._hier_tbl; + stream << *block._bpin_tbl; + stream << *block._non_default_rule_tbl; + stream << *block._layer_rule_tbl; + stream << *block._prop_tbl; + stream << *block._name_cache; stream << *block._r_val_tbl; stream << *block._c_val_tbl; @@ -1002,6 +1044,9 @@ dbIStream& operator>>(dbIStream& stream, _dbBlock& block) stream >> block._inst_hash; stream >> block._module_hash; stream >> block._modinst_hash; + stream >> block._modbterm_hash; + stream >> block._moditerm_hash; + stream >> block._modnet_hash; stream >> block._powerdomain_hash; stream >> block._logicport_hash; stream >> block._powerswitch_hash; @@ -1033,6 +1078,9 @@ dbIStream& operator>>(dbIStream& stream, _dbBlock& block) stream >> *block._inst_tbl; stream >> *block._module_tbl; stream >> *block._modinst_tbl; + stream >> *block._modbterm_tbl; + stream >> *block._moditerm_tbl; + stream >> *block._modnet_tbl; stream >> *block._powerdomain_tbl; stream >> *block._logicport_tbl; stream >> *block._powerswitch_tbl; @@ -1755,6 +1803,18 @@ dbSet dbBlock::getModInsts() return dbSet(block, block->_modinst_tbl); } +dbSet dbBlock::getModBTerms() +{ + _dbBlock* block = (_dbBlock*) this; + return dbSet(block, block->_modbterm_tbl); +} + +dbSet dbBlock::getModNets() +{ + _dbBlock* block = (_dbBlock*) this; + return dbSet(block, block->_modnet_tbl); +} + dbSet dbBlock::getPowerDomains() { _dbBlock* block = (_dbBlock*) this; @@ -3999,4 +4059,178 @@ 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; + + printf("Debug: Data base tables for block at %p:\n", block); + + printf("Db nets (The Flat world)\n"); + for (auto dbnet : getNets()) { + printf("dbnet %s (id %u)\n", dbnet->getName().c_str(), dbnet->getId()); + dbNetITermItr dbnetiter(block->_iterm_tbl); + dbObject* parent = (dbObject*) dbnet; + uint id; + for (id = dbnetiter.begin(parent); id != dbnetiter.end(parent); + id = dbnetiter.next(id)) { + dbITerm* db_iterm = (dbITerm*) (block->_iterm_tbl->getPtr(id)); + printf("\t-> Db Iterm %u (%s)\n", id, db_iterm->getName().c_str()); + } + dbNetBTermItr dbnetbter(block->_bterm_tbl); + for (id = dbnetbter.begin(parent); id != dbnetbter.end(parent); + id = dbnetbter.next(id)) { + printf("\t-> Db Bterm %u\n", id); + } + } + printf("Block ports\n"); + // got through the ports and their owner + printf("\t\tBTerm Ports +++\n"); + dbSet block_bterms = getBTerms(); + for (auto bt : block_bterms) { + printf("\t\tBterm (%u) %s Net %s (%u) Mod Net %s (%u) \n", + bt->getId(), + bt->getName().c_str(), + bt->getNet() ? bt->getNet()->getName().c_str() : "", + bt->getNet() ? bt->getNet()->getId() : 0, + + bt->getModNet() ? bt->getModNet()->getName() : "", + bt->getModNet() ? bt->getModNet()->getId() : 0); + } + printf("\t\tBTerm Ports ---\n"); + + printf("The hierarchical world:\n"); + + if (block->_module_tbl) { + printf("module table %d\n", block->_module_tbl->size()); + dbSet block_modules = getModules(); + printf("Content size %u modules\n", block_modules.size()); + for (auto mi : block_modules) { + dbModule* cur_obj = mi; + if (cur_obj == getTopModule()) + printf("Top Module\n"); + printf("\tModule %s %s\n", + (cur_obj == getTopModule()) ? "(Top Module)" : "", + ((dbModule*) cur_obj)->getName()); + + // in case of top level, care as the bterms double up as pins + if (cur_obj == getTopModule()) { + for (auto bterm : getBTerms()) { + printf("Top B-term %s dbNet %s (%d) modNet %s (%d)\n", + bterm->getName().c_str(), + bterm->getNet() ? bterm->getNet()->getName().c_str() : "", + bterm->getNet() ? bterm->getNet()->getId() : -1, + bterm->getModNet() ? bterm->getModNet()->getName() : "", + bterm->getModNet() ? bterm->getModNet()->getId() : -1); + } + } + + // got through the module ports and their owner + printf("\t\tModBTerm Ports +++\n"); + dbSet module_ports = cur_obj->getModBTerms(); + for (dbSet::iterator mod_bterm_iter = module_ports.begin(); + mod_bterm_iter != module_ports.end(); + mod_bterm_iter++) { + dbModBTerm* module_port = *mod_bterm_iter; + printf("\t\tPort %s Net %s (%d)\n", + module_port->getName(), + module_port->getNet() + ? ((_dbModNet*) module_port->getNet())->_name + : "No-modnet", + module_port->getNet() ? module_port->getNet()->getId() : -1); + printf("\t\tPort parent %s\n\n", module_port->getParent()->getName()); + } + printf("\t\tModBTermPorts ---\n"); + + printf("\t\tModule instances +++\n"); + dbSet module_instances = mi->getModInsts(); + for (dbSet::iterator mod_inst_iter = module_instances.begin(); + mod_inst_iter != module_instances.end(); + mod_inst_iter++) { + dbModInst* module_inst = *mod_inst_iter; + printf("\t\tMod inst %s ", module_inst->getName()); + dbModule* master = module_inst->getMaster(); + printf("\t\tMaster %s\n\n", module_inst->getMaster()->getName()); + _dbBlock* owner = (_dbBlock*) (master->getOwner()); + _dbBlock* current_block = (_dbBlock*) this; + if (owner != current_block) + printf("\t\t\tMaster owner in wrong block\n"); + + printf("\t\tConnections\n"); + for (dbModITerm* miterm_pin : module_inst->getModITerms()) { + printf("\t\t\tModIterm : %s (%u) Mod Net %s (%u) \n", + miterm_pin->getName(), + miterm_pin->getId(), + miterm_pin->getNet() + ? ((_dbModNet*) miterm_pin->getNet())->_name + : "No-net", + miterm_pin->getNet() ? miterm_pin->getNet()->getId() : 0); + } + } + printf("\t\tModule instances ---\n"); + printf("\t\tDb instances +++\n"); + for (dbInst* db_inst : cur_obj->getInsts()) { + printf("\t\tdb inst %s\n", db_inst->getName().c_str()); + printf("\t\tdb iterms:\n"); + dbSet iterms = db_inst->getITerms(); + dbSet::iterator iterm_itr; + for (iterm_itr = iterms.begin(); iterm_itr != iterms.end(); + ++iterm_itr) { + dbITerm* iterm = *iterm_itr; + dbMTerm* mterm = iterm->getMTerm(); + printf( + "\t\t\t\t iterm: %s (%u) Net: %s Mod net : %s (%d)\n", + mterm->getName().c_str(), + iterm->getId(), + iterm->getNet() ? iterm->getNet()->getName().c_str() + : "unk-dbnet", + iterm->getModNet() ? iterm->getModNet()->getName() : "unk-modnet", + iterm->getModNet() ? iterm->getModNet()->getId() : -1); + } + } + printf("\t\tDb instances ---\n"); + + printf("\tModule nets (modnets) +++ \n"); + printf("\t# mod nets %u in %s (%p)\n", + cur_obj->getModNets().size(), + cur_obj->getName(), + cur_obj); + dbSet mod_nets = cur_obj->getModNets(); + for (dbSet::iterator mod_net_iter = mod_nets.begin(); + mod_net_iter != mod_nets.end(); + mod_net_iter++) { + dbModNet* mod_net = *mod_net_iter; + printf("\t\tNet: %s (%u)\n", mod_net->getName(), mod_net->getId()); + printf("\t\tConnections -> modIterms/modbterms/bterms/iterms:\n"); + printf("\t\t -> %u moditerms\n", mod_net->getModITerms().size()); + for (dbModITerm* modi_term : mod_net->getModITerms()) { + printf("\t\t\t%s\n", modi_term->getName()); + } + printf("\t\t -> %u modbterms\n", mod_net->getModBTerms().size()); + for (dbModBTerm* modb_term : mod_net->getModBTerms()) { + printf("\t\t\t%s\n", modb_term->getName()); + } + printf("\t\t -> %u iterms\n", mod_net->getITerms().size()); + for (dbITerm* db_iterm : mod_net->getITerms()) { + printf("\t\t\t%s\n", db_iterm->getName().c_str()); + } + printf("\t\t -> %u bterms\n", mod_net->getBTerms().size()); + for (dbBTerm* db_bterm : mod_net->getBTerms()) { + printf("\t\t\t%s\n", db_bterm->getName().c_str()); + } + } + } + } else + printf("Empty module table\n"); +} + } // namespace odb diff --git a/src/odb/src/db/dbBlock.h b/src/odb/src/db/dbBlock.h index 391ce939f24..294d2601929 100644 --- a/src/odb/src/db/dbBlock.h +++ b/src/odb/src/db/dbBlock.h @@ -90,6 +90,9 @@ class _dbPowerSwitch; class _dbIsolation; class _dbLevelShifter; class _dbModInst; +class _dbModITerm; +class _dbModBTerm; +class _dbModNet; class _dbGroup; class _dbAccessPoint; class _dbGlobalConnect; @@ -104,6 +107,13 @@ class dbInstITermItr; class dbRegionInstItr; class dbModuleInstItr; class dbModuleModInstItr; +class dbModuleModBTermItr; +class dbModuleModInstModITermItr; +class dbModuleModNetItr; +class dbModuleModNetModBTermItr; +class dbModuleModNetModITermItr; +class dbModuleModNetITermItr; +class dbModuleModNetBTermItr; class dbRegionGroupItr; class dbGlobalConnect; class dbGroupItr; @@ -171,6 +181,10 @@ class _dbBlock : public _dbObject dbHashTable<_dbLogicPort> _logicport_hash; dbHashTable<_dbPowerSwitch> _powerswitch_hash; dbHashTable<_dbIsolation> _isolation_hash; + dbHashTable<_dbModBTerm> _modbterm_hash; + dbHashTable<_dbModITerm> _moditerm_hash; + dbHashTable<_dbModNet> _modnet_hash; + dbHashTable<_dbLevelShifter> _levelshifter_hash; dbHashTable<_dbGroup> _group_hash; dbIntHashTable<_dbInstHdr> _inst_hdr_hash; @@ -222,6 +236,11 @@ class _dbBlock : public _dbObject dbPagedVector* _r_val_tbl; dbPagedVector* _c_val_tbl; dbPagedVector* _cc_val_tbl; + + dbTable<_dbModBTerm>* _modbterm_tbl; + dbTable<_dbModITerm>* _moditerm_tbl; + dbTable<_dbModNet>* _modnet_tbl; + dbTable<_dbCapNode>* _cap_node_tbl; dbTable<_dbRSeg>* _r_seg_tbl; dbTable<_dbCCSeg>* _cc_seg_tbl; @@ -240,6 +259,15 @@ class _dbBlock : public _dbObject dbRegionInstItr* _region_inst_itr; dbModuleInstItr* _module_inst_itr; dbModuleModInstItr* _module_modinst_itr; + dbModuleModBTermItr* _module_modbterm_itr; + dbModuleModInstModITermItr* _module_modinstmoditerm_itr; + + dbModuleModNetItr* _module_modnet_itr; + dbModuleModNetModITermItr* _module_modnet_moditerm_itr; + dbModuleModNetModBTermItr* _module_modnet_modbterm_itr; + dbModuleModNetITermItr* _module_modnet_iterm_itr; + dbModuleModNetBTermItr* _module_modnet_bterm_itr; + dbRegionGroupItr* _region_group_itr; dbGroupItr* _group_itr; dbGuideItr* _guide_itr; diff --git a/src/odb/src/db/dbITerm.cpp b/src/odb/src/db/dbITerm.cpp index 1645565eb49..29e2a05b6e3 100644 --- a/src/odb/src/db/dbITerm.cpp +++ b/src/odb/src/db/dbITerm.cpp @@ -50,6 +50,7 @@ #include "dbMPin.h" #include "dbMTerm.h" #include "dbMaster.h" +#include "dbModNet.h" #include "dbNet.h" #include "dbShape.h" #include "dbTable.h" @@ -130,6 +131,8 @@ void _dbITerm::differences(dbDiff& diff, DIFF_FIELD(_ext_id); DIFF_FIELD(_next_net_iterm); DIFF_FIELD(_prev_net_iterm); + DIFF_FIELD(_next_modnet_iterm); + DIFF_FIELD(_prev_modnet_iterm); DIFF_END } else { _dbBlock* lhs_blk = (_dbBlock*) getOwner(); @@ -176,6 +179,8 @@ void _dbITerm::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD(_ext_id); DIFF_OUT_FIELD(_next_net_iterm); DIFF_OUT_FIELD(_prev_net_iterm); + DIFF_OUT_FIELD(_next_modnet_iterm); + DIFF_OUT_FIELD(_prev_modnet_iterm); DIFF_END } else { _dbMTerm* mterm = getMTerm(); @@ -438,6 +443,53 @@ void dbITerm::connect(dbNet* net_) callback->inDbITermPostConnect(this); } +dbModNet* dbITerm::getModNet() +{ + _dbITerm* iterm = (_dbITerm*) this; + _dbBlock* block = (_dbBlock*) iterm->getOwner(); + if (iterm->_mnet == 0) + return nullptr; + _dbModNet* net = block->_modnet_tbl->getPtr(iterm->_mnet); + return ((dbModNet*) (net)); +} + +void dbITerm::connect(dbModNet* mod_net) +{ + _dbITerm* iterm = (_dbITerm*) this; + _dbModNet* _mod_net = (_dbModNet*) mod_net; + _dbBlock* block = (_dbBlock*) iterm->getOwner(); + + if (iterm->_mnet == _mod_net->getId()) { + return; + } + + if (iterm->_mnet != 0) { + disconnect(); + } + + iterm->_mnet = _mod_net->getId(); + + _dbInst* inst = iterm->getInst(); + if (inst->_flags._dont_touch) { + inst->getLogger()->error( + utl::ODB, + 397, + "Attempt to connect iterm of dont_touch instance {}", + inst->_name); + } + + if (_mod_net->_iterms != 0) { + _dbITerm* head = block->_iterm_tbl->getPtr(_mod_net->_iterms); + iterm->_next_modnet_iterm = _mod_net->_iterms; + // prev is this one + head->_prev_modnet_iterm = iterm->getOID(); + } else { + iterm->_next_modnet_iterm = 0; + } + iterm->_prev_modnet_iterm = 0; + _mod_net->_iterms = iterm->getOID(); +} + void dbITerm::disconnect() { _dbITerm* iterm = (_dbITerm*) this; @@ -453,7 +505,6 @@ void dbITerm::disconnect() "Attempt to disconnect iterm of dont_touch instance {}", inst->_name); } - _dbBlock* block = (_dbBlock*) iterm->getOwner(); _dbNet* net = block->_net_tbl->getPtr(iterm->_net); @@ -483,7 +534,6 @@ void dbITerm::disconnect() if (net->_iterms == id) { net->_iterms = iterm->_next_net_iterm; - if (net->_iterms != 0) { _dbITerm* t = block->_iterm_tbl->getPtr(net->_iterms); t->_prev_net_iterm = 0; @@ -493,16 +543,37 @@ void dbITerm::disconnect() _dbITerm* next = block->_iterm_tbl->getPtr(iterm->_next_net_iterm); next->_prev_net_iterm = iterm->_prev_net_iterm; } - if (iterm->_prev_net_iterm != 0) { _dbITerm* prev = block->_iterm_tbl->getPtr(iterm->_prev_net_iterm); prev->_next_net_iterm = iterm->_next_net_iterm; } } - iterm->_net = 0; for (auto callback : block->_callbacks) callback->inDbITermPostDisconnect(this, (dbNet*) net); + + // the modnet part + if (iterm->_mnet == 0) + return; + _dbModNet* mod_net = block->_modnet_tbl->getPtr(iterm->_mnet); + + if (mod_net->_iterms == id) { + mod_net->_iterms = iterm->_next_modnet_iterm; + if (mod_net->_iterms != 0) { + _dbITerm* t = block->_iterm_tbl->getPtr(mod_net->_iterms); + t->_prev_modnet_iterm = 0; + } + } else { + if (iterm->_next_modnet_iterm != 0) { + _dbITerm* next = block->_iterm_tbl->getPtr(iterm->_next_modnet_iterm); + next->_prev_modnet_iterm = iterm->_prev_modnet_iterm; + } + if (iterm->_prev_modnet_iterm != 0) { + _dbITerm* prev = block->_iterm_tbl->getPtr(iterm->_prev_modnet_iterm); + prev->_next_modnet_iterm = iterm->_next_modnet_iterm; + } + } + iterm->_mnet = 0; } dbSigType dbITerm::getSigType() diff --git a/src/odb/src/db/dbITerm.h b/src/odb/src/db/dbITerm.h index 5b57fae8742..541c5727654 100644 --- a/src/odb/src/db/dbITerm.h +++ b/src/odb/src/db/dbITerm.h @@ -43,6 +43,7 @@ namespace odb { class _dbNet; +class _dbModNet; class _dbMTerm; class _dbInst; class _dbITerm; @@ -76,9 +77,12 @@ class _dbITerm : public _dbObject dbITermFlags _flags; uint _ext_id; dbId<_dbNet> _net; + dbId<_dbModNet> _mnet; dbId<_dbInst> _inst; dbId<_dbITerm> _next_net_iterm; dbId<_dbITerm> _prev_net_iterm; + dbId<_dbITerm> _next_modnet_iterm; + dbId<_dbITerm> _prev_modnet_iterm; uint32_t _sta_vertex_id; // not saved std::map, dbId<_dbAccessPoint>> aps_; @@ -115,6 +119,8 @@ inline _dbITerm::_dbITerm(_dbDatabase*, const _dbITerm& i) _inst(i._inst), _next_net_iterm(i._next_net_iterm), _prev_net_iterm(i._prev_net_iterm), + _next_modnet_iterm(i._next_modnet_iterm), + _prev_modnet_iterm(i._prev_modnet_iterm), _sta_vertex_id(0) { } @@ -125,9 +131,12 @@ inline dbOStream& operator<<(dbOStream& stream, const _dbITerm& iterm) stream << *bit_field; stream << iterm._ext_id; stream << iterm._net; + stream << iterm._mnet; stream << iterm._inst; stream << iterm._next_net_iterm; stream << iterm._prev_net_iterm; + stream << iterm._next_modnet_iterm; + stream << iterm._prev_modnet_iterm; stream << iterm.aps_; return stream; } @@ -138,9 +147,12 @@ inline dbIStream& operator>>(dbIStream& stream, _dbITerm& iterm) stream >> *bit_field; stream >> iterm._ext_id; stream >> iterm._net; + stream >> iterm._mnet; stream >> iterm._inst; stream >> iterm._next_net_iterm; stream >> iterm._prev_net_iterm; + stream >> iterm._next_modnet_iterm; + stream >> iterm._prev_modnet_iterm; stream >> iterm.aps_; return stream; } diff --git a/src/odb/src/db/dbInst.cpp b/src/odb/src/db/dbInst.cpp index 592ff119bdf..2071a120700 100644 --- a/src/odb/src/db/dbInst.cpp +++ b/src/odb/src/db/dbInst.cpp @@ -1309,16 +1309,18 @@ uint dbInst::getPinAccessIdx() const dbInst* dbInst::create(dbBlock* block_, dbMaster* master_, const char* name_, - bool physical_only) + bool physical_only, + dbModule* target_module) { - return create(block_, master_, name_, nullptr, physical_only); + return create(block_, master_, name_, nullptr, physical_only, target_module); } dbInst* dbInst::create(dbBlock* block_, dbMaster* master_, const char* name_, dbRegion* region, - bool physical_only) + bool physical_only, + dbModule* parent_module) { _dbBlock* block = (_dbBlock*) block_; _dbMaster* master = (_dbMaster*) master_; @@ -1381,7 +1383,14 @@ dbInst* dbInst::create(dbBlock* block_, inst->_flags._physical_only = physical_only; if (!physical_only) { - block_->getTopModule()->addInst((dbInst*) inst); + // old code + // block_->getTopModule()->addInst((dbInst*) inst); + // now we insert into scope of module... + // might screw things up.. + if (parent_module) + parent_module->addInst((dbInst*) inst); + else + block_->getTopModule()->addInst((dbInst*) inst); } if (region) { diff --git a/src/odb/src/db/dbModBTerm.cpp b/src/odb/src/db/dbModBTerm.cpp new file mode 100644 index 00000000000..b25c896bd1c --- /dev/null +++ b/src/odb/src/db/dbModBTerm.cpp @@ -0,0 +1,417 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2022, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModBTerm.h" + +#include "db.h" +#include "dbBlock.h" +#include "dbDatabase.h" +#include "dbDiff.hpp" +#include "dbHashTable.hpp" +#include "dbModNet.h" +#include "dbModule.h" +#include "dbTable.h" +#include "dbTable.hpp" +namespace odb { +template class dbTable<_dbModBTerm>; + +bool _dbModBTerm::operator==(const _dbModBTerm& rhs) const +{ + if (_name != rhs._name) { + return false; + } + if (_flags != rhs._flags) { + return false; + } + if (_parent != rhs._parent) { + return false; + } + if (_net != rhs._net) { + return false; + } + if (_next_net_modbterm != rhs._next_net_modbterm) { + return false; + } + if (_prev_net_modbterm != rhs._prev_net_modbterm) { + return false; + } + if (_next_entry != rhs._next_entry) { + return false; + } + + return true; +} + +bool _dbModBTerm::operator<(const _dbModBTerm& rhs) const +{ + return true; +} + +void _dbModBTerm::differences(dbDiff& diff, + const char* field, + const _dbModBTerm& rhs) const +{ + DIFF_BEGIN + DIFF_FIELD(_name); + DIFF_FIELD(_flags); + DIFF_FIELD(_parent); + DIFF_FIELD(_net); + DIFF_FIELD(_next_net_modbterm); + DIFF_FIELD(_prev_net_modbterm); + DIFF_FIELD(_next_entry); + DIFF_END +} + +void _dbModBTerm::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_modbterm); + DIFF_OUT_FIELD(_prev_net_modbterm); + DIFF_OUT_FIELD(_next_entry); + + DIFF_END +} + +_dbModBTerm::_dbModBTerm(_dbDatabase* db) +{ +} + +_dbModBTerm::_dbModBTerm(_dbDatabase* db, const _dbModBTerm& r) +{ + _name = r._name; + _flags = r._flags; + _parent = r._parent; + _net = r._net; + _next_net_modbterm = r._next_net_modbterm; + _prev_net_modbterm = r._prev_net_modbterm; + _next_entry = r._next_entry; +} + +dbIStream& operator>>(dbIStream& stream, _dbModBTerm& obj) +{ + stream >> obj._name; + stream >> obj._flags; + stream >> obj._parent; + stream >> obj._net; + stream >> obj._next_net_modbterm; + stream >> obj._prev_net_modbterm; + stream >> obj._next_entry; + return stream; +} + +dbOStream& operator<<(dbOStream& stream, const _dbModBTerm& obj) +{ + stream << obj._name; + stream << obj._flags; + stream << obj._parent; + stream << obj._net; + stream << obj._next_net_modbterm; + stream << obj._prev_net_modbterm; + stream << obj._next_entry; + return stream; +} + +_dbModBTerm::~_dbModBTerm() +{ + if (_name) { + free((void*) _name); + } +} + +//////////////////////////////////////////////////////////////////// +// +// dbModBTerm - Methods +// +//////////////////////////////////////////////////////////////////// + +const char* dbModBTerm::getName() const +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + return obj->_name; +} + +dbModule* dbModBTerm::getParent() const +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + if (obj->_parent == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModule*) par->_module_tbl->getPtr(obj->_parent); +} + +void dbModBTerm::setNet(dbModNet* net) +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + + obj->_net = net->getImpl()->getOID(); +} + +dbModNet* dbModBTerm::getNet() const +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + if (obj->_net == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + 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; + dbSigType::Value _sigtype : 4; + uint _spare_bits : 24; +}; + +typedef union dbModBTermFlags +{ + struct dbModBTermFlags_str flags; + uint uint_val; +} dbModBTermFlagsU; + +void dbModBTerm::setSigType(dbSigType type) +{ + dbModBTermFlagsU cur_flags; + cur_flags.uint_val = getFlags(); + cur_flags.flags._sigtype = type.getValue(); + setFlags(cur_flags.uint_val); +} + +dbSigType dbModBTerm::getSigType() +{ + dbModBTermFlagsU cur_flags; + cur_flags.uint_val = getFlags(); + return dbSigType(cur_flags.flags._sigtype); +} + +void dbModBTerm::setIoType(dbIoType type) +{ + dbModBTermFlagsU cur_flags; + cur_flags.uint_val = getFlags(); + cur_flags.flags._iotype = type.getValue(); + setFlags(cur_flags.uint_val); +} + +dbIoType dbModBTerm::getIoType() +{ + dbModBTermFlagsU cur_flags; + cur_flags.uint_val = getFlags(); + return dbIoType(cur_flags.flags._iotype); +} + +dbModBTerm* dbModBTerm::create(dbModule* parentModule, const char* name) +{ + dbModBTerm* ret = parentModule->findModBTerm(name); + if (ret) { + return ret; + } + + _dbModule* module = (_dbModule*) parentModule; + _dbBlock* block = (_dbBlock*) module->getOwner(); + + std::string str_name(name); + _dbModBTerm* modbterm = block->_modbterm_tbl->create(); + // defaults + ((dbModBTerm*) modbterm)->setFlags(0U); + ((dbModBTerm*) modbterm)->setIoType(dbIoType::INPUT); + ((dbModBTerm*) modbterm)->setSigType(dbSigType::SIGNAL); + modbterm->_net = 0; + modbterm->_next_net_modbterm = 0; + modbterm->_prev_net_modbterm = 0; + + modbterm->_name = strdup(name); + ZALLOCATED(modbterm->_name); + modbterm->_parent = module->getOID(); + modbterm->_next_entry = module->_modbterms; + module->_modbterms = modbterm->getOID(); + + return (dbModBTerm*) modbterm; +} + +char* dbModBTerm::getName() +{ + _dbModBTerm* _bterm = (_dbModBTerm*) this; + return _bterm->_name; +} + +void dbModBTerm::connect(dbModNet* net) +{ + // printf("Connecting mod net %s to modbterm %s\n", + // net -> getName(), + // getName() + // ); + _dbModule* _module = (_dbModule*) (net->getParent()); + _dbBlock* _block = (_dbBlock*) _module->getOwner(); + _dbModNet* _modnet = (_dbModNet*) net; + _dbModBTerm* _modbterm = (_dbModBTerm*) this; + // already connected + 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) { + _dbModBTerm* head = _block->_modbterm_tbl->getPtr(_modnet->_modbterms); + // next is old head + _modbterm->_next_net_modbterm = _modnet->_modbterms; + // previous for old head is this one + head->_prev_net_modbterm = getId(); + } else { + _modbterm->_next_net_modbterm = 0; // only element + } + _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; +} + +void dbModBTerm::disconnect() +{ + _dbModule* module = (_dbModule*) getParent(); + _dbBlock* block = (_dbBlock*) module->getOwner(); + _dbModBTerm* _modbterm = (_dbModBTerm*) this; + if (_modbterm->_net == 0) + return; + _dbModNet* mod_net = block->_modnet_tbl->getPtr(_modbterm->_net); + + if (_modbterm->_prev_net_modbterm == 0) { + // degenerate case, head element, need to update net starting point + // and if next is null then make generate empty list + mod_net->_modbterms = _modbterm->_next_net_modbterm; + } else { + _dbModBTerm* prev_modbterm + = block->_modbterm_tbl->getPtr(_modbterm->_prev_net_modbterm); + prev_modbterm->_next_net_modbterm + = _modbterm->_next_net_modbterm; // short out this element + } + if (_modbterm->_next_net_modbterm != 0) { + _dbModBTerm* next_modbterm + = block->_modbterm_tbl->getPtr(_modbterm->_next_net_modbterm); + next_modbterm->_prev_net_modbterm = _modbterm->_prev_net_modbterm; + } + + // + // zero out this element for garbage collection + // Not we can never rely on sequential order of modbterms for offsets. + // + _modbterm->_next_net_modbterm = 0; + _modbterm->_prev_net_modbterm = 0; +} + +void dbModBTerm::staSetPort(void* p) +{ + _dbModBTerm* _modbterm = (_dbModBTerm*) this; + _modbterm->_sta_port = p; +} + +void* dbModBTerm::staPort() +{ + _dbModBTerm* _modbterm = (_dbModBTerm*) this; + return _modbterm->_sta_port; +} + +// User Code End dbModBTermPublicMethods +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModBTerm.h b/src/odb/src/db/dbModBTerm.h new file mode 100644 index 00000000000..50588f49e62 --- /dev/null +++ b/src/odb/src/db/dbModBTerm.h @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2022, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbCore.h" +#include "odb.h" + +namespace odb { +class dbIStream; +class dbOStream; +class dbDiff; +class _dbDatabase; +class _dbModule; +class _dbModNet; + +class _dbModBTerm : public _dbObject +{ + public: + _dbModBTerm(_dbDatabase*, const _dbModBTerm& r); + _dbModBTerm(_dbDatabase*); + + ~_dbModBTerm(); + + bool operator==(const _dbModBTerm& rhs) const; + bool operator!=(const _dbModBTerm& rhs) const { return !operator==(rhs); } + bool operator<(const _dbModBTerm& rhs) const; + void differences(dbDiff& diff, + const char* field, + const _dbModBTerm& rhs) const; + void out(dbDiff& diff, char side, const char* field) const; + + char* _name; + uint _flags; + dbId<_dbModule> _parent; + dbId<_dbModNet> _net; + dbId<_dbModBTerm> _next_net_modbterm; + dbId<_dbModBTerm> _prev_net_modbterm; + dbId<_dbModBTerm> _next_entry; + + // User Code Begin Fields + void* _sta_port; + // User Code End Fields +}; +dbIStream& operator>>(dbIStream& stream, _dbModBTerm& obj); +dbOStream& operator<<(dbOStream& stream, const _dbModBTerm& obj); +} // namespace odb + // Generator Code End Header diff --git a/src/odb/src/db/dbModITerm.cpp b/src/odb/src/db/dbModITerm.cpp new file mode 100644 index 00000000000..c9fd4c54d73 --- /dev/null +++ b/src/odb/src/db/dbModITerm.cpp @@ -0,0 +1,351 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2022, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModITerm.h" + +#include "db.h" +#include "dbBlock.h" +#include "dbDatabase.h" +#include "dbDiff.hpp" +#include "dbHashTable.hpp" +#include "dbModInst.h" +#include "dbModNet.h" +#include "dbTable.h" +#include "dbTable.hpp" +namespace odb { +template class dbTable<_dbModITerm>; + +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; + } + if (_net != rhs._net) { + return false; + } + if (_next_net_moditerm != rhs._next_net_moditerm) { + return false; + } + if (_prev_net_moditerm != rhs._prev_net_moditerm) { + return false; + } + if (_next_entry != rhs._next_entry) { + return false; + } + + return true; +} + +bool _dbModITerm::operator<(const _dbModITerm& rhs) const +{ + return true; +} + +void _dbModITerm::differences(dbDiff& diff, + const char* field, + const _dbModITerm& rhs) const +{ + DIFF_BEGIN + DIFF_FIELD(_name); + DIFF_FIELD(_flags); + DIFF_FIELD(_parent); + DIFF_FIELD(_net); + DIFF_FIELD(_next_net_moditerm); + DIFF_FIELD(_prev_net_moditerm); + DIFF_FIELD(_next_entry); + DIFF_END +} + +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); + DIFF_OUT_FIELD(_prev_net_moditerm); + DIFF_OUT_FIELD(_next_entry); + + DIFF_END +} + +_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; + _prev_net_moditerm = r._prev_net_moditerm; + _next_entry = r._next_entry; +} + +dbIStream& operator>>(dbIStream& stream, _dbModITerm& obj) +{ + stream >> obj._name; + stream >> obj._flags; + stream >> obj._parent; + stream >> obj._net; + stream >> obj._next_net_moditerm; + stream >> obj._prev_net_moditerm; + stream >> obj._next_entry; + return stream; +} + +dbOStream& operator<<(dbOStream& stream, const _dbModITerm& obj) +{ + stream << obj._name; + stream << obj._flags; + stream << obj._parent; + stream << obj._net; + stream << obj._next_net_moditerm; + stream << obj._prev_net_moditerm; + stream << obj._next_entry; + return stream; +} + +_dbModITerm::~_dbModITerm() +{ + if (_name) { + free((void*) _name); + } +} + +//////////////////////////////////////////////////////////////////// +// +// dbModITerm - Methods +// +//////////////////////////////////////////////////////////////////// + +dbModInst* dbModITerm::getParent() const +{ + _dbModITerm* obj = (_dbModITerm*) this; + if (obj->_parent == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModInst*) par->_modinst_tbl->getPtr(obj->_parent); +} + +void dbModITerm::setNet(dbModNet* net) +{ + _dbModITerm* obj = (_dbModITerm*) this; + + obj->_net = net->getImpl()->getOID(); +} + +dbModNet* dbModITerm::getNet() const +{ + _dbModITerm* obj = (_dbModITerm*) this; + if (obj->_net == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + 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) +{ + _dbModInst* parent = (_dbModInst*) parentInstance; + _dbBlock* block = (_dbBlock*) parent->getOwner(); + _dbModITerm* moditerm = block->_moditerm_tbl->create(); + // defaults + moditerm->_net = 0; + moditerm->_next_net_moditerm = 0; + moditerm->_prev_net_moditerm = 0; + + ((dbModITerm*) moditerm)->setFlags(0U); + ((dbModITerm*) moditerm)->setIoType(dbIoType::INPUT); + ((dbModITerm*) moditerm)->setSigType(dbSigType::SIGNAL); + moditerm->_name = strdup(name); + ZALLOCATED(moditerm->_name); + + moditerm->_parent = parent->getOID(); + moditerm->_next_entry = parent->_moditerms; + parent->_moditerms = moditerm->getOID(); + + return (dbModITerm*) moditerm; +} + +bool dbModITerm::connect(dbModNet* net) +{ + _dbModITerm* _moditerm = (_dbModITerm*) this; + _dbModNet* _modnet = (_dbModNet*) net; + _dbBlock* _block = (_dbBlock*) _moditerm->getOwner(); + // already connected. + if (_moditerm->_net == _modnet->getId()) + return true; + _moditerm->_net = _modnet->getId(); + // append to net moditerms + if (_modnet->_moditerms != 0) { + _dbModITerm* head = _block->_moditerm_tbl->getPtr(_modnet->_moditerms); + // next is old head + _moditerm->_next_net_moditerm = _modnet->_moditerms; + head->_prev_net_moditerm = getId(); + } else { + _moditerm->_next_net_moditerm = 0; + } + // set up new head + _moditerm->_prev_net_moditerm = 0; + _modnet->_moditerms = getId(); + 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 new file mode 100644 index 00000000000..b446cc1f4ee --- /dev/null +++ b/src/odb/src/db/dbModITerm.h @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2022, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbCore.h" +#include "odb.h" + +namespace odb { +class dbIStream; +class dbOStream; +class dbDiff; +class _dbDatabase; +class _dbModInst; +class _dbModNet; + +class _dbModITerm : public _dbObject +{ + public: + _dbModITerm(_dbDatabase*, const _dbModITerm& r); + _dbModITerm(_dbDatabase*); + + ~_dbModITerm(); + + bool operator==(const _dbModITerm& rhs) const; + bool operator!=(const _dbModITerm& rhs) const { return !operator==(rhs); } + bool operator<(const _dbModITerm& rhs) const; + void differences(dbDiff& diff, + const char* field, + const _dbModITerm& rhs) const; + 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; + dbId<_dbModITerm> _prev_net_moditerm; + dbId<_dbModITerm> _next_entry; +}; +dbIStream& operator>>(dbIStream& stream, _dbModITerm& obj); +dbOStream& operator<<(dbOStream& stream, const _dbModITerm& obj); +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModInst.cpp b/src/odb/src/db/dbModInst.cpp index ac6aa8f38c2..85d4b5596ce 100644 --- a/src/odb/src/db/dbModInst.cpp +++ b/src/odb/src/db/dbModInst.cpp @@ -38,11 +38,14 @@ #include "dbDatabase.h" #include "dbDiff.hpp" #include "dbHashTable.hpp" +#include "dbModITerm.h" #include "dbModule.h" #include "dbTable.h" #include "dbTable.hpp" // User Code Begin Includes #include "dbGroup.h" +#include "dbModInst.h" +#include "dbModuleModInstModITermItr.h" // User Code End Includes namespace odb { template class dbTable<_dbModInst>; @@ -70,6 +73,9 @@ bool _dbModInst::operator==(const _dbModInst& rhs) const if (_group != rhs._group) { return false; } + if (_moditerms != rhs._moditerms) { + return false; + } return true; } @@ -95,6 +101,7 @@ void _dbModInst::differences(dbDiff& diff, DIFF_FIELD(_master); DIFF_FIELD(_group_next); DIFF_FIELD(_group); + DIFF_FIELD(_moditerms); DIFF_END } @@ -108,6 +115,7 @@ void _dbModInst::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD(_master); DIFF_OUT_FIELD(_group_next); DIFF_OUT_FIELD(_group); + DIFF_OUT_FIELD(_moditerms); DIFF_END } @@ -133,6 +141,7 @@ _dbModInst::_dbModInst(_dbDatabase* db, const _dbModInst& r) _master = r._master; _group_next = r._group_next; _group = r._group; + _moditerms = r._moditerms; } dbIStream& operator>>(dbIStream& stream, _dbModInst& obj) @@ -144,6 +153,7 @@ dbIStream& operator>>(dbIStream& stream, _dbModInst& obj) stream >> obj._master; stream >> obj._group_next; stream >> obj._group; + stream >> obj._moditerms; return stream; } @@ -156,6 +166,7 @@ dbOStream& operator<<(dbOStream& stream, const _dbModInst& obj) stream << obj._master; stream << obj._group_next; stream << obj._group; + stream << obj._moditerms; return stream; } @@ -172,6 +183,12 @@ _dbModInst::~_dbModInst() // //////////////////////////////////////////////////////////////////// +const char* dbModInst::getName() const +{ + _dbModInst* obj = (_dbModInst*) this; + return obj->_name; +} + dbModule* dbModInst::getParent() const { _dbModInst* obj = (_dbModInst*) this; @@ -207,21 +224,27 @@ dbModInst* dbModInst::create(dbModule* parentModule, dbModule* masterModule, const char* name) { - _dbModule* parent = (_dbModule*) parentModule; - _dbBlock* block = (_dbBlock*) parent->getOwner(); - std::string h_name = std::string(parent->_name) + '/' + std::string(name); - if (block->_modinst_hash.hasMember(h_name.c_str())) - return nullptr; + _dbModule* module = (_dbModule*) parentModule; + _dbBlock* block = (_dbBlock*) module->getOwner(); _dbModule* master = (_dbModule*) masterModule; + if (master->_mod_inst != 0) return nullptr; + + dbModInst* ret = nullptr; + ret = ((dbModule*) module)->findModInst(name); + if (ret) { + return nullptr; + } + _dbModInst* modinst = block->_modinst_tbl->create(); - modinst->_name = strdup(h_name.c_str()); + modinst->_name = strdup(name); ZALLOCATED(modinst->_name); modinst->_master = master->getOID(); - modinst->_parent = parent->getOID(); - modinst->_module_next = parent->_modinsts; - parent->_modinsts = modinst->getOID(); + modinst->_parent = module->getOID(); + // push to head of list in block + modinst->_module_next = module->_modinsts; + module->_modinsts = modinst->getOID(); master->_mod_inst = modinst->getOID(); block->_modinst_hash.insert(modinst); return (dbModInst*) modinst; @@ -268,31 +291,43 @@ dbSet::iterator dbModInst::destroy(dbSet::iterator& itr) return next; } -dbModInst* dbModInst::getModInst(dbBlock* block_, uint dbid_) +dbSet dbModInst::getModITerms() { - _dbBlock* block = (_dbBlock*) block_; - return (dbModInst*) block->_modinst_tbl->getPtr(dbid_); + _dbModInst* _mod_inst = (_dbModInst*) this; + _dbBlock* _block = (_dbBlock*) _mod_inst->getOwner(); + return dbSet(_mod_inst, _block->_module_modinstmoditerm_itr); } -std::string dbModInst::getName() const +dbModInst* dbModInst::getModInst(dbBlock* block_, uint dbid_) { - _dbModInst* obj = (_dbModInst*) this; - std::string h_name = std::string(obj->_name); - size_t idx = h_name.find_last_of('/'); - return h_name.substr(idx + 1); + _dbBlock* block = (_dbBlock*) block_; + return (dbModInst*) block->_modinst_tbl->getPtr(dbid_); } std::string dbModInst::getHierarchicalName() const { _dbModInst* _obj = (_dbModInst*) this; dbBlock* block = (dbBlock*) _obj->getOwner(); - std::string inst_name = getName(); + std::string inst_name = std::string(getName()); dbModule* parent = getParent(); if (parent == block->getTopModule()) return inst_name; else return parent->getModInst()->getHierarchicalName() + "/" + inst_name; } + +bool dbModInst::findModITerm(const char* name, dbModITerm*& ret) +{ + dbSet moditerms = getModITerms(); + for (dbModITerm* mod_iterm : moditerms) { + if (!strcmp(mod_iterm->getName(), name)) { + ret = mod_iterm; + return true; + } + } + return false; +} + // User Code End dbModInstPublicMethods } // namespace odb // Generator Code End Cpp diff --git a/src/odb/src/db/dbModInst.h b/src/odb/src/db/dbModInst.h index cd82e0e2812..e79a5b168ae 100644 --- a/src/odb/src/db/dbModInst.h +++ b/src/odb/src/db/dbModInst.h @@ -34,6 +34,8 @@ #pragma once #include "dbCore.h" +#include "dbSet.h" +#include "dbVector.h" #include "odb.h" namespace odb { @@ -43,6 +45,10 @@ class dbDiff; class _dbDatabase; class _dbModule; class _dbGroup; +class _dbModITerm; +// User Code Begin Classes +class dbModITerm; +// User Code End Classes class _dbModInst : public _dbObject { @@ -67,6 +73,7 @@ class _dbModInst : public _dbObject dbId<_dbModule> _master; dbId<_dbModInst> _group_next; dbId<_dbGroup> _group; + dbId<_dbModITerm> _moditerms; }; dbIStream& operator>>(dbIStream& stream, _dbModInst& obj); dbOStream& operator<<(dbOStream& stream, const _dbModInst& obj); diff --git a/src/odb/src/db/dbModInstITermItr.cpp b/src/odb/src/db/dbModInstITermItr.cpp new file mode 100644 index 00000000000..b3d29347cca --- /dev/null +++ b/src/odb/src/db/dbModInstITermItr.cpp @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModInstITermItr.h" + +#include "dbModITerm.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModInstITermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModInstITermItr::reversible() +{ + return true; +} + +bool dbModInstITermItr::orderReversed() +{ + return true; +} + +void dbModInstITermItr::reverse(dbObject* parent) +{ +} + +uint dbModInstITermItr::sequential() +{ + return 0; +} + +uint dbModInstITermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModInstITermItr::begin(parent); + id != dbModInstITermItr::end(parent); + id = dbModInstITermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModInstITermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModInst* modinst = (_dbModInst*) parent; + return modinst->_moditerms; + // User Code End begin +} + +uint dbModInstITermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModInstITermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModInstITerm* iterm = _moditerm_tbl->getPtr(id); + return iterm->_next_entry; + // User Code End next +} + +dbObject* dbModInstITermItr::getObject(uint id, ...) +{ + return _moditerm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModInstITermItr.h b/src/odb/src/db/dbModInstITermItr.h new file mode 100644 index 00000000000..60459a1b63b --- /dev/null +++ b/src/odb/src/db/dbModInstITermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModITerm; + +template +class dbTable; + +class dbModInstITermItr : public dbIterator +{ + public: + dbModInstITermItr(dbTable<_dbModITerm>* moditerm_tbl) + { + _moditerm_tbl = moditerm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModITerm>* _moditerm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModInstModITermItr.cpp b/src/odb/src/db/dbModInstModITermItr.cpp new file mode 100644 index 00000000000..7d81bb05866 --- /dev/null +++ b/src/odb/src/db/dbModInstModITermItr.cpp @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModInstModITermItr.h" + +#include "dbModITerm.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModInstModITermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModInstModITermItr::reversible() +{ + return true; +} + +bool dbModInstModITermItr::orderReversed() +{ + return true; +} + +void dbModInstModITermItr::reverse(dbObject* parent) +{ +} + +uint dbModInstModITermItr::sequential() +{ + return 0; +} + +uint dbModInstModITermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModInstModITermItr::begin(parent); + id != dbModInstModITermItr::end(parent); + id = dbModInstModITermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModInstModITermItr::begin(dbObject* parent) +{ +} + +uint dbModInstModITermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModInstModITermItr::next(uint id, ...) +{ +} + +dbObject* dbModInstModITermItr::getObject(uint id, ...) +{ + return _moditerm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp \ No newline at end of file diff --git a/src/odb/src/db/dbModInstModITermItr.h b/src/odb/src/db/dbModInstModITermItr.h new file mode 100644 index 00000000000..e21308f33d0 --- /dev/null +++ b/src/odb/src/db/dbModInstModITermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModITerm; + +template +class dbTable; + +class dbModInstModITermItr : public dbIterator +{ + public: + dbModInstModITermItr(dbTable<_dbModITerm>* moditerm_tbl) + { + _moditerm_tbl = moditerm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModITerm>* _moditerm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModNet.cpp b/src/odb/src/db/dbModNet.cpp new file mode 100644 index 00000000000..dc4d9a8b647 --- /dev/null +++ b/src/odb/src/db/dbModNet.cpp @@ -0,0 +1,253 @@ +////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2022, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModNet.h" + +#include "db.h" +#include "dbBlock.h" +#include "dbDatabase.h" +#include "dbDiff.hpp" +#include "dbHashTable.hpp" +#include "dbITerm.h" +#include "dbModBTerm.h" +#include "dbModITerm.h" +#include "dbModInst.h" +#include "dbModule.h" +#include "dbTable.h" +#include "dbTable.hpp" +#include "dbVector.h" +// User Code Begin Includes +#include "dbModuleModNetBTermItr.h" +#include "dbModuleModNetITermItr.h" +#include "dbModuleModNetModBTermItr.h" +#include "dbModuleModNetModITermItr.h" +// User Code End Includes +namespace odb { +template class dbTable<_dbModNet>; + +bool _dbModNet::operator==(const _dbModNet& rhs) const +{ + if (_name != rhs._name) { + return false; + } + if (_parent != rhs._parent) { + return false; + } + if (_next_entry != rhs._next_entry) { + return false; + } + if (_moditerms != rhs._moditerms) { + return false; + } + if (_modbterms != rhs._modbterms) { + return false; + } + if (_iterms != rhs._iterms) { + return false; + } + if (_bterms != rhs._bterms) { + return false; + } + + return true; +} + +bool _dbModNet::operator<(const _dbModNet& rhs) const +{ + return true; +} + +void _dbModNet::differences(dbDiff& diff, + const char* field, + const _dbModNet& rhs) const +{ + DIFF_BEGIN + DIFF_FIELD(_name); + DIFF_FIELD(_parent); + DIFF_FIELD(_next_entry); + DIFF_FIELD(_moditerms); + DIFF_FIELD(_modbterms); + DIFF_FIELD(_iterms); + DIFF_FIELD(_bterms); + DIFF_END +} + +void _dbModNet::out(dbDiff& diff, char side, const char* field) const +{ + DIFF_OUT_BEGIN + DIFF_OUT_FIELD(_name); + DIFF_OUT_FIELD(_parent); + DIFF_OUT_FIELD(_next_entry); + DIFF_OUT_FIELD(_moditerms); + DIFF_OUT_FIELD(_modbterms); + DIFF_OUT_FIELD(_iterms); + DIFF_OUT_FIELD(_bterms); + + DIFF_END +} + +_dbModNet::_dbModNet(_dbDatabase* db) +{ +} + +_dbModNet::_dbModNet(_dbDatabase* db, const _dbModNet& r) +{ + _name = r._name; + _parent = r._parent; + _next_entry = r._next_entry; + _moditerms = r._moditerms; + _modbterms = r._modbterms; + _iterms = r._iterms; + _bterms = r._bterms; +} + +dbIStream& operator>>(dbIStream& stream, _dbModNet& obj) +{ + stream >> obj._name; + stream >> obj._parent; + stream >> obj._next_entry; + stream >> obj._moditerms; + stream >> obj._modbterms; + stream >> obj._iterms; + stream >> obj._bterms; + return stream; +} + +dbOStream& operator<<(dbOStream& stream, const _dbModNet& obj) +{ + stream << obj._name; + stream << obj._parent; + stream << obj._next_entry; + stream << obj._moditerms; + stream << obj._modbterms; + stream << obj._iterms; + stream << obj._bterms; + return stream; +} + +_dbModNet::~_dbModNet() +{ + if (_name) { + free((void*) _name); + } +} + +//////////////////////////////////////////////////////////////////// +// +// dbModNet - Methods +// +//////////////////////////////////////////////////////////////////// + +dbModule* dbModNet::getParent() const +{ + _dbModNet* obj = (_dbModNet*) this; + if (obj->_parent == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModule*) par->_module_tbl->getPtr(obj->_parent); +} + +// User Code Begin dbModNetPublicMethods + +const char* dbModNet::getName() const +{ + _dbModNet* obj = (_dbModNet*) this; + return obj->_name; +} + +dbModNet* dbModNet::create(dbModule* parentModule, const char* name) +{ + // give illusion of scoping. + _dbModule* parent = (_dbModule*) parentModule; + _dbBlock* block = (_dbBlock*) parent->getOwner(); + _dbModNet* modnet = block->_modnet_tbl->create(); + // defaults + modnet->_name = strdup(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; +} + +dbSet dbModNet::getModITerms() +{ + _dbModNet* _mod_net = (_dbModNet*) this; + _dbBlock* _block = (_dbBlock*) _mod_net->getOwner(); + return dbSet(_mod_net, _block->_module_modnet_moditerm_itr); +} + +dbSet dbModNet::getModBTerms() +{ + _dbModNet* _mod_net = (_dbModNet*) this; + _dbBlock* _block = (_dbBlock*) _mod_net->getOwner(); + return dbSet(_mod_net, _block->_module_modnet_modbterm_itr); +} + +dbSet dbModNet::getBTerms() +{ + _dbModNet* _mod_net = (_dbModNet*) this; + _dbBlock* _block = (_dbBlock*) _mod_net->getOwner(); + return dbSet(_mod_net, _block->_module_modnet_bterm_itr); +} + +dbSet dbModNet::getITerms() +{ + _dbModNet* _mod_net = (_dbModNet*) this; + _dbBlock* _block = (_dbBlock*) _mod_net->getOwner(); + 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/dbModNet.h b/src/odb/src/db/dbModNet.h new file mode 100644 index 00000000000..0d7a952cb8a --- /dev/null +++ b/src/odb/src/db/dbModNet.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2022, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbCore.h" +#include "dbVector.h" +#include "odb.h" + +namespace odb { +class dbIStream; +class dbOStream; +class dbDiff; +class _dbDatabase; +class _dbModule; +class _dbModITerm; +class _dbModBTerm; +class _dbITerm; +class _dbBTerm; + +class _dbModNet : public _dbObject +{ + public: + _dbModNet(_dbDatabase*, const _dbModNet& r); + _dbModNet(_dbDatabase*); + + ~_dbModNet(); + + bool operator==(const _dbModNet& rhs) const; + bool operator!=(const _dbModNet& rhs) const { return !operator==(rhs); } + bool operator<(const _dbModNet& rhs) const; + void differences(dbDiff& diff, const char* field, const _dbModNet& rhs) const; + void out(dbDiff& diff, char side, const char* field) const; + + char* _name; + dbId<_dbModule> _parent; + dbId<_dbModNet> _next_entry; + dbId<_dbModITerm> _moditerms; + dbId<_dbModBTerm> _modbterms; + dbId<_dbITerm> _iterms; + dbId<_dbBTerm> _bterms; +}; +dbIStream& operator>>(dbIStream& stream, _dbModNet& obj); +dbOStream& operator<<(dbOStream& stream, const _dbModNet& obj); +} // namespace odb + // Generator Code End Header diff --git a/src/odb/src/db/dbModule.cpp b/src/odb/src/db/dbModule.cpp index 9d774958722..280b9db8c54 100644 --- a/src/odb/src/db/dbModule.cpp +++ b/src/odb/src/db/dbModule.cpp @@ -38,6 +38,9 @@ #include "dbDatabase.h" #include "dbDiff.hpp" #include "dbHashTable.hpp" +#include "dbInst.h" +#include "dbModBTerm.h" +#include "dbModInst.h" #include "dbTable.h" #include "dbTable.hpp" // User Code Begin Includes @@ -45,8 +48,11 @@ #include "dbInst.h" #include "dbModInst.h" +#include "dbModNet.h" #include "dbModuleInstItr.h" +#include "dbModuleModBTermItr.h" #include "dbModuleModInstItr.h" +#include "dbModuleModNetItr.h" #include "utl/Logger.h" // User Code End Includes namespace odb { @@ -63,10 +69,16 @@ bool _dbModule::operator==(const _dbModule& rhs) const if (_insts != rhs._insts) { return false; } + if (_mod_inst != rhs._mod_inst) { + return false; + } if (_modinsts != rhs._modinsts) { return false; } - if (_mod_inst != rhs._mod_inst) { + if (_modnets != rhs._modnets) { + return false; + } + if (_modbterms != rhs._modbterms) { return false; } @@ -90,8 +102,10 @@ void _dbModule::differences(dbDiff& diff, DIFF_FIELD(_name); DIFF_FIELD(_next_entry); DIFF_FIELD(_insts); - DIFF_FIELD(_modinsts); DIFF_FIELD(_mod_inst); + DIFF_FIELD(_modinsts); + DIFF_FIELD(_modnets); + DIFF_FIELD(_modbterms); DIFF_END } @@ -101,8 +115,10 @@ void _dbModule::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD(_name); DIFF_OUT_FIELD(_next_entry); DIFF_OUT_FIELD(_insts); - DIFF_OUT_FIELD(_modinsts); DIFF_OUT_FIELD(_mod_inst); + DIFF_OUT_FIELD(_modinsts); + DIFF_OUT_FIELD(_modnets); + DIFF_OUT_FIELD(_modbterms); DIFF_END } @@ -122,8 +138,10 @@ _dbModule::_dbModule(_dbDatabase* db, const _dbModule& r) _name = r._name; _next_entry = r._next_entry; _insts = r._insts; - _modinsts = r._modinsts; _mod_inst = r._mod_inst; + _modinsts = r._modinsts; + _modnets = r._modnets; + _modbterms = r._modbterms; } dbIStream& operator>>(dbIStream& stream, _dbModule& obj) @@ -131,8 +149,10 @@ dbIStream& operator>>(dbIStream& stream, _dbModule& obj) stream >> obj._name; stream >> obj._next_entry; stream >> obj._insts; - stream >> obj._modinsts; stream >> obj._mod_inst; + stream >> obj._modinsts; + stream >> obj._modnets; + stream >> obj._modbterms; return stream; } @@ -141,8 +161,10 @@ dbOStream& operator<<(dbOStream& stream, const _dbModule& obj) stream << obj._name; stream << obj._next_entry; stream << obj._insts; - stream << obj._modinsts; stream << obj._mod_inst; + stream << obj._modinsts; + stream << obj._modnets; + stream << obj._modbterms; return stream; } @@ -165,6 +187,13 @@ const char* dbModule::getName() const return obj->_name; } +void dbModule::setModInst(dbModInst* mod_inst) +{ + _dbModule* obj = (_dbModule*) this; + + obj->_mod_inst = mod_inst->getImpl()->getOID(); +} + dbModInst* dbModule::getModInst() const { _dbModule* obj = (_dbModule*) this; @@ -176,6 +205,43 @@ 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() +{ + _dbModule* module = (_dbModule*) this; + _dbBlock* block = (_dbBlock*) module->getOwner(); + return (dbSet(module, block->_module_modinst_itr)).size(); +} + +unsigned dbModule::getDbInstCount() +{ + _dbModule* module = (_dbModule*) this; + _dbBlock* block = (_dbBlock*) module->getOwner(); + return dbSet(module, block->_module_inst_itr).size(); +} + void dbModule::addInst(dbInst* inst) { _dbModule* module = (_dbModule*) this; @@ -210,23 +276,24 @@ void dbModule::addInst(dbInst* inst) _inst->_module = module->getOID(); - if (module->_insts != 0) { - _dbInst* tail = block->_inst_tbl->getPtr(module->_insts); - _inst->_module_next = module->_insts; - _inst->_module_prev = 0; - tail->_module_prev = _inst->getOID(); - } else { + if (module->_insts == 0) { _inst->_module_next = 0; _inst->_module_prev = 0; + module->_insts = _inst->getOID(); + } else { + _dbInst* cur_head = block->_inst_tbl->getPtr(module->_insts); + _inst->_module_next = module->_insts; + module->_insts = _inst->getOID(); + cur_head->_module_prev = _inst->getOID(); } - - module->_insts = _inst->getOID(); } void _dbModule::removeInst(dbInst* inst) { _dbModule* module = (_dbModule*) this; _dbInst* _inst = (_dbInst*) inst; + uint id = _inst->getOID(); + if (_inst->_module != getOID()) return; @@ -239,7 +306,6 @@ void _dbModule::removeInst(dbInst* inst) } _dbBlock* block = (_dbBlock*) getOwner(); - uint id = _inst->getOID(); if (module->_insts == id) { module->_insts = _inst->_module_next; @@ -259,7 +325,6 @@ void _dbModule::removeInst(dbInst* inst) prev->_module_next = _inst->_module_next; } } - _inst->_module = 0; _inst->_module_next = 0; _inst->_module_prev = 0; @@ -272,6 +337,36 @@ dbSet dbModule::getChildren() return dbSet(module, block->_module_modinst_itr); } +dbSet dbModule::getModNets() +{ + _dbModule* module = (_dbModule*) this; + _dbBlock* block = (_dbBlock*) module->getOwner(); + return dbSet(module, block->_module_modnet_itr); +} + +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; + _dbBlock* block = (_dbBlock*) module->getOwner(); + return dbSet(module, block->_module_modinst_itr); +} + +dbSet dbModule::getModBTerms() +{ + _dbModule* module = (_dbModule*) this; + _dbBlock* block = (_dbBlock*) module->getOwner(); + return dbSet(module, block->_module_modbterm_itr); +} + dbSet dbModule::getInsts() { _dbModule* module = (_dbModule*) this; @@ -332,10 +427,20 @@ dbModule* dbModule::getModule(dbBlock* block_, uint dbid_) dbModInst* dbModule::findModInst(const char* name) { - _dbModule* obj = (_dbModule*) this; - _dbBlock* par = (_dbBlock*) obj->getOwner(); - std::string h_name = std::string(obj->_name) + "/" + std::string(name); - return (dbModInst*) par->_modinst_hash.find(h_name.c_str()); + for (dbModInst* mod_inst : getModInsts()) { + if (!strcmp(mod_inst->getName(), name)) + return mod_inst; + } + return nullptr; +} + +dbInst* dbModule::findDbInst(const char* name) +{ + for (dbInst* inst : getInsts()) { + if (!strcmp(inst->getName().c_str(), name)) + return inst; + } + return nullptr; } static void getLeafInsts(dbModule* module, std::vector& insts) @@ -356,6 +461,33 @@ std::vector dbModule::getLeafInsts() return insts; } +dbModBTerm* dbModule::findModBTerm(const char* name) +{ + std::string bterm_name(name); + size_t last_idx = bterm_name.find_last_of("/"); + if (last_idx != std::string::npos) + bterm_name = bterm_name.substr(last_idx + 1); + + for (dbModBTerm* mod_bterm : getModBTerms()) { + if (!strcmp(mod_bterm->getName(), bterm_name.c_str())) { + return mod_bterm; + } + } + 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(); @@ -366,6 +498,24 @@ std::string dbModule::getHierarchicalName() const } } +void* dbModule::getStaCell() +{ + _dbModule* module = (_dbModule*) this; + return module->_sta_cell; +} + +void dbModule::staSetCell(void* cell) +{ + _dbModule* module = (_dbModule*) this; + module->_sta_cell = cell; +} + +dbBlock* dbModule::getOwner() +{ + _dbModule* obj = (_dbModule*) this; + return (dbBlock*) obj->getOwner(); +} + // User Code End dbModulePublicMethods } // namespace odb -// Generator Code End Cpp + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModule.h b/src/odb/src/db/dbModule.h index 8a2727670f1..abad164edf3 100644 --- a/src/odb/src/db/dbModule.h +++ b/src/odb/src/db/dbModule.h @@ -34,8 +34,9 @@ #pragma once #include "dbCore.h" +#include "dbSet.h" +#include "dbVector.h" #include "odb.h" - // User Code Begin Includes #include "dbHashTable.h" // User Code End Includes @@ -47,6 +48,8 @@ class dbDiff; class _dbDatabase; class _dbInst; class _dbModInst; +class _dbModNet; +class _dbModBTerm; class _dbModule : public _dbObject { @@ -71,8 +74,14 @@ class _dbModule : public _dbObject char* _name; dbId<_dbModule> _next_entry; dbId<_dbInst> _insts; - dbId<_dbModInst> _modinsts; dbId<_dbModInst> _mod_inst; + dbId<_dbModInst> _modinsts; + dbId<_dbModNet> _modnets; + dbId<_dbModBTerm> _modbterms; + + // User Code Begin Fields + void* _sta_cell; + // User Code End Fields }; dbIStream& operator>>(dbIStream& stream, _dbModule& obj); dbOStream& operator<<(dbOStream& stream, const _dbModule& obj); diff --git a/src/odb/src/db/dbModuleBTermItr.cpp b/src/odb/src/db/dbModuleBTermItr.cpp new file mode 100644 index 00000000000..95d66617645 --- /dev/null +++ b/src/odb/src/db/dbModuleBTermItr.cpp @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleBTermItr.h" + +#include "dbModBTerm.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleBTermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleBTermItr::reversible() +{ + return true; +} + +bool dbModuleBTermItr::orderReversed() +{ + return true; +} + +void dbModuleBTermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleBTermItr::sequential() +{ + return 0; +} + +uint dbModuleBTermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleBTermItr::begin(parent); + id != dbModuleBTermItr::end(parent); + id = dbModuleBTermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleBTermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModule* _module = (_dbModule*) parent; + _dbModBTerm* _modbterm = _module->_modbterms; + // User Code End begin +} + +uint dbModuleBTermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleBTermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModITerm* modbterm = _modbterm_tbl->getPtr(id); + return modbterm->_next_entry; + // User Code End next +} + +dbObject* dbModuleBTermItr::getObject(uint id, ...) +{ + return _modbterm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleBTermItr.h b/src/odb/src/db/dbModuleBTermItr.h new file mode 100644 index 00000000000..2b14398be99 --- /dev/null +++ b/src/odb/src/db/dbModuleBTermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModBTerm; + +template +class dbTable; + +class dbModuleBTermItr : public dbIterator +{ + public: + dbModuleBTermItr(dbTable<_dbModBTerm>* modbterm_tbl) + { + _modbterm_tbl = modbterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModBTerm>* _modbterm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModBTermItr.cpp b/src/odb/src/db/dbModuleModBTermItr.cpp new file mode 100644 index 00000000000..e8cd6a80b52 --- /dev/null +++ b/src/odb/src/db/dbModuleModBTermItr.cpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModBTermItr.h" + +#include "dbModBTerm.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModBTermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModBTermItr::reversible() +{ + return true; +} + +bool dbModuleModBTermItr::orderReversed() +{ + return true; +} + +void dbModuleModBTermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModBTermItr::sequential() +{ + return 0; +} + +uint dbModuleModBTermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModBTermItr::begin(parent); + id != dbModuleModBTermItr::end(parent); + id = dbModuleModBTermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModBTermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModule* _module = (_dbModule*) parent; + return _module->_modbterms; + // User Code End begin +} + +uint dbModuleModBTermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModBTermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModBTerm* modbterm = _modbterm_tbl->getPtr(id); + return modbterm->_next_entry; + // User Code End next +} + +dbObject* dbModuleModBTermItr::getObject(uint id, ...) +{ + return _modbterm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModBTermItr.h b/src/odb/src/db/dbModuleModBTermItr.h new file mode 100644 index 00000000000..675407eeba2 --- /dev/null +++ b/src/odb/src/db/dbModuleModBTermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModBTerm; + +template +class dbTable; + +class dbModuleModBTermItr : public dbIterator +{ + public: + dbModuleModBTermItr(dbTable<_dbModBTerm>* modbterm_tbl) + { + _modbterm_tbl = modbterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModBTerm>* _modbterm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModInstITermItr.cpp b/src/odb/src/db/dbModuleModInstITermItr.cpp new file mode 100644 index 00000000000..92a143681d2 --- /dev/null +++ b/src/odb/src/db/dbModuleModInstITermItr.cpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModInstITermItr.h" + +#include "dbModITerm.h" +#include "dbModInst.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModInstITermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModInstITermItr::reversible() +{ + return true; +} + +bool dbModuleModInstITermItr::orderReversed() +{ + return true; +} + +void dbModuleModInstITermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModInstITermItr::sequential() +{ + return 0; +} + +uint dbModuleModInstITermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModInstITermItr::begin(parent); + id != dbModuleModInstITermItr::end(parent); + id = dbModuleModInstITermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModInstITermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModInst* _mod_inst = (_dbModInst*) parent; + return _mod_inst->_moditerms; + // User Code End begin +} + +uint dbModuleModInstITermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModInstITermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModITerm* moditerm = _moditerm_tbl->getPtr(id); + return moditerm->_next_entry; + // User Code End next +} + +dbObject* dbModuleModInstITermItr::getObject(uint id, ...) +{ + return _moditerm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModInstITermItr.h b/src/odb/src/db/dbModuleModInstITermItr.h new file mode 100644 index 00000000000..955b1b29529 --- /dev/null +++ b/src/odb/src/db/dbModuleModInstITermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModInst; + +template +class dbTable; + +class dbModuleModInstITermItr : public dbIterator +{ + public: + dbModuleModInstITermItr(dbTable<_dbModInst>* moditerm_tbl) + { + _moditerm_tbl = moditerm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModInst>* _moditerm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModInstItr.cpp b/src/odb/src/db/dbModuleModInstItr.cpp index 624a504820e..ef8839cf6d3 100644 --- a/src/odb/src/db/dbModuleModInstItr.cpp +++ b/src/odb/src/db/dbModuleModInstItr.cpp @@ -117,4 +117,4 @@ dbObject* dbModuleModInstItr::getObject(uint id, ...) return _modinst_tbl->getPtr(id); } } // namespace odb - // Generator Code End Cpp \ No newline at end of file + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModInstModITermItr.cpp b/src/odb/src/db/dbModuleModInstModITermItr.cpp new file mode 100644 index 00000000000..57b25065653 --- /dev/null +++ b/src/odb/src/db/dbModuleModInstModITermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModInstModITermItr.h" + +#include "dbModITerm.h" +#include "dbModInst.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModInstModITermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModInstModITermItr::reversible() +{ + return true; +} + +bool dbModuleModInstModITermItr::orderReversed() +{ + return true; +} + +void dbModuleModInstModITermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModInstModITermItr::sequential() +{ + return 0; +} + +uint dbModuleModInstModITermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModInstModITermItr::begin(parent); + id != dbModuleModInstModITermItr::end(parent); + id = dbModuleModInstModITermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModInstModITermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModInst* mod_inst = (_dbModInst*) parent; + return mod_inst->_moditerms; + // User Code End begin +} + +uint dbModuleModInstModITermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModInstModITermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModITerm* moditerm = _moditerm_tbl->getPtr(id); + return moditerm->_next_entry; + // User Code End next +} + +dbObject* dbModuleModInstModITermItr::getObject(uint id, ...) +{ + return _moditerm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModInstModITermItr.h b/src/odb/src/db/dbModuleModInstModITermItr.h new file mode 100644 index 00000000000..34f8cbe2ca5 --- /dev/null +++ b/src/odb/src/db/dbModuleModInstModITermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModITerm; + +template +class dbTable; + +class dbModuleModInstModITermItr : public dbIterator +{ + public: + dbModuleModInstModITermItr(dbTable<_dbModITerm>* moditerm_tbl) + { + _moditerm_tbl = moditerm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModITerm>* _moditerm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetBTermItr.cpp b/src/odb/src/db/dbModuleModNetBTermItr.cpp new file mode 100644 index 00000000000..1c0acaf8555 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetBTermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetBTermItr.h" + +#include "dbBTerm.h" +#include "dbModNet.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetBTermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetBTermItr::reversible() +{ + return true; +} + +bool dbModuleModNetBTermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetBTermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModNetBTermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetBTermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetBTermItr::begin(parent); + id != dbModuleModNetBTermItr::end(parent); + id = dbModuleModNetBTermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetBTermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModNet* mod_net = (_dbModNet*) parent; + return mod_net->_bterms; + // User Code End begin +} + +uint dbModuleModNetBTermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetBTermItr::next(uint id, ...) +{ + // User Code Begin next + _dbBTerm* _bterm = _bterm_tbl->getPtr(id); + return _bterm->_next_modnet_bterm; + // User Code End next +} + +dbObject* dbModuleModNetBTermItr::getObject(uint id, ...) +{ + return _bterm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModNetBTermItr.h b/src/odb/src/db/dbModuleModNetBTermItr.h new file mode 100644 index 00000000000..5d7c61b4e8f --- /dev/null +++ b/src/odb/src/db/dbModuleModNetBTermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbBTerm; + +template +class dbTable; + +class dbModuleModNetBTermItr : public dbIterator +{ + public: + dbModuleModNetBTermItr(dbTable<_dbBTerm>* bterm_tbl) + { + _bterm_tbl = bterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbBTerm>* _bterm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetBtermItr.cpp b/src/odb/src/db/dbModuleModNetBtermItr.cpp new file mode 100644 index 00000000000..955b21d225b --- /dev/null +++ b/src/odb/src/db/dbModuleModNetBtermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetBtermItr.h" + +#include "dbModNet.h" +#include "dbTable.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetBtermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetBtermItr::reversible() +{ + return true; +} + +bool dbModuleModNetBtermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetBtermItr::reverse(dbObject* parent) +{ + // User Code Begin reverse + // User Code End reverse +} + +uint dbModuleModNetBtermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetBtermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetBtermItr::begin(parent); + id != dbModuleModNetBtermItr::end(parent); + id = dbModuleModNetBtermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetBtermItr::begin(dbObject* parent) +{ + // User Code Begin begin + // User Code End begin +} + +uint dbModuleModNetBtermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetBtermItr::next(uint id, ...) +{ + // User Code Begin next + // User Code End next +} + +dbObject* dbModuleModNetBtermItr::getObject(uint id, ...) +{ + return _bterm_tbl->getPtr(id); +} +// User Code Begin Methods +// User Code End Methods +} // namespace odb + // Generator Code End Cpp \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetBtermItr.h b/src/odb/src/db/dbModuleModNetBtermItr.h new file mode 100644 index 00000000000..26fbcf14b29 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetBtermItr.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { +class _dbModNet; + +template +class dbTable; + +// User Code Begin classes +// User Code End classes + +class dbModuleModNetBtermItr : public dbIterator +{ + public: + dbModuleModNetBtermItr(dbTable<_dbModNet>* bterm_tbl) + { + _bterm_tbl = bterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + // User Code Begin Methods + // User Code End Methods + private: + dbTable<_dbModNet>* _bterm_tbl; + // User Code Begin Fields + // User Code End Fields +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetITermItr.cpp b/src/odb/src/db/dbModuleModNetITermItr.cpp new file mode 100644 index 00000000000..16f9a3ab527 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetITermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetITermItr.h" + +#include "dbITerm.h" +#include "dbModNet.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetITermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetITermItr::reversible() +{ + return true; +} + +bool dbModuleModNetITermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetITermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModNetITermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetITermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetITermItr::begin(parent); + id != dbModuleModNetITermItr::end(parent); + id = dbModuleModNetITermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetITermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModNet* mod_net = (_dbModNet*) parent; + return mod_net->_iterms; + // User Code End begin +} + +uint dbModuleModNetITermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetITermItr::next(uint id, ...) +{ + // User Code Begin next + _dbITerm* _iterm = _iterm_tbl->getPtr(id); + return _iterm->_next_modnet_iterm; + // User Code End next +} + +dbObject* dbModuleModNetITermItr::getObject(uint id, ...) +{ + return _iterm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModNetITermItr.h b/src/odb/src/db/dbModuleModNetITermItr.h new file mode 100644 index 00000000000..81ae1ca2d86 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetITermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbITerm; + +template +class dbTable; + +class dbModuleModNetITermItr : public dbIterator +{ + public: + dbModuleModNetITermItr(dbTable<_dbITerm>* iterm_tbl) + { + _iterm_tbl = iterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbITerm>* _iterm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetItermItr.cpp b/src/odb/src/db/dbModuleModNetItermItr.cpp new file mode 100644 index 00000000000..b0638c022b3 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetItermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetItermItr.h" + +#include "dbModNet.h" +#include "dbTable.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetItermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetItermItr::reversible() +{ + return true; +} + +bool dbModuleModNetItermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetItermItr::reverse(dbObject* parent) +{ + // User Code Begin reverse + // User Code End reverse +} + +uint dbModuleModNetItermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetItermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetItermItr::begin(parent); + id != dbModuleModNetItermItr::end(parent); + id = dbModuleModNetItermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetItermItr::begin(dbObject* parent) +{ + // User Code Begin begin + // User Code End begin +} + +uint dbModuleModNetItermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetItermItr::next(uint id, ...) +{ + // User Code Begin next + // User Code End next +} + +dbObject* dbModuleModNetItermItr::getObject(uint id, ...) +{ + return _iterm_tbl->getPtr(id); +} +// User Code Begin Methods +// User Code End Methods +} // namespace odb + // Generator Code End Cpp \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetItermItr.h b/src/odb/src/db/dbModuleModNetItermItr.h new file mode 100644 index 00000000000..73b41db4500 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetItermItr.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { +class _dbModNet; + +template +class dbTable; + +// User Code Begin classes +// User Code End classes + +class dbModuleModNetItermItr : public dbIterator +{ + public: + dbModuleModNetItermItr(dbTable<_dbModNet>* iterm_tbl) + { + _iterm_tbl = iterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + // User Code Begin Methods + // User Code End Methods + private: + dbTable<_dbModNet>* _iterm_tbl; + // User Code Begin Fields + // User Code End Fields +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetItr.cpp b/src/odb/src/db/dbModuleModNetItr.cpp new file mode 100644 index 00000000000..16de8605bf1 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetItr.cpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetItr.h" + +#include "dbModNet.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetItr::reversible() +{ + return true; +} + +bool dbModuleModNetItr::orderReversed() +{ + return true; +} + +void dbModuleModNetItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModNetItr::sequential() +{ + return 0; +} + +uint dbModuleModNetItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetItr::begin(parent); + id != dbModuleModNetItr::end(parent); + id = dbModuleModNetItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModule* module = (_dbModule*) parent; + return module->_modnets; + // User Code End begin +} + +uint dbModuleModNetItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetItr::next(uint id, ...) +{ + // User Code Begin next + _dbModNet* modnet = _modnet_tbl->getPtr(id); + return modnet->_next_entry; + // User Code End next +} + +dbObject* dbModuleModNetItr::getObject(uint id, ...) +{ + return _modnet_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModNetItr.h b/src/odb/src/db/dbModuleModNetItr.h new file mode 100644 index 00000000000..3861c02bdfd --- /dev/null +++ b/src/odb/src/db/dbModuleModNetItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModNet; + +template +class dbTable; + +class dbModuleModNetItr : public dbIterator +{ + public: + dbModuleModNetItr(dbTable<_dbModNet>* modnet_tbl) + { + _modnet_tbl = modnet_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModNet>* _modnet_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetModBTermItr.cpp b/src/odb/src/db/dbModuleModNetModBTermItr.cpp new file mode 100644 index 00000000000..58acd17d7ea --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModBTermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetModBTermItr.h" + +#include "dbModBTerm.h" +#include "dbModNet.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetModBTermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetModBTermItr::reversible() +{ + return true; +} + +bool dbModuleModNetModBTermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetModBTermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModNetModBTermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetModBTermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetModBTermItr::begin(parent); + id != dbModuleModNetModBTermItr::end(parent); + id = dbModuleModNetModBTermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetModBTermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModNet* mod_net = (_dbModNet*) parent; + return mod_net->_modbterms; + // User Code End begin +} + +uint dbModuleModNetModBTermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetModBTermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModBTerm* _modbterm = _modbterm_tbl->getPtr(id); + return _modbterm->_next_net_modbterm; + // User Code End next +} + +dbObject* dbModuleModNetModBTermItr::getObject(uint id, ...) +{ + return _modbterm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModNetModBTermItr.h b/src/odb/src/db/dbModuleModNetModBTermItr.h new file mode 100644 index 00000000000..2a436814403 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModBTermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModBTerm; + +template +class dbTable; + +class dbModuleModNetModBTermItr : public dbIterator +{ + public: + dbModuleModNetModBTermItr(dbTable<_dbModBTerm>* modbterm_tbl) + { + _modbterm_tbl = modbterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModBTerm>* _modbterm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetModBtermItr.cpp b/src/odb/src/db/dbModuleModNetModBtermItr.cpp new file mode 100644 index 00000000000..5b323c0cdea --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModBtermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetModBtermItr.h" + +#include "dbModNet.h" +#include "dbTable.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetModBtermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetModBtermItr::reversible() +{ + return true; +} + +bool dbModuleModNetModBtermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetModBtermItr::reverse(dbObject* parent) +{ + // User Code Begin reverse + // User Code End reverse +} + +uint dbModuleModNetModBtermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetModBtermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetModBtermItr::begin(parent); + id != dbModuleModNetModBtermItr::end(parent); + id = dbModuleModNetModBtermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetModBtermItr::begin(dbObject* parent) +{ + // User Code Begin begin + // User Code End begin +} + +uint dbModuleModNetModBtermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetModBtermItr::next(uint id, ...) +{ + // User Code Begin next + // User Code End next +} + +dbObject* dbModuleModNetModBtermItr::getObject(uint id, ...) +{ + return _modbterm_tbl->getPtr(id); +} +// User Code Begin Methods +// User Code End Methods +} // namespace odb + // Generator Code End Cpp \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetModBtermItr.h b/src/odb/src/db/dbModuleModNetModBtermItr.h new file mode 100644 index 00000000000..56dbb114793 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModBtermItr.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { +class _dbModNet; + +template +class dbTable; + +// User Code Begin classes +// User Code End classes + +class dbModuleModNetModBtermItr : public dbIterator +{ + public: + dbModuleModNetModBtermItr(dbTable<_dbModNet>* modbterm_tbl) + { + _modbterm_tbl = modbterm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + // User Code Begin Methods + // User Code End Methods + private: + dbTable<_dbModNet>* _modbterm_tbl; + // User Code Begin Fields + // User Code End Fields +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetModITermItr.cpp b/src/odb/src/db/dbModuleModNetModITermItr.cpp new file mode 100644 index 00000000000..00647765a85 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModITermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetModITermItr.h" + +#include "dbModITerm.h" +#include "dbModNet.h" +#include "dbModule.h" +#include "dbTable.h" + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetModITermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetModITermItr::reversible() +{ + return true; +} + +bool dbModuleModNetModITermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetModITermItr::reverse(dbObject* parent) +{ +} + +uint dbModuleModNetModITermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetModITermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetModITermItr::begin(parent); + id != dbModuleModNetModITermItr::end(parent); + id = dbModuleModNetModITermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetModITermItr::begin(dbObject* parent) +{ + // User Code Begin begin + _dbModNet* mod_net = (_dbModNet*) parent; + return mod_net->_moditerms; + // User Code End begin +} + +uint dbModuleModNetModITermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetModITermItr::next(uint id, ...) +{ + // User Code Begin next + _dbModITerm* _moditerm = _moditerm_tbl->getPtr(id); + return _moditerm->_next_net_moditerm; + // User Code End next +} + +dbObject* dbModuleModNetModITermItr::getObject(uint id, ...) +{ + return _moditerm_tbl->getPtr(id); +} +} // namespace odb + // Generator Code End Cpp diff --git a/src/odb/src/db/dbModuleModNetModITermItr.h b/src/odb/src/db/dbModuleModNetModITermItr.h new file mode 100644 index 00000000000..e5def76c8f8 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModITermItr.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" + +namespace odb { +class _dbModITerm; + +template +class dbTable; + +class dbModuleModNetModITermItr : public dbIterator +{ + public: + dbModuleModNetModITermItr(dbTable<_dbModITerm>* moditerm_tbl) + { + _moditerm_tbl = moditerm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + + private: + dbTable<_dbModITerm>* _moditerm_tbl; +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetModItermItr.cpp b/src/odb/src/db/dbModuleModNetModItermItr.cpp new file mode 100644 index 00000000000..812767e65f4 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModItermItr.cpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2019, Nefelus Inc +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Cpp +#include "dbModuleModNetModItermItr.h" + +#include "dbModNet.h" +#include "dbTable.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { + +//////////////////////////////////////////////////////////////////// +// +// dbModuleModNetModItermItr - Methods +// +//////////////////////////////////////////////////////////////////// + +bool dbModuleModNetModItermItr::reversible() +{ + return true; +} + +bool dbModuleModNetModItermItr::orderReversed() +{ + return true; +} + +void dbModuleModNetModItermItr::reverse(dbObject* parent) +{ + // User Code Begin reverse + // User Code End reverse +} + +uint dbModuleModNetModItermItr::sequential() +{ + return 0; +} + +uint dbModuleModNetModItermItr::size(dbObject* parent) +{ + uint id; + uint cnt = 0; + + for (id = dbModuleModNetModItermItr::begin(parent); + id != dbModuleModNetModItermItr::end(parent); + id = dbModuleModNetModItermItr::next(id)) + ++cnt; + + return cnt; +} + +uint dbModuleModNetModItermItr::begin(dbObject* parent) +{ + // User Code Begin begin + // User Code End begin +} + +uint dbModuleModNetModItermItr::end(dbObject* /* unused: parent */) +{ + return 0; +} + +uint dbModuleModNetModItermItr::next(uint id, ...) +{ + // User Code Begin next + // User Code End next +} + +dbObject* dbModuleModNetModItermItr::getObject(uint id, ...) +{ + return _moditerm_tbl->getPtr(id); +} +// User Code Begin Methods +// User Code End Methods +} // namespace odb + // Generator Code End Cpp \ No newline at end of file diff --git a/src/odb/src/db/dbModuleModNetModItermItr.h b/src/odb/src/db/dbModuleModNetModItermItr.h new file mode 100644 index 00000000000..fbd75084c90 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModItermItr.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// BSD 3-Clause License +// +// Copyright (c) 2020, The Regents of the University of California +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Generator Code Begin Header +#pragma once + +#include "dbIterator.h" +#include "odb.h" +// User Code Begin Includes +// User Code End Includes + +namespace odb { +class _dbModNet; + +template +class dbTable; + +// User Code Begin classes +// User Code End classes + +class dbModuleModNetModItermItr : public dbIterator +{ + public: + dbModuleModNetModItermItr(dbTable<_dbModNet>* moditerm_tbl) + { + _moditerm_tbl = moditerm_tbl; + } + + bool reversible() override; + bool orderReversed() override; + void reverse(dbObject* parent) override; + uint sequential() override; + uint size(dbObject* parent) override; + uint begin(dbObject* parent) override; + uint end(dbObject* parent) override; + uint next(uint id, ...) override; + dbObject* getObject(uint id, ...) override; + // User Code Begin Methods + // User Code End Methods + private: + dbTable<_dbModNet>* _moditerm_tbl; + // User Code Begin Fields + // User Code End Fields +}; + +} // namespace odb + // Generator Code End Header \ No newline at end of file diff --git a/src/odb/src/db/dbObject.cpp b/src/odb/src/db/dbObject.cpp index 212ecd6b80b..08c3b496a8f 100644 --- a/src/odb/src/db/dbObject.cpp +++ b/src/odb/src/db/dbObject.cpp @@ -99,7 +99,10 @@ static const char* name_tbl[] = {"dbDatabase", "dbLevelShifter", "dbLogicPort", "dbMetalWidthViaMap", + "dbModBTerm", "dbModInst", + "dbModITerm", + "dbModNet", "dbModule", "dbNetTrack", "dbPowerDomain", diff --git a/src/odb/src/db/dbTable.h b/src/odb/src/db/dbTable.h index eebb861000a..8c68687058a 100644 --- a/src/odb/src/db/dbTable.h +++ b/src/odb/src/db/dbTable.h @@ -111,8 +111,12 @@ class dbTable : public dbObjectTable, public dbIterator uint page = (uint) id >> _page_shift; uint offset = (uint) id & _page_mask; + if (!((uint) id != 0) && (page < _page_cnt)) + printf("at page error %u\n", (uint) id); assert(((uint) id != 0) && (page < _page_cnt)); T* p = (T*) &(_pages[page]->_objects[offset * sizeof(T)]); + if (!(p->_oid & DB_ALLOC_BIT)) + printf("Error point\n"); assert(p->_oid & DB_ALLOC_BIT); return p; } diff --git a/src/odb/test/data/design.odb b/src/odb/test/data/design.odb index a47c216f635..10c647d4458 100644 Binary files a/src/odb/test/data/design.odb and b/src/odb/test/data/design.odb differ