diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index 1f5a7a89978..205b2d3686a 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -44,6 +44,7 @@ #include "sta/PortDirection.hh" #include "utl/Logger.h" + //#define DEBUG_DBNW //#define DEBUG_BUS //#define DEBUG_HNAMES @@ -134,10 +135,10 @@ class DbInstanceChildIterator : public InstanceChildIterator dbModule* module_; std::vector child_modules_; bool top_; - std::vector>::iterator dbinst_iter_; - std::vector>::iterator dbinst_end_; - std::vector>::iterator modinst_iter_; - std::vector>::iterator modinst_end_; + dbSet::iterator dbinst_iter_; + dbSet::iterator dbinst_end_; + dbSet::iterator modinst_iter_; + dbSet::iterator modinst_end_; std::vector candidate_modules_; }; @@ -147,18 +148,18 @@ DbInstanceChildIterator::DbInstanceChildIterator(const Instance* instance, { dbBlock* block = network->block(); module_ = block->getTopModule(); - modinst_iter_ = module_->getModInstVec().end(); + modinst_iter_ = ((dbModule*)module_)->getModInsts().begin(); modinst_end_ = modinst_iter_; - dbinst_iter_ = module_->getDbInstVec().end(); + dbinst_iter_ = ((dbModule*)module_)->getInsts().begin(); dbinst_end_ = dbinst_iter_; - if (instance == network->topInstance()) { + if (instance == network->topInstance() && block) { module_ = block->getTopModule(); top_ = true; - modinst_iter_ = module_->getModInstVec().begin(); - modinst_end_ = module_->getModInstVec().end(); - dbinst_iter_ = module_->getDbInstVec().begin(); - dbinst_end_ = module_->getDbInstVec().end(); + modinst_iter_ = module_->getModInsts().begin(); + modinst_end_ = module_->getModInsts().end(); + dbinst_iter_ = module_->getInsts().begin(); + dbinst_end_ = module_->getInsts().end(); #ifdef DEBUG_DBNW printf("(top) Child iterator for instance %s\n", network_->name(instance)); printf("Number of db instances %u\n", module_->getDbInstCount()); @@ -172,10 +173,10 @@ DbInstanceChildIterator::DbInstanceChildIterator(const Instance* instance, network->staToDb(instance, db_inst, mod_inst); if (mod_inst) { module_ = mod_inst->getMaster(); - modinst_iter_ = module_->getModInstVec().begin(); - modinst_end_ = module_->getModInstVec().end(); - dbinst_iter_ = module_->getDbInstVec().begin(); - dbinst_end_ = module_->getDbInstVec().end(); + modinst_iter_ = module_->getModInsts().begin(); + modinst_end_ = module_->getModInsts().end(); + dbinst_iter_ = module_->getInsts().begin(); + dbinst_end_ = module_->getInsts().end(); #ifdef DEBUG_DBNW printf("(non-top/leaf)Child iterator for instance %s\n", network_->name(instance)); @@ -199,11 +200,11 @@ Instance* DbInstanceChildIterator::next() { Instance* ret = nullptr; if (dbinst_iter_ != dbinst_end_) { - dbInst* child = module_->getdbInst(*dbinst_iter_); + dbInst* child = *dbinst_iter_; dbinst_iter_++; ret = network_->dbToSta(child); } else if (modinst_iter_ != modinst_end_) { - dbModInst* child = module_->getModInst(*modinst_iter_); + dbModInst* child = *modinst_iter_; modinst_iter_++; ret = network_->dbToSta(child); } @@ -271,8 +272,8 @@ class DbInstancePinIterator : public InstancePinIterator dbSet::iterator bitr_; dbSet::iterator bitr_end_; // pins on a module instance - std::vector>::iterator mi_itr_; - std::vector>::iterator mi_itr_end_; + dbSet::iterator mi_itr_; + dbSet::iterator mi_itr_end_; Pin* next_; dbInst* db_inst_; @@ -297,8 +298,8 @@ DbInstancePinIterator::DbInstancePinIterator(const Instance* inst, iitr_ = db_inst_->getITerms().begin(); iitr_end_ = db_inst_->getITerms().end(); } else if (mod_inst_) { - mi_itr_ = mod_inst_->getPinVec().begin(); - mi_itr_end_ = mod_inst_->getPinVec().end(); + mi_itr_ = mod_inst_->getModITerms().begin(); + mi_itr_end_ = mod_inst_->getModITerms().end(); } } } @@ -326,7 +327,7 @@ bool DbInstancePinIterator::hasNext() } if (mi_itr_ != mi_itr_end_) { - dbModITerm* mod_iterm = mod_inst_->getdbModITerm(*mi_itr_); + dbModITerm* mod_iterm = *mi_itr_; next_ = network_->dbToSta(mod_iterm); mi_itr_++; return true; @@ -403,10 +404,24 @@ class DbNetTermIterator : public NetTermIterator DbNetTermIterator::DbNetTermIterator(const Net* net, const dbNetwork* network) : network_(network) { - dbNet* dnet = network_->staToDb(net); - dbSet terms = dnet->getBTerms(); - iter_ = terms.begin(); - end_ = terms.end(); + dbModNet* modnet=nullptr; + dbNet* dnet = nullptr; + network_ -> staToDb(net, dnet, modnet); + if (dnet && !modnet){ + dbSet terms = dnet->getBTerms(); + iter_ = terms.begin(); + end_ = terms.end(); + } + else if (modnet){ + dbSet terms = modnet->getBTerms(); + iter_ = terms.begin(); + end_ = terms.end(); + } + else{ + dbSet terms; + iter_= terms.begin(); + end_= terms.end(); + } } bool DbNetTermIterator::hasNext() @@ -512,7 +527,7 @@ class dbModulePortIterator : public CellPortIterator virtual Port* next(); private: - std::vector>::iterator iter_; + dbSet::iterator iter_; const dbModule* module_; const dbBlock* block_; }; @@ -526,22 +541,21 @@ dbModulePortIterator::dbModulePortIterator(const dbModule* cell, { module_ = cell; block_ = block; - iter_ = (const_cast(cell))->getPortVec().begin(); + iter_ = (const_cast(cell))->getModBTerms().begin(); } bool dbModulePortIterator::hasNext() { - if (iter_ == (const_cast(module_))->getPortVec().end()) + if (iter_ == (const_cast(module_))->getModBTerms().end()) return false; return true; } Port* dbModulePortIterator::next() { - if (iter_ == (const_cast(module_))->getPortVec().end()) + if (iter_ == (const_cast(module_))->getModBTerms().end()) return nullptr; - dbModBTerm* modbterm - = (const_cast(module_))->getdbModBTerm(*iter_); + dbModBTerm* modbterm = *iter_; Port* ret = reinterpret_cast(modbterm); // advance to next iter_++; @@ -599,12 +613,8 @@ void dbNetwork::makeVerilogCell(Library* library, dbModInst* mod_inst) #ifdef DEBUG_BUS printf("Making verilog cell for %s\n", master->getName()); printf("Terms (modbterms) on master\n"); - std::vector>::iterator modbterm_begin - = master->getPortVec().begin(); - std::vector>::iterator modbterm_end - = master->getPortVec().end(); - for (auto i = modbterm_begin; i != modbterm_end; i++) { - printf("ModBTerm: %s\n", master->getdbModBTerm(block_, *i)->getName()); + for (auto i = master -> getModBTerms()){ + printf("ModBTerm: %s\n", (*i)->getName()); } #endif @@ -616,12 +626,12 @@ void dbNetwork::makeVerilogCell(Library* library, dbModInst* mod_inst) // Handle bus ports std::map name2modbterm; - std::vector> local_array = master->getPortVec(); - for (std::vector>::iterator modbterm_iter - = local_array.begin(); - modbterm_iter != local_array.end(); - modbterm_iter++) { - dbModBTerm* modbterm = master->getdbModBTerm(block_, (*modbterm_iter)); + + for (dbSet::iterator modbterm_iter = master->getModBTerms().begin(); + modbterm_iter != master->getModBTerms().end(); + modbterm_iter++ + ){ + dbModBTerm* modbterm = *modbterm_iter; const char* port_name = modbterm->getName(); Port* port = ConcreteNetwork::makePort(local_cell, port_name); PortDirection* dir = dbToSta(modbterm->getSigType(), modbterm->getIoType()); @@ -980,7 +990,9 @@ Net* dbNetwork::net(const Pin* pin) const dbBTerm* bterm; dbModITerm* moditerm; dbModBTerm* modbterm; - +#ifdef DEBUG_DBNW + printf("Getting net for pin %s\n", name(pin)); +#endif staToDb(pin, iterm, bterm, moditerm, modbterm); if (iterm) { dbNet* dnet = iterm->getNet(); @@ -1084,8 +1096,8 @@ Port* dbNetwork::port(const Pin* pin) const const char* port_name = port_name_str.c_str(); dbModInst* mod_inst = moditerm->getParent(); dbModule* module = mod_inst->getMaster(); - dbModBTerm* mod_port = nullptr; - if (module->findModBTerm(port_name, mod_port)) { + dbModBTerm* mod_port = module->findModBTerm(port_name); + if (mod_port){ ret = dbToSta(mod_port); return ret; } @@ -1354,17 +1366,46 @@ void dbNetwork::visitConnectedPins(const Net* net, PinVisitor& visitor, NetSet& visited_nets) const { - dbNet* db_net = staToDb(net); - for (dbITerm* iterm : db_net->getITerms()) { - Pin* pin = dbToSta(iterm); - visitor(pin); + static int debug; + debug++; + + dbNet* db_net = nullptr; + dbModNet* mod_net = nullptr; + staToDb(net, db_net, mod_net); + + if (db_net && !mod_net){ + for (dbITerm* iterm : db_net->getITerms()) { + Pin* pin = dbToSta(iterm); + visitor(pin); + debug++; + } + for (dbBTerm* bterm : db_net->getBTerms()) { + Pin* pin = dbToSta(bterm); + visitor(pin); + debug++; + } } - for (dbBTerm* bterm : db_net->getBTerms()) { - Pin* pin = dbToSta(bterm); - visitor(pin); + else if (mod_net){ + for (dbITerm* iterm : mod_net->getITerms()) { + Pin* pin = dbToSta(iterm); + visitor(pin); + debug++; + } + for (dbBTerm* bterm : mod_net->getBTerms()) { + Pin* pin = dbToSta(bterm); + visitor(pin); + debug++; + } + + for (dbModITerm* moditerm : mod_net->getModITerms()) { + Pin* pin = dbToSta(moditerm); + visitor(pin); + debug++; + } } } + const Net* dbNetwork::highestConnectedNet(Net* net) const { return net; @@ -2103,7 +2144,7 @@ void dbNetwork::staToDb(const Port* port, mterm = staToDb(port); return; } else { - if (module->findModBTerm(name(port), modbterm)) { + if (module->findModBTerm(name(port))){ return; } } diff --git a/src/dbSta/src/dbReadVerilog.cc b/src/dbSta/src/dbReadVerilog.cc index 87ba10dfd0a..c03850ef4a9 100644 --- a/src/dbSta/src/dbReadVerilog.cc +++ b/src/dbSta/src/dbReadVerilog.cc @@ -165,7 +165,7 @@ class Verilog2db void recordBusPortsOrder(); void recordBusPortsOrder(Cell*); void makeDbNets(const Instance* inst); - void makeVModNets(const Instance* inst, dbModule* module); + void makeVModNets(const Instance* inst, dbModule* module,std::map& mod_net_set); void makeVModNets( std::vector>& inst_module_vec); void WireUpModNetsForTopInst(const Instance* inst); @@ -624,7 +624,7 @@ bool Verilog2db::staToDb(dbModule* module, */ } else { // a port on the module itself (a mod bterm) - module->findModBTerm(pin_name.c_str(), mod_bterm); + mod_bterm = module->findModBTerm(pin_name.c_str()); } } } @@ -656,10 +656,18 @@ dbIoType Verilog2db::staToDb(PortDirection* dir) void Verilog2db::makeVModNets( std::vector>& inst_module_vec) { + std::map > module_instance_set; for (auto im : inst_module_vec) { const Instance* cur_inst = im.first; dbModule* dm = im.second; - makeVModNets(cur_inst, dm); + module_instance_set[dm].insert(cur_inst); + } + for (auto& [dm, inst_set] : module_instance_set){ + //scope mod nets within each module using mod_net_map + std::map mod_net_map; + for (auto cur_inst: inst_set){ //all instances in this module. + makeVModNets(cur_inst, dm,mod_net_map); + } } } @@ -710,7 +718,8 @@ void Verilog2db::WireUpModNetsForTopInst(const Instance* inst) delete net_iter; } -void Verilog2db::makeVModNets(const Instance* inst, dbModule* module) +void Verilog2db::makeVModNets(const Instance* inst, dbModule* module, + std::map& mod_net_set) { Instance* top_instance = network_->topInstance(); @@ -732,6 +741,7 @@ void Verilog2db::makeVModNets(const Instance* inst, dbModule* module) continue; const char* net_name = network_->name(inst_pin_net); + // Sort connected pins for regression stability. PinSeq net_pins; NetConnectedPinIterator* pin_iter @@ -765,6 +775,24 @@ void Verilog2db::makeVModNets(const Instance* inst, dbModule* module) if (!add_mod_connection) continue; + + + // Make the module net (if it is not already present) + dbModNet* db_mod_net = nullptr; + std::string net_name_str(net_name); + auto set_iter = mod_net_set.find(net_name_str); + if (set_iter != mod_net_set.end()){ + db_mod_net = (*set_iter).second; +#ifdef DEBUG_VMODNETS + printf("D %d recycling a mod net %s in module %s\n", + debug, + net_name, + module -> getName()); +#endif + } + else{ + db_mod_net = dbModNet::create(module, net_name); + mod_net_set[net_name_str]= db_mod_net; #ifdef DEBUG_VMODNETS debug++; printf( @@ -775,11 +803,11 @@ void Verilog2db::makeVModNets(const Instance* inst, dbModule* module) network_->name(inst_pin_net), network_->name(inst), network_->name(inst_pin), - module_name); + module -> getName()); #endif + + } - // Make the module net (if it is not already present) - dbModNet* db_mod_net = dbModNet::create(module, net_name); for (const Pin* pin : net_pins) { dbITerm* iterm = nullptr; @@ -789,22 +817,26 @@ void Verilog2db::makeVModNets(const Instance* inst, dbModule* module) Instance* cur_inst = network_->instance(pin); - if (!((cur_inst == inst) || (cur_inst == network_->parent(inst)) - || (cur_inst == top_instance - && network_->parent(inst) == top_instance))) { + if (!( + (cur_inst == inst) || + (cur_inst == network_->parent(inst)) || + (network_ -> parent(inst) == network_ -> parent(cur_inst)) + || (cur_inst == top_instance && network_->parent(inst) == top_instance))) + { #ifdef DEBUG_VMODNETS printf( "**D %d Skipping net pin %s on instance %s (entry instance %s)\n", debug, network_->name(pin), - cur_inst == top_instance ? " top instnace" + cur_inst == top_instance ? " top instance" : network_->pathName(cur_inst), - inst == top_instance ? " top instnace" : network_->pathName(inst)); + inst == top_instance ? " top instance" : network_->pathName(inst)); #endif continue; } #ifdef DEBUG_VMODNETS + /* printf( "**D %d Vmod net looking at net pin %s on instance %s (a %s) " "Starting from instance %s in module %s\n", @@ -815,6 +847,7 @@ void Verilog2db::makeVModNets(const Instance* inst, dbModule* module) : "lower instance", network_->name(inst), module->getName()); + */ #endif // diff --git a/src/dbSta/test/write_verilog1.tcl b/src/dbSta/test/write_verilog1.tcl index f4124ca1b67..f436d38956f 100644 --- a/src/dbSta/test/write_verilog1.tcl +++ b/src/dbSta/test/write_verilog1.tcl @@ -4,5 +4,5 @@ read_lef liberty1.lef read_def reg1.def set verilog_file [make_result_file write_verilog1.v] -write_verilog $verilog_file +write_verilog -sort $verilog_file report_file $verilog_file diff --git a/src/dbSta/test/write_verilog2.tcl b/src/dbSta/test/write_verilog2.tcl index 9fb669ea10a..c4176a678f2 100644 --- a/src/dbSta/test/write_verilog2.tcl +++ b/src/dbSta/test/write_verilog2.tcl @@ -4,5 +4,5 @@ read_lef liberty1.lef read_def reg4.def set verilog_file [make_result_file write_verilog2.v] -write_verilog $verilog_file +write_verilog -sort $verilog_file report_file $verilog_file diff --git a/src/dbSta/test/write_verilog4.tcl b/src/dbSta/test/write_verilog4.tcl index 3261c810263..9702731abc0 100644 --- a/src/dbSta/test/write_verilog4.tcl +++ b/src/dbSta/test/write_verilog4.tcl @@ -4,5 +4,5 @@ read_lef liberty1.lef read_def write_verilog4.def set verilog_file [make_result_file write_verilog4.v] -write_verilog $verilog_file +write_verilog -sort $verilog_file report_file $verilog_file diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index 2647434d0ae..2f21d24df88 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -7540,6 +7540,18 @@ class dbModBTerm : public dbObject dbModNet* getNet() const; + void setNextNetModbterm(dbModBTerm* next_net_modbterm); + + dbModBTerm* getNextNetModbterm() const; + + void setPrevNetModbterm(dbModBTerm* prev_net_modbterm); + + dbModBTerm* getPrevNetModbterm() const; + + void setNextEntry(dbModBTerm* next_entry); + + dbModBTerm* getNextEntry() const; + // User Code Begin dbModBTerm void setSigType(dbSigType type); @@ -7549,7 +7561,8 @@ class dbModBTerm : public dbObject static dbModBTerm* create(dbModule* parentModule, const char* name); - bool connect(dbModNet*); + void connect(dbModNet*); + void disconnect(); char* getName(); @@ -7586,9 +7599,9 @@ class dbModInst : public dbObject std::string getHierarchicalName() const; bool getPinAtIx(unsigned ix, dbModITerm*& ret) const; - bool findModITerm(const char* name, dbModITerm*& ret) const; + bool findModITerm(const char* name, dbModITerm*& ret); - std::vector>& getPinVec() const; + dbSet getModITerms(); // User Code End dbModInst }; @@ -7606,6 +7619,18 @@ class dbModITerm : public dbObject 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(); @@ -7624,9 +7649,14 @@ class dbModNet : public dbObject 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() const; + dbModBTerm* connectedToModBTerm(); // User Code End dbModNet }; @@ -7635,6 +7665,8 @@ class dbModule : public dbObject public: const char* getName() const; + void setModInst(dbModInst* mod_inst); + dbModInst* getModInst() const; // User Code Begin dbModule @@ -7648,17 +7680,19 @@ class dbModule : public dbObject // Adding an inst to a new module will remove it from its previous // module. void addInst(dbInst* inst); - void addInstInHierarchy(dbInst* inst); dbBlock* getOwner(); - dbSet getInsts(); - dbSet getChildren(); + dbSet getModInsts(); + dbSet getModNets(); + dbSet getModBTerms(); + dbSet getInsts(); dbModInst* findModInst(const char* name); void removeModInst(const char* name); dbInst* findDbInst(const char* name); + dbModBTerm* findModBTerm(const char* name); std::vector getLeafInsts(); @@ -7668,22 +7702,16 @@ class dbModule : public dbObject static dbModule* getModule(dbBlock* block_, uint dbid_); - bool findPortIx(const char* port_name, unsigned& ix) const; - - std::vector>& getPortVec() const; - std::vector>& getModInstVec() const; - std::vector>& getDbInstVec() const; - dbModInst* getModInst(dbId); dbInst* getdbInst(dbId); - size_t getModInstCount(); - size_t getDbInstCount(); + unsigned getModInstCount(); + unsigned getDbInstCount(); dbModBTerm* getdbModBTerm(dbId); dbModBTerm* getdbModBTerm(dbBlock*, dbId); dbModNet* getModNet(const char* net_name); - bool findModBTerm(const char* port_name, dbModBTerm*& ret); + bool findPortIx(const char* port_name, unsigned& ix); void staSetCell(void* cell); void* getStaCell(); 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 index 370b2fc1211..417026f4abf 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModBterm.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModBterm.json @@ -21,7 +21,22 @@ "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 c792498063a..db8fafb8aa5 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModInst.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModInst.json @@ -42,14 +42,15 @@ "parent":"dbBlock" }, { - "name":"_pin_vec", - "type":"std::vector >", - "flags": [ - "no-set", - "no-get", - "no-template" - ] + "name":"_moditerms", + "type":"dbId<_dbModITerm >", + "flags":["no-get","no-set"], + "parent":"dbBlock" } ], - "cpp_includes":["dbBlock.h","dbModule.h","dbHashTable.hpp", "dbModITerm.h"] + "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 index fcde65004e6..b100fc9a290 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModIterm.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModIterm.json @@ -21,7 +21,23 @@ "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 index 28760602f99..5b13841789a 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModNet.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModNet.json @@ -20,22 +20,22 @@ }, { "name": "_moditerms", - "type": "dbVector>", + "type": "dbId<_dbModITerm>", "flags":["no-set","no-get"] }, { "name": "_modbterms", - "type": "dbVector>", + "type": "dbId<_dbModBTerm>", "flags":["no-set","no-get"] }, { "name": "_iterms", - "type": "dbVector>", + "type": "dbId<_dbITerm>", "flags":["no-set","no-get"] }, { "name": "_bterms", - "type": "dbVector>", + "type": "dbId<_dbBTerm>", "flags":["no-set","no-get"] } diff --git a/src/odb/src/codeGenerator/schema/chip/dbModule.json b/src/odb/src/codeGenerator/schema/chip/dbModule.json index f94898f47bb..10e48e66023 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbModule.json +++ b/src/odb/src/codeGenerator/schema/chip/dbModule.json @@ -21,7 +21,6 @@ { "name":"_mod_inst", "type":"dbId<_dbModInst>", - "flags":["no-set"], "parent":"dbBlock" }, { @@ -37,29 +36,9 @@ "parent":"dbBlock" }, { - "name":"_port_vec", - "type":"std::vector< dbId >", + "name":"_modbterms", + "type":"dbId<_dbModBTerm>", "flags":["no-set","no-get"] - }, - { - "name":"_modinst_vec", - "type":"std::vector< dbId >", - "flags":["no-set","no-get"] - }, - { - "name":"_dbinst_vec", - "type":"std::vector< dbId >", - "flags":["no-set","no-get"] - }, - { - "name":"_port_map", - "type":"std::map ", - "flags": ["no-set","no-get","no-template" ] - }, - { - "name":"_modnet_map", - "type":"std::map >", - "flags":["no-set","no-get"] } ], "cpp_includes":["dbBlock.h","dbHashTable.hpp", "dbModBTerm.h", "dbModInst.h", "dbInst.h"], diff --git a/src/odb/src/db/CMakeLists.txt b/src/odb/src/db/CMakeLists.txt index 0e65d85550b..c38d64e567c 100644 --- a/src/odb/src/db/CMakeLists.txt +++ b/src/odb/src/db/CMakeLists.txt @@ -132,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 c15796692d0..383b596d498 100644 --- a/src/odb/src/db/dbBTerm.cpp +++ b/src/odb/src/db/dbBTerm.cpp @@ -210,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); @@ -240,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); @@ -259,6 +263,8 @@ dbOStream& operator<<(dbOStream& stream, const _dbBTerm& bterm) 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; @@ -278,6 +284,8 @@ dbIStream& operator>>(dbIStream& stream, _dbBTerm& bterm) 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; @@ -442,19 +450,24 @@ dbModNet* dbBTerm::getModNet() return nullptr; } -void dbBTerm::connect(dbModNet* net_) +void dbBTerm::connect(dbModNet* mod_net) { - dbId<_dbModNet> net_el(net_->getId()); + 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 == net_el) + if (bterm->_mnet == _mod_net -> getId()) return; - _dbModNet* mod_net = (_dbModNet*) net_; - dbId<_dbBTerm> bterm_el(getId()); - mod_net->_bterms.push_back(bterm_el); - bterm->_mnet = net_el; + 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; @@ -740,6 +753,25 @@ 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) { @@ -839,6 +871,32 @@ 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 0e562b72b47..39d5008ccbd 100644 --- a/src/odb/src/db/dbBTerm.h +++ b/src/odb/src/db/dbBTerm.h @@ -84,6 +84,8 @@ class _dbBTerm : public _dbObject 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 @@ -96,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 9dcd34ac69f..bada7ee5b56 100644 --- a/src/odb/src/db/dbBlock.cpp +++ b/src/odb/src/db/dbBlock.cpp @@ -91,6 +91,13 @@ #include "dbModule.h" #include "dbModuleInstItr.h" #include "dbModuleModInstItr.h" +#include "dbModuleModInstModITermItr.h" +#include "dbModuleModBTermItr.h" +#include "dbModuleModNetItr.h" +#include "dbModuleModNetModBTermItr.h" +#include "dbModuleModNetModITermItr.h" +#include "dbModuleModNetBTermItr.h" +#include "dbModuleModNetITermItr.h" #include "dbNameCache.h" #include "dbNet.h" #include "dbNetTrack.h" @@ -363,9 +370,20 @@ _dbBlock::_dbBlock(_dbDatabase* db) _region_inst_itr = new dbRegionInstItr(_inst_tbl); _module_inst_itr = new dbModuleInstItr(_inst_tbl); - + _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); @@ -4053,6 +4071,27 @@ void dbBlock::dumpDebug() 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)){ + printf("\t-> Db Iterm %u\n",id); + } + 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"); @@ -4071,33 +4110,29 @@ void dbBlock::dumpDebug() if (block->_module_tbl) { printf("module table %d\n", block->_module_tbl->size()); - std::vector contents; - block->_module_tbl->getObjects(contents); - printf("Content size %lu modules\n", contents.size()); - - for (auto mi : contents) { - odb::_dbModule* cur_obj = mi; + dbSet block_modules = getModules(); + printf("Content size %u modules\n", block_modules.size()); + for (auto mi : block_modules) { + dbModule* cur_obj = mi; printf("\tModule %s\n", ((dbModule*) cur_obj)->getName()); - // got through the ports and their owner printf("\t\tModBTerm Ports +++\n"); - std::vector> module_ports = cur_obj->_port_vec; - for (std::vector>::iterator it = module_ports.begin(); - it != module_ports.end(); - it++) { - dbModBTerm* module_port = ((dbModule*) cur_obj)->getdbModBTerm(*it); + 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\n", module_port->getName()); printf("\t\tPort parent %s\n\n", module_port->getParent()->getName()); } printf("\t\tModBTermPorts ---\n"); printf("\t\tModule instances +++\n"); - std::vector> module_instances = cur_obj->_modinst_vec; - for (std::vector>::iterator it = module_instances.begin(); - it != module_instances.end(); - it++) { - dbModInst* module_inst - = (dbModInst*) (((dbModule*) cur_obj)->getModInst(*it)); + 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()); @@ -4106,28 +4141,24 @@ void dbBlock::dumpDebug() if (owner != current_block) printf("\t\t\tMaster owner in wrong block\n"); + printf("\t\tConnections\n"); - unsigned count = ((_dbModInst*) module_inst)->_pin_vec.size(); - for (unsigned i = 0; i < count; i++) { - dbModITerm* miterm_pin = nullptr; - module_inst->getPinAtIx(i, miterm_pin); - printf("\t\t\tModIterm : %s (%u) Net %s (%u) \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()->getId()); + miterm_pin->getNet() ? + miterm_pin -> getNet() -> getId(): + 0 + ); } } - printf("\t\tModule instances ---\n"); printf("\t\tDb instances +++\n"); - std::vector> db_instances = cur_obj->_dbinst_vec; - for (std::vector>::iterator it = db_instances.begin(); - it != db_instances.end(); - it++) { - dbInst* db_inst = (dbInst*) (((dbModule*) cur_obj)->getdbInst(*it)); + 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(); @@ -4136,8 +4167,9 @@ void dbBlock::dumpDebug() ++iterm_itr) { dbITerm* iterm = *iterm_itr; dbMTerm* mterm = iterm->getMTerm(); - printf("\t\t\t\t iterm: %s Net: %s Mod net : %s\n", + printf("\t\t\t\t iterm: %s (%u) Net: %s Mod net : %s\n", mterm->getName().c_str(), + iterm -> getId(), iterm->getNet() ? iterm->getNet()->getName().c_str() : "unk-dbnet", iterm->getModNet() ? iterm->getModNet()->getName() @@ -4146,50 +4178,41 @@ void dbBlock::dumpDebug() } printf("\t\tDb instances ---\n"); + printf("\tModule nets (modnets) +++ \n"); - printf("\t# nets %lu\n", cur_obj->_modnet_map.size()); - for (auto mn : cur_obj->_modnet_map) { - dbId mn_el = mn.second; - printf("\t\tNet: %s (%u)\n", mn.first.c_str(), mn_el.id()); - _dbModNet* mod_net = block->_modnet_tbl->getPtr(mn_el.id()); - (void) mod_net; + 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"); - dbVector> moditerms - = ((_dbModNet*) mod_net)->_moditerms; - dbVector> modbterms - = ((_dbModNet*) mod_net)->_modbterms; - dbVector> iterms = ((_dbModNet*) mod_net)->_iterms; - dbVector> bterms = ((_dbModNet*) mod_net)->_bterms; - printf("\t\t -> %lu moditerms\n", moditerms.size()); - printf("\t\t -> %lu modbterms\n", modbterms.size()); - printf("\t\t -> %lu iterms\n", iterms.size()); - printf("\t\t -> %lu bterms\n", bterms.size()); - - /* - dbVector >::iterator it_iter; - dbVector >::iterator bt_iter; - printf("\t\t: moditerms\n"); - for (auto it_iter= iterms.begin(); it_iter != iterms.end(); it_iter++){ - printf("\t\t\t%s\n",(*it_iter) -> getMTerm() -> _name); - } - printf("\t\t: modbterms\n"); - for (auto it: bterms){ - printf("\t\t\t%s\n",it -> getName().c_str()); - } - */ - } - /* - printf("\tModule nets --- \n"); - printf("InstanceNets+++\n"); - InstanceNetIterator* inetIter = netIterator(((dbModule*)cur_obj) -> - getInstance()); while (inetIter.hasNext()){ printf("Net %s\n", - inetIter.next() -> getName().c_str()); + 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()); + } } - printf("InstanceNets---\n"); - */ } } 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 5d9ee36575c..64fb3bec97f 100644 --- a/src/odb/src/db/dbBlock.h +++ b/src/odb/src/db/dbBlock.h @@ -107,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; @@ -252,6 +259,16 @@ 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 3eb284383ee..0755937dfa2 100644 --- a/src/odb/src/db/dbITerm.cpp +++ b/src/odb/src/db/dbITerm.cpp @@ -131,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(); @@ -177,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(); @@ -362,6 +366,8 @@ void dbITerm::clearConnected() iterm->_flags._connected = 0; } + + void dbITerm::connect(dbNet* net_) { _dbITerm* iterm = (_dbITerm*) this; @@ -446,17 +452,50 @@ dbModNet* dbITerm::getModNet() void dbITerm::connect(dbModNet* mod_net) { - unsigned id = mod_net->getId(); - dbId<_dbModNet> net_el(id); + _dbITerm* iterm = (_dbITerm*) this; - if (iterm->_mnet == net_el) + _dbModNet* _mod_net = (_dbModNet*) mod_net; + _dbBlock* block = (_dbBlock*) iterm->getOwner(); + + + if (iterm->_mnet == _mod_net -> getId()){ return; - dbId<_dbITerm> iterm_el(getId()); - _dbModNet* local_mod_net = (_dbModNet*) mod_net; - local_mod_net->_iterms.push_back(iterm_el); - iterm->_mnet = net_el; + } + + if (iterm->_mnet != 0){ + // printf("Weird disconnecting an iterm\n"); + 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(); + + // printf("Mod net now connected to %d iterms\n", + // mod_net -> getITerms().size()); } + + void dbITerm::disconnect() { _dbITerm* iterm = (_dbITerm*) this; @@ -472,9 +511,9 @@ 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); + if (net->_flags._dont_touch) { inst->getLogger()->error(utl::ODB, @@ -502,7 +541,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; @@ -512,18 +550,40 @@ 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() { _dbMTerm* mterm = (_dbMTerm*) getMTerm(); diff --git a/src/odb/src/db/dbITerm.h b/src/odb/src/db/dbITerm.h index 0f9e9e93ce7..541c5727654 100644 --- a/src/odb/src/db/dbITerm.h +++ b/src/odb/src/db/dbITerm.h @@ -81,6 +81,8 @@ class _dbITerm : public _dbObject 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_; @@ -117,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) { } @@ -131,6 +135,8 @@ inline dbOStream& operator<<(dbOStream& stream, const _dbITerm& iterm) 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; } @@ -145,6 +151,8 @@ inline dbIStream& operator>>(dbIStream& stream, _dbITerm& iterm) 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 55d91bc5bad..9d9eb728840 100644 --- a/src/odb/src/db/dbInst.cpp +++ b/src/odb/src/db/dbInst.cpp @@ -1383,13 +1383,20 @@ dbInst* dbInst::create(dbBlock* block_, inst->_flags._physical_only = physical_only; if (!physical_only) { - block_->getTopModule()->addInst((dbInst*) inst); + // block_->getTopModule()->addInst((dbInst*) inst); + if (parent_module) + parent_module->addInst((dbInst*) inst); + else + block_->getTopModule()->addInst((dbInst*) inst); } + //Check this out.. // add to the verilog hierarchy + /* if (parent_module) parent_module->addInstInHierarchy((dbInst*) inst); else block_->getTopModule()->addInstInHierarchy((dbInst*) inst); + */ if (region) { region->addInst((dbInst*) inst); diff --git a/src/odb/src/db/dbModBTerm.cpp b/src/odb/src/db/dbModBTerm.cpp index 6c47eeb265a..f0de71e7cf7 100644 --- a/src/odb/src/db/dbModBTerm.cpp +++ b/src/odb/src/db/dbModBTerm.cpp @@ -59,6 +59,15 @@ bool _dbModBTerm::operator==(const _dbModBTerm& rhs) const 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; } @@ -77,6 +86,9 @@ void _dbModBTerm::differences(dbDiff& diff, 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 } @@ -87,6 +99,9 @@ void _dbModBTerm::out(dbDiff& diff, char side, const char* field) const 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 } @@ -101,6 +116,9 @@ _dbModBTerm::_dbModBTerm(_dbDatabase* db, const _dbModBTerm& r) _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) @@ -109,6 +127,9 @@ dbIStream& operator>>(dbIStream& stream, _dbModBTerm& obj) 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; } @@ -118,6 +139,9 @@ dbOStream& operator<<(dbOStream& stream, const _dbModBTerm& obj) 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; } @@ -180,6 +204,57 @@ dbModNet* dbModBTerm::getNet() const return (dbModNet*) par->_modnet_tbl->getPtr(obj->_net); } +void dbModBTerm::setNextNetModbterm(dbModBTerm* next_net_modbterm) +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + + obj->_next_net_modbterm = next_net_modbterm->getImpl()->getOID(); +} + +dbModBTerm* dbModBTerm::getNextNetModbterm() const +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + if (obj->_next_net_modbterm == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModBTerm*) par->_modbterm_tbl->getPtr(obj->_next_net_modbterm); +} + +void dbModBTerm::setPrevNetModbterm(dbModBTerm* prev_net_modbterm) +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + + obj->_prev_net_modbterm = prev_net_modbterm->getImpl()->getOID(); +} + +dbModBTerm* dbModBTerm::getPrevNetModbterm() const +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + if (obj->_prev_net_modbterm == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModBTerm*) par->_modbterm_tbl->getPtr(obj->_prev_net_modbterm); +} + +void dbModBTerm::setNextEntry(dbModBTerm* next_entry) +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + + obj->_next_entry = next_entry->getImpl()->getOID(); +} + +dbModBTerm* dbModBTerm::getNextEntry() const +{ + _dbModBTerm* obj = (_dbModBTerm*) this; + if (obj->_next_entry == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModBTerm*) par->_modbterm_tbl->getPtr(obj->_next_entry); +} + // User Code Begin dbModBTermPublicMethods struct dbModBTermFlags_str @@ -227,23 +302,30 @@ dbIoType dbModBTerm::getIoType() 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); - if (module->_port_map.find(str_name) != module->_port_map.end()) { - dbId el = module->_port_map[str_name]; - return ((dbModule*) module)->getdbModBTerm((dbBlock*) block, el); - } _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(); - module->_port_map[std::string(name)] = module->_port_vec.size(); - module->_port_vec.push_back(modbterm->getOID()); + modbterm->_next_entry = module->_modbterms; + module->_modbterms = modbterm->getOID(); + return (dbModBTerm*) modbterm; } @@ -253,17 +335,69 @@ char* dbModBTerm::getName() return _bterm->_name; } -bool dbModBTerm::connect(dbModNet* net) +void dbModBTerm::connect(dbModNet* net) { - _dbModNet* local_modnet = (_dbModNet*) net; - _dbModBTerm* _bterm = (_dbModBTerm*) this; - dbId<_dbModNet> net_id(local_modnet->getOID()); - if (_bterm->_net == net_id) - return true; - _bterm->_net = net_id; - dbId<_dbModBTerm> dest = _bterm->getOID(); - local_modnet->_modbterms.push_back(dest); - return true; + // 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) diff --git a/src/odb/src/db/dbModBTerm.h b/src/odb/src/db/dbModBTerm.h index 832c802868d..50588f49e62 100644 --- a/src/odb/src/db/dbModBTerm.h +++ b/src/odb/src/db/dbModBTerm.h @@ -64,6 +64,9 @@ class _dbModBTerm : public _dbObject 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; diff --git a/src/odb/src/db/dbModITerm.cpp b/src/odb/src/db/dbModITerm.cpp index b505620ac3d..2e6dc512741 100644 --- a/src/odb/src/db/dbModITerm.cpp +++ b/src/odb/src/db/dbModITerm.cpp @@ -59,6 +59,15 @@ bool _dbModITerm::operator==(const _dbModITerm& rhs) const 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; } @@ -77,6 +86,9 @@ void _dbModITerm::differences(dbDiff& diff, 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 } @@ -87,6 +99,9 @@ void _dbModITerm::out(dbDiff& diff, char side, const char* field) const 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 } @@ -101,6 +116,9 @@ _dbModITerm::_dbModITerm(_dbDatabase* db, const _dbModITerm& r) _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) @@ -109,6 +127,9 @@ dbIStream& operator>>(dbIStream& stream, _dbModITerm& obj) 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; } @@ -118,6 +139,9 @@ dbOStream& operator<<(dbOStream& stream, const _dbModITerm& obj) 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; } @@ -174,6 +198,57 @@ dbModNet* dbModITerm::getNet() const return (dbModNet*) par->_modnet_tbl->getPtr(obj->_net); } +void dbModITerm::setNextNetModiterm(dbModITerm* next_net_moditerm) +{ + _dbModITerm* obj = (_dbModITerm*) this; + + obj->_next_net_moditerm = next_net_moditerm->getImpl()->getOID(); +} + +dbModITerm* dbModITerm::getNextNetModiterm() const +{ + _dbModITerm* obj = (_dbModITerm*) this; + if (obj->_next_net_moditerm == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModITerm*) par->_moditerm_tbl->getPtr(obj->_next_net_moditerm); +} + +void dbModITerm::setPrevNetModiterm(dbModITerm* prev_net_moditerm) +{ + _dbModITerm* obj = (_dbModITerm*) this; + + obj->_prev_net_moditerm = prev_net_moditerm->getImpl()->getOID(); +} + +dbModITerm* dbModITerm::getPrevNetModiterm() const +{ + _dbModITerm* obj = (_dbModITerm*) this; + if (obj->_prev_net_moditerm == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModITerm*) par->_moditerm_tbl->getPtr(obj->_prev_net_moditerm); +} + +void dbModITerm::setNextEntry(dbModITerm* next_entry) +{ + _dbModITerm* obj = (_dbModITerm*) this; + + obj->_next_entry = next_entry->getImpl()->getOID(); +} + +dbModITerm* dbModITerm::getNextEntry() const +{ + _dbModITerm* obj = (_dbModITerm*) this; + if (obj->_next_entry == 0) { + return nullptr; + } + _dbBlock* par = (_dbBlock*) obj->getOwner(); + return (dbModITerm*) par->_moditerm_tbl->getPtr(obj->_next_entry); +} + // User Code Begin dbModITermPublicMethods struct dbModITermFlags_str @@ -221,31 +296,48 @@ dbIoType dbModITerm::getIoType() dbModITerm* dbModITerm::create(dbModInst* parentInstance, const char* name) { - // Axiom: iterms ordered in port order on dbModule - // that is in moditerm list (so we can always quickly get a modbterm from a - // moditerm) _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(); // dbModInst -- parent - parent->_pin_vec.push_back(moditerm->getOID()); + + moditerm->_parent = parent->getOID(); + moditerm->_next_entry = parent->_moditerms; + parent->_moditerms = moditerm->getOID(); + return (dbModITerm*) moditerm; } bool dbModITerm::connect(dbModNet* net) { - _dbModITerm* _iterm = (_dbModITerm*) this; - dbId<_dbModITerm> dest = _iterm->getOID(); - if (_iterm->_net == ((_dbModNet*) net)->getOID()) + _dbModITerm* _moditerm = (_dbModITerm*) this; + _dbModNet* _modnet = (_dbModNet*) net; + _dbBlock* _block = (_dbBlock*) _moditerm->getOwner(); + // already connected. + if (_moditerm->_net == _modnet->getId()) return true; - _iterm->_net = ((_dbModNet*) net)->getOID(); - ((_dbModNet*) net)->_moditerms.push_back(dest); + _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; } diff --git a/src/odb/src/db/dbModITerm.h b/src/odb/src/db/dbModITerm.h index 19775cd33eb..b446cc1f4ee 100644 --- a/src/odb/src/db/dbModITerm.h +++ b/src/odb/src/db/dbModITerm.h @@ -64,6 +64,9 @@ class _dbModITerm : public _dbObject 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); diff --git a/src/odb/src/db/dbModInst.cpp b/src/odb/src/db/dbModInst.cpp index bd8519dca50..5eddc40c9f8 100644 --- a/src/odb/src/db/dbModInst.cpp +++ b/src/odb/src/db/dbModInst.cpp @@ -45,6 +45,7 @@ // User Code Begin Includes #include "dbGroup.h" #include "dbModInst.h" +#include "dbModuleModInstModITermItr.h" // User Code End Includes namespace odb { template class dbTable<_dbModInst>; @@ -72,6 +73,9 @@ bool _dbModInst::operator==(const _dbModInst& rhs) const if (_group != rhs._group) { return false; } + if (_moditerms != rhs._moditerms) { + return false; + } return true; } @@ -97,6 +101,7 @@ void _dbModInst::differences(dbDiff& diff, DIFF_FIELD(_master); DIFF_FIELD(_group_next); DIFF_FIELD(_group); + DIFF_FIELD(_moditerms); DIFF_END } @@ -110,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 } @@ -135,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) @@ -146,7 +153,7 @@ dbIStream& operator>>(dbIStream& stream, _dbModInst& obj) stream >> obj._master; stream >> obj._group_next; stream >> obj._group; - stream >> obj._pin_vec; + stream >> obj._moditerms; return stream; } @@ -159,7 +166,7 @@ dbOStream& operator<<(dbOStream& stream, const _dbModInst& obj) stream << obj._master; stream << obj._group_next; stream << obj._group; - stream << obj._pin_vec; + stream << obj._moditerms; return stream; } @@ -219,8 +226,8 @@ dbModInst* dbModInst::create(dbModule* parentModule, { _dbModule* module = (_dbModule*) parentModule; _dbBlock* block = (_dbBlock*) module->getOwner(); - _dbModule* master = (_dbModule*) masterModule; + if (master->_mod_inst != 0) return nullptr; @@ -239,8 +246,8 @@ dbModInst* dbModInst::create(dbModule* parentModule, modinst->_module_next = module->_modinsts; module->_modinsts = modinst->getOID(); master->_mod_inst = modinst->getOID(); - module->_modinst_vec.push_back(modinst->getOID()); block->_modinst_hash.insert(modinst); + dbSet mod_inst_set = ((dbModule*) module)->getModInsts(); return (dbModInst*) modinst; } @@ -288,6 +295,13 @@ dbSet::iterator dbModInst::destroy(dbSet::iterator& itr) return next; } +dbSet dbModInst::getModITerms() +{ + _dbModInst* _mod_inst = (_dbModInst*) this; + _dbBlock* _block = (_dbBlock*) _mod_inst->getOwner(); + return dbSet(_mod_inst, _block->_module_modinstmoditerm_itr); +} + dbModInst* dbModInst::getModInst(dbBlock* block_, uint dbid_) { _dbBlock* block = (_dbBlock*) block_; @@ -320,41 +334,33 @@ dbModITerm* dbModInst::getdbModITerm(dbId el) return ((dbModITerm*) (block->_moditerm_tbl->getPtr(conv_el))); } -bool dbModInst::findModITerm(const char* name, dbModITerm*& ret) const +bool dbModInst::findModITerm(const char* name, dbModITerm*& ret) { - static int debug; - debug++; - _dbModInst* _obj = (_dbModInst*) this; - _dbBlock* block = (_dbBlock*) _obj->getOwner(); - for (auto el : _obj->_pin_vec) { - debug++; - dbId<_dbModITerm> conv_el(el.id()); - dbModITerm* candidate - = (dbModITerm*) (block->_moditerm_tbl->getPtr(conv_el)); - if (!strcmp(candidate->getName(), name)) { - ret = candidate; + dbSet moditerms = getModITerms(); + for (dbModITerm* mod_iterm : moditerms) { + if (!strcmp(mod_iterm->getName(), name)) { + ret = mod_iterm; return true; } } return false; } -std::vector>& dbModInst::getPinVec() const -{ - _dbModInst* _obj = (_dbModInst*) this; - return _obj->_pin_vec; -} - bool dbModInst::getPinAtIx(unsigned ix, dbModITerm*& ret) const { _dbModInst* _obj = (_dbModInst*) this; _dbBlock* block = (_dbBlock*) _obj->getOwner(); + (void) block; + (void) _obj; + printf("TDODO"); + /* if (ix < _obj->_pin_vec.size()) { dbId el = _obj->_pin_vec.at(ix); dbId<_dbModITerm> conv_el(el.id()); ret = (dbModITerm*) (block->_moditerm_tbl->getPtr(conv_el)); return true; } + */ return false; } diff --git a/src/odb/src/db/dbModInst.h b/src/odb/src/db/dbModInst.h index 5b41da6bcfa..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,7 @@ class dbDiff; class _dbDatabase; class _dbModule; class _dbGroup; +class _dbModITerm; // User Code Begin Classes class dbModITerm; // User Code End Classes @@ -70,7 +73,7 @@ class _dbModInst : public _dbObject dbId<_dbModule> _master; dbId<_dbModInst> _group_next; dbId<_dbGroup> _group; - std::vector> _pin_vec; + 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..021826842a6 --- /dev/null +++ b/src/odb/src/db/dbModInstITermItr.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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..7fedc0719dc --- /dev/null +++ b/src/odb/src/db/dbModInstModITermItr.cpp @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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 index 3bb4546dd55..dc4d9a8b647 100644 --- a/src/odb/src/db/dbModNet.cpp +++ b/src/odb/src/db/dbModNet.cpp @@ -46,6 +46,12 @@ #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>; @@ -60,6 +66,18 @@ bool _dbModNet::operator==(const _dbModNet& rhs) const 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; } @@ -77,6 +95,10 @@ void _dbModNet::differences(dbDiff& diff, DIFF_FIELD(_name); DIFF_FIELD(_parent); DIFF_FIELD(_next_entry); + DIFF_FIELD(_moditerms); + DIFF_FIELD(_modbterms); + DIFF_FIELD(_iterms); + DIFF_FIELD(_bterms); DIFF_END } @@ -86,6 +108,10 @@ void _dbModNet::out(dbDiff& diff, char side, const char* field) const 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 } @@ -99,6 +125,10 @@ _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) @@ -161,30 +191,56 @@ dbModNet* dbModNet::create(dbModule* parentModule, const char* name) // give illusion of scoping. _dbModule* parent = (_dbModule*) parentModule; _dbBlock* block = (_dbBlock*) parent->getOwner(); - - std::string name_str(name); - if (parent->_modnet_map.find(name_str) != parent->_modnet_map.end()) { - dbId modnet_id = parent->_modnet_map[name_str]; - _dbModNet* modnet = block->_modnet_tbl->getPtr(modnet_id.id()); - return ((dbModNet*) modnet); - } _dbModNet* modnet = block->_modnet_tbl->create(); - parent->_modnet_map[name_str] = modnet->getOID(); + // 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; } -dbModBTerm* dbModNet::connectedToModBTerm() const +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(); - _dbModNet* obj = (_dbModNet*) this; - dbModule* module = getParent(); - for (auto mib : obj->_modbterms) { - odb::dbId conv_el(mib.id()); - dbModBTerm* mbterm = module->getdbModBTerm(conv_el); + dbSet modbterms = getModBTerms(); + for (dbModBTerm* mbterm : modbterms) { const char* mbterm_name = mbterm->getName(); if (!strcmp(mbterm_name, net_name)) return mbterm; diff --git a/src/odb/src/db/dbModNet.h b/src/odb/src/db/dbModNet.h index cc3db2aa164..0d7a952cb8a 100644 --- a/src/odb/src/db/dbModNet.h +++ b/src/odb/src/db/dbModNet.h @@ -65,12 +65,12 @@ class _dbModNet : public _dbObject char* _name; dbId<_dbModule> _parent; dbId<_dbModNet> _next_entry; - dbVector> _moditerms; - dbVector> _modbterms; - dbVector> _iterms; - dbVector> _bterms; + 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 \ No newline at end of file + // Generator Code End Header diff --git a/src/odb/src/db/dbModule.cpp b/src/odb/src/db/dbModule.cpp index aa41ec5d8fb..0eacc9937dd 100644 --- a/src/odb/src/db/dbModule.cpp +++ b/src/odb/src/db/dbModule.cpp @@ -50,7 +50,9 @@ #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 { @@ -76,6 +78,9 @@ bool _dbModule::operator==(const _dbModule& rhs) const if (_modnets != rhs._modnets) { return false; } + if (_modbterms != rhs._modbterms) { + return false; + } return true; } @@ -100,6 +105,7 @@ void _dbModule::differences(dbDiff& diff, DIFF_FIELD(_mod_inst); DIFF_FIELD(_modinsts); DIFF_FIELD(_modnets); + DIFF_FIELD(_modbterms); DIFF_END } @@ -112,6 +118,7 @@ void _dbModule::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD(_mod_inst); DIFF_OUT_FIELD(_modinsts); DIFF_OUT_FIELD(_modnets); + DIFF_OUT_FIELD(_modbterms); DIFF_END } @@ -134,6 +141,7 @@ _dbModule::_dbModule(_dbDatabase* db, const _dbModule& r) _mod_inst = r._mod_inst; _modinsts = r._modinsts; _modnets = r._modnets; + _modbterms = r._modbterms; } dbIStream& operator>>(dbIStream& stream, _dbModule& obj) @@ -144,11 +152,7 @@ dbIStream& operator>>(dbIStream& stream, _dbModule& obj) stream >> obj._mod_inst; stream >> obj._modinsts; stream >> obj._modnets; - stream >> obj._port_vec; - stream >> obj._modinst_vec; - stream >> obj._dbinst_vec; - stream >> obj._port_map; - stream >> obj._modnet_map; + stream >> obj._modbterms; return stream; } @@ -160,11 +164,7 @@ dbOStream& operator<<(dbOStream& stream, const _dbModule& obj) stream << obj._mod_inst; stream << obj._modinsts; stream << obj._modnets; - stream << obj._port_vec; - stream << obj._modinst_vec; - stream << obj._dbinst_vec; - stream << obj._port_map; - stream << obj._modnet_map; + stream << obj._modbterms; return stream; } @@ -187,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; @@ -199,18 +206,6 @@ dbModInst* dbModule::getModInst() const // User Code Begin dbModulePublicMethods -std::vector>& dbModule::getPortVec() const -{ - _dbModule* obj = (_dbModule*) this; - return obj->_port_vec; -} - -std::vector>& dbModule::getModInstVec() const -{ - _dbModule* obj = (_dbModule*) this; - return obj->_modinst_vec; -} - std::string dbModule::getHierarchicalName(std::string& separator) { std::string ret = hierarchicalNameR(separator); @@ -293,12 +288,6 @@ void dbModule::highestModWithNetNamed(const char* modbterm_name, } } -std::vector>& dbModule::getDbInstVec() const -{ - _dbModule* obj = (_dbModule*) this; - return obj->_dbinst_vec; -} - dbModInst* dbModule::getModInst(dbId el) { _dbModule* module = (_dbModule*) this; @@ -315,26 +304,18 @@ dbInst* dbModule::getdbInst(dbId el) return ((dbInst*) (block->_inst_tbl->getPtr(converted_el))); } -void dbModule::addInstInHierarchy(dbInst* inst) -{ - _dbInst* _inst = (_dbInst*) inst; - _dbModule* _module = (_dbModule*) this; - - unsigned id = _inst->getOID(); - dbId db_id(id); - _module->_dbinst_vec.push_back(db_id); -} - -size_t dbModule::getModInstCount() +unsigned dbModule::getModInstCount() { _dbModule* module = (_dbModule*) this; - return module->_modinst_vec.size(); + _dbBlock* block = (_dbBlock*) module->getOwner(); + return (dbSet(module, block->_module_modinst_itr)).size(); } -size_t dbModule::getDbInstCount() +unsigned dbModule::getDbInstCount() { _dbModule* module = (_dbModule*) this; - return module->_dbinst_vec.size(); + _dbBlock* block = (_dbBlock*) module->getOwner(); + return dbSet(module, block->_module_inst_itr).size(); } void dbModule::addInst(dbInst* inst) @@ -422,7 +403,6 @@ void _dbModule::removeInst(dbInst* inst) prev->_module_next = _inst->_module_next; } } - _inst->_module = 0; _inst->_module_next = 0; _inst->_module_prev = 0; @@ -435,6 +415,27 @@ 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); +} + +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; @@ -497,6 +498,10 @@ void dbModule::removeModInst(const char* name) { _dbModule* cur_module = (_dbModule*) this; _dbBlock* block = (_dbBlock*) cur_module->getOwner(); + (void) block; + (void) cur_module; + printf("Unsupported call: removeModInst\n"); + /* for (std::vector>::iterator it = cur_module->_modinst_vec.begin(); it != cur_module->_modinst_vec.end(); @@ -508,19 +513,14 @@ void dbModule::removeModInst(const char* name) cur_module->_modinst_vec.erase(it); return; } - } + }*/ } dbModInst* dbModule::findModInst(const char* name) { - _dbModule* cur_module = (_dbModule*) this; - _dbBlock* block = (_dbBlock*) cur_module->getOwner(); - for (auto m : cur_module->_modinst_vec) { - unsigned id = m.id(); - dbId<_dbModInst> converted_el(id); - dbModInst* mi = (dbModInst*) (block->_modinst_tbl->getPtr(converted_el)); - if (mi && !strcmp(mi->getName(), name)) - return (dbModInst*) mi; + for (dbModInst* mod_inst : getModInsts()) { + if (!strcmp(mod_inst->getName(), name)) + return mod_inst; } return nullptr; } @@ -529,12 +529,9 @@ dbInst* dbModule::findDbInst(const char* name) { _dbModule* cur_module = (_dbModule*) this; _dbBlock* block = (_dbBlock*) cur_module->getOwner(); - for (auto m : cur_module->_dbinst_vec) { - unsigned id = m.id(); - dbId<_dbInst> converted_el(id); - dbInst* mi = (dbInst*) (block->_inst_tbl->getPtr(converted_el)); - if (mi && !strcmp(mi->getName().c_str(), name)) - return (dbInst*) mi; + for (dbInst* inst : getInsts()) { + if (!strcmp(inst->getName().c_str(), name)) + return inst; } return nullptr; } @@ -557,13 +554,25 @@ std::vector dbModule::getLeafInsts() return insts; } -bool dbModule::findPortIx(const char* port_name, unsigned& ix) const +dbModBTerm* dbModule::findModBTerm(const char* name) +{ + _dbModule* cur_module = (_dbModule*) this; + _dbBlock* block = (_dbBlock*) cur_module->getOwner(); + for (dbModBTerm* mod_bterm : getModBTerms()) { + if (!strcmp(mod_bterm->getName(), name)) + return mod_bterm; + } + return nullptr; +} + +bool dbModule::findPortIx(const char* port_name, unsigned& ix) { - _dbModule* obj = (_dbModule*) this; std::string port_name_str(port_name); - if (obj->_port_map.find(port_name_str) != obj->_port_map.end()) { - ix = obj->_port_map[port_name_str]; - return true; + ix = 0; + for (dbModBTerm* mod_bterm : getModBTerms()) { + if (!strcmp(mod_bterm->getName(), port_name)) + return true; + ix++; } return false; } @@ -590,35 +599,19 @@ void dbModule::staSetCell(void* cell) module->_sta_cell = cell; } -bool dbModule::findModBTerm(const char* port_name, dbModBTerm*& ret) -{ - ret = nullptr; - _dbModule* _obj = (_dbModule*) this; - _dbBlock* block = (_dbBlock*) _obj->getOwner(); - for (auto el : _obj->_port_vec) { - // type conversion - unsigned id = el.id(); - dbId<_dbModBTerm> converted_el(id); - dbModBTerm* candidate - = (dbModBTerm*) (block->_modbterm_tbl->getPtr(converted_el)); - if (!strcmp(candidate->getName(), port_name)) { - ret = candidate; - return true; - } - } - return false; -} - dbModNet* dbModule::getModNet(const char* name) { _dbModule* obj = (_dbModule*) this; _dbBlock* _block = (_dbBlock*) obj->getOwner(); std::string name_str(name); + /* if (obj->_modnet_map.find(name_str) != obj->_modnet_map.end()) { dbId mnet_id = obj->_modnet_map[name_str]; dbId<_dbModNet> _mnet_id(mnet_id.id()); return (dbModNet*) (_block->_modnet_tbl->getPtr(_mnet_id)); } + */ + printf("unsupported: getModNet\n"); return nullptr; } @@ -632,7 +625,6 @@ dbModBTerm* dbModule::getdbModBTerm(dbBlock* block, dbId modbterm_id) { _dbBlock* _block = (_dbBlock*) block; - // do a weird type conversion unsigned id = modbterm_id.id(); dbId<_dbModBTerm> val(id); return (dbModBTerm*) (_block->_modbterm_tbl->getPtr(val)); @@ -642,7 +634,6 @@ dbModBTerm* dbModule::getdbModBTerm(dbId modbterm_id) { _dbModule* obj = (_dbModule*) this; _dbBlock* _block = (_dbBlock*) obj->getOwner(); - // do a weird type conversion unsigned id = modbterm_id.id(); dbId<_dbModBTerm> val(id); return (dbModBTerm*) (_block->_modbterm_tbl->getPtr(val)); diff --git a/src/odb/src/db/dbModule.h b/src/odb/src/db/dbModule.h index 9bb53224cee..abad164edf3 100644 --- a/src/odb/src/db/dbModule.h +++ b/src/odb/src/db/dbModule.h @@ -49,10 +49,7 @@ class _dbDatabase; class _dbInst; class _dbModInst; class _dbModNet; -class dbModBTerm; -class dbModInst; -class dbInst; -class dbModNet; +class _dbModBTerm; class _dbModule : public _dbObject { @@ -80,11 +77,7 @@ class _dbModule : public _dbObject dbId<_dbModInst> _mod_inst; dbId<_dbModInst> _modinsts; dbId<_dbModNet> _modnets; - std::vector> _port_vec; - std::vector> _modinst_vec; - std::vector> _dbinst_vec; - std::map _port_map; - std::map> _modnet_map; + dbId<_dbModBTerm> _modbterms; // User Code Begin Fields void* _sta_cell; diff --git a/src/odb/src/db/dbModuleBTermItr.cpp b/src/odb/src/db/dbModuleBTermItr.cpp new file mode 100644 index 00000000000..cb8124b8807 --- /dev/null +++ b/src/odb/src/db/dbModuleBTermItr.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 "dbModuleBTermItr.h" + +#include "dbModBTerm.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..4f1d3c18ad2 --- /dev/null +++ b/src/odb/src/db/dbModuleModBTermItr.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 "dbModuleModBTermItr.h" + +#include "dbModBTerm.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..eb25855f9de --- /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..ffd37cc1f25 100644 --- a/src/odb/src/db/dbModuleModInstItr.cpp +++ b/src/odb/src/db/dbModuleModInstItr.cpp @@ -33,6 +33,7 @@ // Generator Code Begin Cpp #include "dbModuleModInstItr.h" +#include "dbModInst.h" #include "dbModInst.h" #include "dbModule.h" #include "dbTable.h" @@ -117,4 +118,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..bda5f096fe9 --- /dev/null +++ b/src/odb/src/db/dbModuleModInstModITermItr.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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..0fa5df36ef0 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetBtermItr.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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..14886ac9b13 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetItermItr.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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..723934d7cb4 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetItr.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 "dbModuleModNetItr.h" + +#include "dbModNet.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..0be739067bb --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModBtermItr.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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..ef50c952360 --- /dev/null +++ b/src/odb/src/db/dbModuleModNetModItermItr.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 "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/dbTable.h b/src/odb/src/db/dbTable.h index 65722568374..92030702fa4 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 ddbb2c6f8a0..182e1511104 100644 Binary files a/src/odb/test/data/design.odb and b/src/odb/test/data/design.odb differ