Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into drt_minor_refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bnmfw committed Sep 26, 2024
2 parents f252387 + a320725 commit 4f92caf
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 73 deletions.
2 changes: 1 addition & 1 deletion src/grt/include/grt/GlobalRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class GlobalRouter : public ant::GlobalRouteSource
void setCapacities(int min_routing_layer, int max_routing_layer);
void initNetlist(std::vector<Net*>& nets);
bool makeFastrouteNet(Net* net);
bool pinPositionsChanged(Net* net, std::multiset<RoutePt>& last_pos);
bool pinPositionsChanged(Net* net);
bool newPinOnGrid(Net* net, std::multiset<RoutePt>& last_pos);
std::vector<LayerId> findTransitionLayers();
void adjustTransitionLayers(
Expand Down
29 changes: 13 additions & 16 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,6 @@ void GlobalRouter::updateDirtyNets(std::vector<Net*>& 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<RoutePt> 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());
Expand All @@ -625,7 +618,7 @@ void GlobalRouter::updateDirtyNets(std::vector<Net*>& 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();
Expand All @@ -639,6 +632,7 @@ void GlobalRouter::updateDirtyNets(std::vector<Net*>& dirty_nets)
}
net->setMergedNet(false);
net->setDirtyNet(false);
net->clearLastPinPositions();
}
dirty_nets_.clear();
}
Expand Down Expand Up @@ -1061,11 +1055,11 @@ void GlobalRouter::initNetlist(std::vector<Net*>& nets)
}
}

bool GlobalRouter::pinPositionsChanged(Net* net,
std::multiset<RoutePt>& last_pos)
bool GlobalRouter::pinPositionsChanged(Net* net)
{
bool is_diferent = false;
std::map<RoutePt, int> cnt_pos;
const std::multiset<RoutePt>& last_pos = net->getLastPinPositions();
for (const Pin& pin : net->getPins()) {
cnt_pos[RoutePt(pin.getOnGridPosition().getX(),
pin.getOnGridPosition().getY(),
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}

Expand Down
32 changes: 32 additions & 0 deletions src/grt/src/Net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include "Net.h"

#include "grt/GlobalRouter.h"
#include "odb/dbShape.h"

namespace grt {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions src/grt/src/Net.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include "Pin.h"
#include "grt/GRoute.h"
#include "grt/RoutePt.h"
#include "odb/db.h"

namespace grt {
Expand Down Expand Up @@ -71,8 +72,16 @@ class Net
std::vector<std::vector<SegmentIndex>> 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<RoutePt>& 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; }
Expand All @@ -86,6 +95,7 @@ class Net
float slack_;
bool has_wires_;
std::vector<SegmentIndex> parent_segment_indices_;
std::multiset<RoutePt> last_pin_positions_;
bool merged_net_;
bool is_dirty_net_;
};
Expand Down
10 changes: 5 additions & 5 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -8565,15 +8565,15 @@ class dbTechLayerAreaRule : public dbObject

int getExceptEdgeLength() const;

void setExceptEdgeLengths(std::pair<int, int> except_edge_lengths);
void setExceptEdgeLengths(const std::pair<int, int>& except_edge_lengths);

std::pair<int, int> getExceptEdgeLengths() const;

void setExceptMinSize(std::pair<int, int> except_min_size);
void setExceptMinSize(const std::pair<int, int>& except_min_size);

std::pair<int, int> getExceptMinSize() const;

void setExceptStep(std::pair<int, int> except_step);
void setExceptStep(const std::pair<int, int>& except_step);

std::pair<int, int> getExceptStep() const;

Expand Down Expand Up @@ -9564,7 +9564,7 @@ class dbTechLayerEolKeepOutRule : public dbObject
class dbTechLayerForbiddenSpacingRule : public dbObject
{
public:
void setForbiddenSpacing(std::pair<int, int> forbidden_spacing);
void setForbiddenSpacing(const std::pair<int, int>& forbidden_spacing);

std::pair<int, int> getForbiddenSpacing() const;

Expand Down Expand Up @@ -10354,7 +10354,7 @@ class dbGDSSRef : public dbGDSElement

dbGDSSTrans getTransform() const;

void set_colRow(std::pair<int16_t, int16_t> colRow);
void set_colRow(const std::pair<int16_t, int16_t>& colRow);

std::pair<int16_t, int16_t> get_colRow() const;

Expand Down
17 changes: 2 additions & 15 deletions src/odb/include/odb/gdsin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/odb/src/codeGenerator/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion src/odb/src/codeGenerator/schema/gds/dbGDSElement.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
{
"name":"_layer",
"type":"int16_t",
"default":"0",
"flags":[]
},
{
"name":"_datatype",
"type":"int16_t",
"default":"0",
"flags":[]
},
{
Expand All @@ -28,4 +30,4 @@
"odb/geom.h"
],
"cpp_includes": ["odb/dbTypes.h"]
}
}
4 changes: 3 additions & 1 deletion src/odb/src/codeGenerator/schema/gds/dbGDSPath.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"fields":[
{
"name":"_width",
"default":"0",
"type":"int",
"flags":[]
},
{
"name":"_pathType",
"type":"int16_t",
"default":"0",
"flags":[]
}
],
Expand All @@ -18,4 +20,4 @@
],
"cpp_includes": ["odb/dbTypes.h", "odb/geom.h"]
}


3 changes: 2 additions & 1 deletion src/odb/src/codeGenerator/schema/gds/dbGDSStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{
"name":"_name",
"type":"char*",
"default":"nullptr",
"flags":["no-set"]
},
{
Expand All @@ -26,4 +27,4 @@
],
"cpp_includes": ["odb/dbTypes.h", "dbGDSLib.h","dbHashTable.hpp"]
}


3 changes: 2 additions & 1 deletion src/odb/src/codeGenerator/schema/gds/dbGDSText.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{
"name":"_width",
"type":"int",
"default":"0",
"flags":[]
},
{
Expand All @@ -28,4 +29,4 @@
],
"cpp_includes": ["odb/dbTypes.h"]
}


2 changes: 2 additions & 0 deletions src/odb/src/db/dbGDSElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/odb/src/db/dbGDSLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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)
{
}

Expand Down Expand Up @@ -299,4 +301,3 @@ dbSet<dbGDSStructure> dbGDSLib::getGDSStructures()
return dbSet<dbGDSStructure>(obj, obj->_structure_tbl);
}
} // namespace odb
// Generator Code End Cpp
8 changes: 3 additions & 5 deletions src/odb/src/db/dbGDSLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ctime>

#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 <ctime>
// User Code End Includes

namespace odb {
class dbIStream;
Expand Down Expand Up @@ -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
} // namespace odb
Loading

0 comments on commit 4f92caf

Please sign in to comment.