diff --git a/src/grt/include/grt/GlobalRouter.h b/src/grt/include/grt/GlobalRouter.h index 5cff944376c..e185e8f5fd7 100644 --- a/src/grt/include/grt/GlobalRouter.h +++ b/src/grt/include/grt/GlobalRouter.h @@ -327,7 +327,7 @@ class GlobalRouter : public ant::GlobalRouteSource void setCapacities(int min_routing_layer, int max_routing_layer); void initNetlist(std::vector& nets); bool makeFastrouteNet(Net* net); - bool pinPositionsChanged(Net* net, std::multiset& last_pos); + bool pinPositionsChanged(Net* net); bool newPinOnGrid(Net* net, std::multiset& last_pos); std::vector findTransitionLayers(); void adjustTransitionLayers( diff --git a/src/grt/src/GlobalRouter.cpp b/src/grt/src/GlobalRouter.cpp index 12218f7da3d..600ece0b496 100644 --- a/src/grt/src/GlobalRouter.cpp +++ b/src/grt/src/GlobalRouter.cpp @@ -610,13 +610,6 @@ void GlobalRouter::updateDirtyNets(std::vector& dirty_nets) initRoutingLayers(min_layer, max_layer); for (odb::dbNet* db_net : dirty_nets_) { Net* net = db_net_map_[db_net]; - // get last pin positions - std::multiset last_pos; - for (const Pin& pin : net->getPins()) { - last_pos.insert(RoutePt(pin.getOnGridPosition().getX(), - pin.getOnGridPosition().getY(), - pin.getConnectionLayer())); - } net->destroyPins(); // update pin positions makeItermPins(net, db_net, grid_->getGridArea()); @@ -625,7 +618,7 @@ void GlobalRouter::updateDirtyNets(std::vector& dirty_nets) destroyNetWire(net); std::string pins_not_covered; // compare new positions with last positions & add on vector - if (pinPositionsChanged(net, last_pos) + if (pinPositionsChanged(net) && (!net->isMergedNet() || !netIsCovered(db_net, pins_not_covered))) { dirty_nets.push_back(db_net_map_[db_net]); routes_[db_net].clear(); @@ -639,6 +632,7 @@ void GlobalRouter::updateDirtyNets(std::vector& dirty_nets) } net->setMergedNet(false); net->setDirtyNet(false); + net->clearLastPinPositions(); } dirty_nets_.clear(); } @@ -1061,11 +1055,11 @@ void GlobalRouter::initNetlist(std::vector& nets) } } -bool GlobalRouter::pinPositionsChanged(Net* net, - std::multiset& last_pos) +bool GlobalRouter::pinPositionsChanged(Net* net) { bool is_diferent = false; std::map cnt_pos; + const std::multiset& last_pos = net->getLastPinPositions(); for (const Pin& pin : net->getPins()) { cnt_pos[RoutePt(pin.getOnGridPosition().getX(), pin.getOnGridPosition().getY(), @@ -4591,6 +4585,7 @@ AbstractGrouteRenderer* GlobalRouter::getRenderer() void GlobalRouter::addDirtyNet(odb::dbNet* net) { db_net_map_[net]->setDirtyNet(true); + db_net_map_[net]->saveLastPinPositions(); dirty_nets_.insert(net); } @@ -4730,10 +4725,11 @@ void GRouteDbCbk::inDbNetPreMerge(odb::dbNet* preserved_net, void GRouteDbCbk::inDbITermPreDisconnect(odb::dbITerm* iterm) { - // missing net pin update - odb::dbNet* net = iterm->getNet(); - if (net != nullptr && !net->isSpecial()) { + odb::dbNet* db_net = iterm->getNet(); + if (db_net != nullptr && !db_net->isSpecial()) { + Net* net = grouter_->getNet(db_net); grouter_->addDirtyNet(iterm->getNet()); + net->destroyITermPin(iterm); } } @@ -4757,10 +4753,11 @@ void GRouteDbCbk::inDbBTermPostConnect(odb::dbBTerm* bterm) void GRouteDbCbk::inDbBTermPreDisconnect(odb::dbBTerm* bterm) { - // missing net pin update - odb::dbNet* net = bterm->getNet(); - if (net != nullptr && !net->isSpecial()) { + odb::dbNet* db_net = bterm->getNet(); + if (db_net != nullptr && !db_net->isSpecial()) { + Net* net = grouter_->getNet(db_net); grouter_->addDirtyNet(bterm->getNet()); + net->destroyBTermPin(bterm); } } diff --git a/src/grt/src/Net.cpp b/src/grt/src/Net.cpp index a59886ac380..64bb2f955fd 100644 --- a/src/grt/src/Net.cpp +++ b/src/grt/src/Net.cpp @@ -35,6 +35,7 @@ #include "Net.h" +#include "grt/GlobalRouter.h" #include "odb/dbShape.h" namespace grt { @@ -111,6 +112,26 @@ void Net::destroyPins() pins_.clear(); } +void Net::destroyITermPin(odb::dbITerm* iterm) +{ + pins_.erase(std::remove_if(pins_.begin(), + pins_.end(), + [&](const Pin& pin) { + return pin.getName() == getITermName(iterm); + }), + pins_.end()); +} + +void Net::destroyBTermPin(odb::dbBTerm* bterm) +{ + pins_.erase(std::remove_if(pins_.begin(), + pins_.end(), + [&](const Pin& pin) { + return pin.getName() == bterm->getName(); + }), + pins_.end()); +} + int Net::getNumBTermsAboveMaxLayer(odb::dbTechLayer* max_routing_layer) { int bterm_count = 0; @@ -159,4 +180,15 @@ bool Net::hasStackedVias(odb::dbTechLayer* max_routing_layer) return true; } +void Net::saveLastPinPositions() +{ + if (last_pin_positions_.empty()) { + for (const Pin& pin : pins_) { + last_pin_positions_.insert(RoutePt(pin.getOnGridPosition().getX(), + pin.getOnGridPosition().getY(), + pin.getConnectionLayer())); + } + } +} + } // namespace grt diff --git a/src/grt/src/Net.h b/src/grt/src/Net.h index fff0420afb2..7d0bc588cec 100644 --- a/src/grt/src/Net.h +++ b/src/grt/src/Net.h @@ -41,6 +41,7 @@ #include "Pin.h" #include "grt/GRoute.h" +#include "grt/RoutePt.h" #include "odb/db.h" namespace grt { @@ -71,8 +72,16 @@ class Net std::vector> buildSegmentsGraph(); bool isLocal(); void destroyPins(); + void destroyITermPin(odb::dbITerm* iterm); + void destroyBTermPin(odb::dbBTerm* bterm); bool hasWires() const { return has_wires_; } bool hasStackedVias(odb::dbTechLayer* max_routing_layer); + void saveLastPinPositions(); + void clearLastPinPositions() { last_pin_positions_.clear(); } + const std::multiset& getLastPinPositions() + { + return last_pin_positions_; + } void setMergedNet(bool merged_net) { merged_net_ = merged_net; } bool isMergedNet() const { return merged_net_; } void setDirtyNet(bool is_dirty_net) { is_dirty_net_ = is_dirty_net; } @@ -86,6 +95,7 @@ class Net float slack_; bool has_wires_; std::vector parent_segment_indices_; + std::multiset last_pin_positions_; bool merged_net_; bool is_dirty_net_; }; diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index 82325c7d019..3427fe6d406 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -8565,15 +8565,15 @@ class dbTechLayerAreaRule : public dbObject int getExceptEdgeLength() const; - void setExceptEdgeLengths(std::pair except_edge_lengths); + void setExceptEdgeLengths(const std::pair& except_edge_lengths); std::pair getExceptEdgeLengths() const; - void setExceptMinSize(std::pair except_min_size); + void setExceptMinSize(const std::pair& except_min_size); std::pair getExceptMinSize() const; - void setExceptStep(std::pair except_step); + void setExceptStep(const std::pair& except_step); std::pair getExceptStep() const; @@ -9564,7 +9564,7 @@ class dbTechLayerEolKeepOutRule : public dbObject class dbTechLayerForbiddenSpacingRule : public dbObject { public: - void setForbiddenSpacing(std::pair forbidden_spacing); + void setForbiddenSpacing(const std::pair& forbidden_spacing); std::pair getForbiddenSpacing() const; @@ -10354,7 +10354,7 @@ class dbGDSSRef : public dbGDSElement dbGDSSTrans getTransform() const; - void set_colRow(std::pair colRow); + void set_colRow(const std::pair& colRow); std::pair get_colRow() const; diff --git a/src/odb/include/odb/gdsin.h b/src/odb/include/odb/gdsin.h index a75d5848b6e..984694857dc 100644 --- a/src/odb/include/odb/gdsin.h +++ b/src/odb/include/odb/gdsin.h @@ -54,19 +54,6 @@ namespace gds { class GDSReader { public: - /** - * Constructor for GDSReader - * No operations are performed in the constructor - */ - GDSReader(); - - /** - * Destructor - * - * Does not free the dbGDSLib objects, as they are owned by the database - */ - ~GDSReader(); - /** * Reads a GDS file and returns a dbGDSLib object * @@ -192,9 +179,9 @@ class GDSReader /** Most recently read record */ record_t _r; /** Current ODB Database */ - dbDatabase* _db; + dbDatabase* _db = nullptr; /** Current GDS Lib object */ - dbGDSLib* _lib; + dbGDSLib* _lib = nullptr; }; } // namespace gds diff --git a/src/odb/src/codeGenerator/helper.py b/src/odb/src/codeGenerator/helper.py index a3afade5adb..12c5446e335 100644 --- a/src/odb/src/codeGenerator/helper.py +++ b/src/odb/src/codeGenerator/helper.py @@ -137,7 +137,7 @@ def is_pass_by_ref(type_name): def is_set_by_ref(type_name): - return type_name == "std::string" + return type_name == "std::string" or type_name.startswith("std::pair") def _is_template_type(type_name): diff --git a/src/odb/src/codeGenerator/schema/gds/dbGDSElement.json b/src/odb/src/codeGenerator/schema/gds/dbGDSElement.json index 6105dbb8644..90a390f120c 100644 --- a/src/odb/src/codeGenerator/schema/gds/dbGDSElement.json +++ b/src/odb/src/codeGenerator/schema/gds/dbGDSElement.json @@ -5,11 +5,13 @@ { "name":"_layer", "type":"int16_t", + "default":"0", "flags":[] }, { "name":"_datatype", "type":"int16_t", + "default":"0", "flags":[] }, { @@ -28,4 +30,4 @@ "odb/geom.h" ], "cpp_includes": ["odb/dbTypes.h"] -} \ No newline at end of file +} diff --git a/src/odb/src/codeGenerator/schema/gds/dbGDSPath.json b/src/odb/src/codeGenerator/schema/gds/dbGDSPath.json index 2e59e1de6da..6eedc1f9a6f 100644 --- a/src/odb/src/codeGenerator/schema/gds/dbGDSPath.json +++ b/src/odb/src/codeGenerator/schema/gds/dbGDSPath.json @@ -4,12 +4,14 @@ "fields":[ { "name":"_width", + "default":"0", "type":"int", "flags":[] }, { "name":"_pathType", "type":"int16_t", + "default":"0", "flags":[] } ], @@ -18,4 +20,4 @@ ], "cpp_includes": ["odb/dbTypes.h", "odb/geom.h"] } - \ No newline at end of file + diff --git a/src/odb/src/codeGenerator/schema/gds/dbGDSStructure.json b/src/odb/src/codeGenerator/schema/gds/dbGDSStructure.json index efa3404b8fb..7f2bd355bad 100644 --- a/src/odb/src/codeGenerator/schema/gds/dbGDSStructure.json +++ b/src/odb/src/codeGenerator/schema/gds/dbGDSStructure.json @@ -5,6 +5,7 @@ { "name":"_name", "type":"char*", + "default":"nullptr", "flags":["no-set"] }, { @@ -26,4 +27,4 @@ ], "cpp_includes": ["odb/dbTypes.h", "dbGDSLib.h","dbHashTable.hpp"] } - \ No newline at end of file + diff --git a/src/odb/src/codeGenerator/schema/gds/dbGDSText.json b/src/odb/src/codeGenerator/schema/gds/dbGDSText.json index 4602843f827..383c18af424 100644 --- a/src/odb/src/codeGenerator/schema/gds/dbGDSText.json +++ b/src/odb/src/codeGenerator/schema/gds/dbGDSText.json @@ -10,6 +10,7 @@ { "name":"_width", "type":"int", + "default":"0", "flags":[] }, { @@ -28,4 +29,4 @@ ], "cpp_includes": ["odb/dbTypes.h"] } - \ No newline at end of file + diff --git a/src/odb/src/db/dbGDSElement.cpp b/src/odb/src/db/dbGDSElement.cpp index 08f1855675b..5a556e7a76e 100644 --- a/src/odb/src/db/dbGDSElement.cpp +++ b/src/odb/src/db/dbGDSElement.cpp @@ -80,6 +80,8 @@ void _dbGDSElement::out(dbDiff& diff, char side, const char* field) const _dbGDSElement::_dbGDSElement(_dbDatabase* db) { + _layer = 0; + _datatype = 0; } _dbGDSElement::_dbGDSElement(_dbDatabase* db, const _dbGDSElement& r) diff --git a/src/odb/src/db/dbGDSLib.cpp b/src/odb/src/db/dbGDSLib.cpp index 20c0fd2555e..aa6bd9b01a7 100644 --- a/src/odb/src/db/dbGDSLib.cpp +++ b/src/odb/src/db/dbGDSLib.cpp @@ -30,7 +30,6 @@ // 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 "dbGDSLib.h" #include "dbDatabase.h" @@ -122,6 +121,8 @@ _dbGDSLib::_dbGDSLib(_dbDatabase* db) db, this, (GetObjTbl_t) &_dbGDSLib::getObjectTable, dbGDSStructureObj); _structure_hash.setTable(_structure_tbl); + std::mktime(&_lastAccessed); + std::mktime(&_lastModified); } _dbGDSLib::_dbGDSLib(_dbDatabase* db, const _dbGDSLib& r) @@ -132,7 +133,8 @@ _dbGDSLib::_dbGDSLib(_dbDatabase* db, const _dbGDSLib& r) _srfName(r._srfName), _uu_per_dbu(r._uu_per_dbu), _dbu_per_meter(r._dbu_per_meter), - _structure_hash(r._structure_hash) + _structure_hash(r._structure_hash), + _structure_tbl(r._structure_tbl) { } @@ -299,4 +301,3 @@ dbSet dbGDSLib::getGDSStructures() return dbSet(obj, obj->_structure_tbl); } } // namespace odb - // Generator Code End Cpp \ No newline at end of file diff --git a/src/odb/src/db/dbGDSLib.h b/src/odb/src/db/dbGDSLib.h index 23e80d6ea65..37d822e84a5 100644 --- a/src/odb/src/db/dbGDSLib.h +++ b/src/odb/src/db/dbGDSLib.h @@ -30,18 +30,16 @@ // 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 + #include "dbCore.h" #include "dbGDSStructure.h" #include "dbHashTable.hpp" #include "dbTable.hpp" #include "odb/db.h" #include "odb/odb.h" -// User Code Begin Includes -#include -// User Code End Includes namespace odb { class dbIStream; @@ -81,4 +79,4 @@ dbOStream& operator<<(dbOStream& stream, const std::tm& tm); dbIStream& operator>>(dbIStream& stream, _dbGDSLib& obj); dbOStream& operator<<(dbOStream& stream, const _dbGDSLib& obj); -} // namespace odb \ No newline at end of file +} // namespace odb diff --git a/src/odb/src/db/dbGDSPath.cpp b/src/odb/src/db/dbGDSPath.cpp index bcaf3e0e905..64dc4932b6c 100644 --- a/src/odb/src/db/dbGDSPath.cpp +++ b/src/odb/src/db/dbGDSPath.cpp @@ -81,6 +81,8 @@ void _dbGDSPath::out(dbDiff& diff, char side, const char* field) const _dbGDSPath::_dbGDSPath(_dbDatabase* db) { + _width = 0; + _pathType = 0; } _dbGDSPath::_dbGDSPath(_dbDatabase* db, const _dbGDSPath& r) diff --git a/src/odb/src/db/dbGDSSRef.cpp b/src/odb/src/db/dbGDSSRef.cpp index 868fd95a016..82c34e48618 100644 --- a/src/odb/src/db/dbGDSSRef.cpp +++ b/src/odb/src/db/dbGDSSRef.cpp @@ -130,7 +130,7 @@ dbGDSSTrans dbGDSSRef::getTransform() const return obj->_transform; } -void dbGDSSRef::set_colRow(std::pair colRow) +void dbGDSSRef::set_colRow(const std::pair& colRow) { _dbGDSSRef* obj = (_dbGDSSRef*) this; diff --git a/src/odb/src/db/dbGDSSRef.h b/src/odb/src/db/dbGDSSRef.h index ad1154bcd73..d2904b881bd 100644 --- a/src/odb/src/db/dbGDSSRef.h +++ b/src/odb/src/db/dbGDSSRef.h @@ -71,7 +71,7 @@ class _dbGDSSRef : public _dbGDSElement + std::to_string(_colRow.second); } - dbGDSStructure* _stucture; + dbGDSStructure* _stucture = nullptr; // User Code End Methods @@ -82,4 +82,4 @@ class _dbGDSSRef : public _dbGDSElement dbIStream& operator>>(dbIStream& stream, _dbGDSSRef& obj); dbOStream& operator<<(dbOStream& stream, const _dbGDSSRef& obj); } // namespace odb - // Generator Code End Header \ No newline at end of file + // Generator Code End Header diff --git a/src/odb/src/db/dbGDSStructure.cpp b/src/odb/src/db/dbGDSStructure.cpp index 8974004f5df..9a92dc3b88d 100644 --- a/src/odb/src/db/dbGDSStructure.cpp +++ b/src/odb/src/db/dbGDSStructure.cpp @@ -82,6 +82,7 @@ void _dbGDSStructure::out(dbDiff& diff, char side, const char* field) const _dbGDSStructure::_dbGDSStructure(_dbDatabase* db) { + _name = nullptr; } _dbGDSStructure::_dbGDSStructure(_dbDatabase* db, const _dbGDSStructure& r) diff --git a/src/odb/src/db/dbGDSText.cpp b/src/odb/src/db/dbGDSText.cpp index 11997853097..4363b2a3786 100644 --- a/src/odb/src/db/dbGDSText.cpp +++ b/src/odb/src/db/dbGDSText.cpp @@ -80,6 +80,7 @@ void _dbGDSText::out(dbDiff& diff, char side, const char* field) const _dbGDSText::_dbGDSText(_dbDatabase* db) { + _width = 0; } _dbGDSText::_dbGDSText(_dbDatabase* db, const _dbGDSText& r) diff --git a/src/odb/src/db/dbObject.cpp b/src/odb/src/db/dbObject.cpp index 2192ba73fec..11dee0a9955 100644 --- a/src/odb/src/db/dbObject.cpp +++ b/src/odb/src/db/dbObject.cpp @@ -148,6 +148,7 @@ static const char* name_tbl[] = {"dbDatabase", // Lib Objects "dbLib", + "dbGDSLib", "dbSite", "dbMaster", "dbMPin", diff --git a/src/odb/src/db/dbTechLayerAreaRule.cpp b/src/odb/src/db/dbTechLayerAreaRule.cpp index feebe190cdd..bc8d35159ec 100644 --- a/src/odb/src/db/dbTechLayerAreaRule.cpp +++ b/src/odb/src/db/dbTechLayerAreaRule.cpp @@ -217,7 +217,7 @@ int dbTechLayerAreaRule::getExceptEdgeLength() const } void dbTechLayerAreaRule::setExceptEdgeLengths( - std::pair except_edge_lengths) + const std::pair& except_edge_lengths) { _dbTechLayerAreaRule* obj = (_dbTechLayerAreaRule*) this; @@ -230,7 +230,8 @@ std::pair dbTechLayerAreaRule::getExceptEdgeLengths() const return obj->except_edge_lengths_; } -void dbTechLayerAreaRule::setExceptMinSize(std::pair except_min_size) +void dbTechLayerAreaRule::setExceptMinSize( + const std::pair& except_min_size) { _dbTechLayerAreaRule* obj = (_dbTechLayerAreaRule*) this; @@ -243,7 +244,7 @@ std::pair dbTechLayerAreaRule::getExceptMinSize() const return obj->except_min_size_; } -void dbTechLayerAreaRule::setExceptStep(std::pair except_step) +void dbTechLayerAreaRule::setExceptStep(const std::pair& except_step) { _dbTechLayerAreaRule* obj = (_dbTechLayerAreaRule*) this; diff --git a/src/odb/src/db/dbTechLayerForbiddenSpacingRule.cpp b/src/odb/src/db/dbTechLayerForbiddenSpacingRule.cpp index 9efe19284c6..eda3b1ae4b7 100644 --- a/src/odb/src/db/dbTechLayerForbiddenSpacingRule.cpp +++ b/src/odb/src/db/dbTechLayerForbiddenSpacingRule.cpp @@ -140,7 +140,7 @@ dbOStream& operator<<(dbOStream& stream, //////////////////////////////////////////////////////////////////// void dbTechLayerForbiddenSpacingRule::setForbiddenSpacing( - std::pair forbidden_spacing) + const std::pair& forbidden_spacing) { _dbTechLayerForbiddenSpacingRule* obj = (_dbTechLayerForbiddenSpacingRule*) this; diff --git a/src/odb/src/gdsin/gdsUtil.cpp b/src/odb/src/gdsin/gdsUtil.cpp index a4e79b4ab60..c06908eb8a1 100644 --- a/src/odb/src/gdsin/gdsUtil.cpp +++ b/src/odb/src/gdsin/gdsUtil.cpp @@ -166,7 +166,7 @@ std::map, std::string> getLayerMap( } int16_t layerNum = std::stoi(source.substr(0, slash_pos)); int16_t dataType = std::stoi(source.substr(slash_pos + 1, at_pos)); - layerMap[std::make_pair(layerNum, dataType)] = name; + layerMap[std::make_pair(layerNum, dataType)] = std::move(name); } return layerMap; @@ -226,4 +226,4 @@ dbGDSNode* createEmptyGDSNode(dbDatabase* db) } } // namespace gds -} // namespace odb \ No newline at end of file +} // namespace odb diff --git a/src/odb/src/gdsin/gdsin.cpp b/src/odb/src/gdsin/gdsin.cpp index 7e5804d983c..e1bde0fbd08 100644 --- a/src/odb/src/gdsin/gdsin.cpp +++ b/src/odb/src/gdsin/gdsin.cpp @@ -52,17 +52,6 @@ namespace odb { namespace gds { -GDSReader::GDSReader() : _lib(nullptr) -{ -} - -GDSReader::~GDSReader() -{ - if (_file.is_open()) { - _file.close(); - } -} - dbGDSLib* GDSReader::read_gds(const std::string& filename, dbDatabase* db) { _db = db; diff --git a/src/odb/src/gdsin/gdsout.cpp b/src/odb/src/gdsin/gdsout.cpp index fb8db0fa575..04c148394e1 100644 --- a/src/odb/src/gdsin/gdsout.cpp +++ b/src/odb/src/gdsin/gdsout.cpp @@ -236,8 +236,6 @@ void GDSWriter::writeElement(dbGDSElement* el) writeBoundary((dbGDSBoundary*) _el); } else if (dynamic_cast<_dbGDSPath*>(_el) != nullptr) { writePath((dbGDSPath*) _el); - } else if (dynamic_cast<_dbGDSSRef*>(_el) != nullptr) { - writeSRef((dbGDSSRef*) _el); } else if (dynamic_cast<_dbGDSSRef*>(_el)) { writeSRef((dbGDSSRef*) el); } else if (dynamic_cast<_dbGDSText*>(_el)) { @@ -257,7 +255,7 @@ void GDSWriter::writeElement(dbGDSElement* el) void GDSWriter::writePropAttr(dbGDSElement* el) { auto& props = el->getPropattr(); - for (auto pair : props) { + for (const auto& pair : props) { record_t r; r.type = RecordType::PROPATTR; r.dataType = DataType::INT_2;