Skip to content

Commit f00c31a

Browse files
committed
grt: prevent assigning routing edges out of the net layer range
Signed-off-by: Eder Monteiro <[email protected]>
1 parent 4c953a8 commit f00c31a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/grt/src/cugr/src/GRNet.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ GRNet::GRNet(const CUGRNet& baseNet, const GridGraph* gridGraph)
1818
db_net_ = baseNet.getDbNet();
1919
const int numPins = baseNet.getNumPins();
2020
pin_access_points_.resize(numPins);
21+
layer_range_ = baseNet.getLayerRange();
2122
for (CUGRPin& pin : baseNet.getPins()) {
2223
const std::vector<BoxOnLayer> pinShapes = pin.getPinShapes();
2324
std::unordered_set<uint64_t> included;
@@ -43,4 +44,10 @@ GRNet::GRNet(const CUGRNet& baseNet, const GridGraph* gridGraph)
4344
}
4445
}
4546

47+
bool GRNet::isInsideLayerRange(int layer_index) const
48+
{
49+
return layer_index >= layer_range_.min_layer
50+
&& layer_index <= layer_range_.max_layer;
51+
}
52+
4653
} // namespace grt

src/grt/src/cugr/src/GRNet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ class GRNet
3939
routing_tree_ = std::move(tree);
4040
}
4141
void clearRoutingTree() { routing_tree_ = nullptr; }
42+
bool isInsideLayerRange(int layer_index) const;
4243

4344
private:
4445
int index_;
4546
odb::dbNet* db_net_;
4647
std::vector<std::vector<GRPoint>> pin_access_points_;
4748
BoxT bounding_box_;
4849
std::shared_ptr<GRTreeNode> routing_tree_;
50+
LayerRange layer_range_;
4951
};
5052

5153
} // namespace grt

src/grt/src/cugr/src/PatternRoute.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,11 @@ void PatternRoute::calculateRoutingCosts(
546546
if (grid_graph_->getLayerDirection(layerIndex) != direction) {
547547
continue;
548548
}
549-
CostT cost = path->getCosts()[layerIndex]
550-
+ grid_graph_->getWireCost(layerIndex, *node, *path);
549+
CostT cost
550+
= net_->isInsideLayerRange(layerIndex)
551+
? path->getCosts()[layerIndex]
552+
+ grid_graph_->getWireCost(layerIndex, *node, *path)
553+
: std::numeric_limits<CostT>::max();
551554
if (cost < costs[layerIndex].first) {
552555
costs[layerIndex] = std::make_pair(cost, pathIndex);
553556
}

0 commit comments

Comments
 (0)