Skip to content

Commit bb092b8

Browse files
authored
Merge pull request #8328 from The-OpenROAD-Project-staging/cugr-refactor2
Cugr refactor2
2 parents e5d96d5 + 5952215 commit bb092b8

File tree

11 files changed

+287
-256
lines changed

11 files changed

+287
-256
lines changed

src/grt/src/cugr/src/CUGR.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void CUGR::init(const int min_routing_layer, const int max_routing_layer)
4141
{
4242
design_ = std::make_unique<Design>(
4343
db_, logger_, constants_, min_routing_layer, max_routing_layer);
44-
grid_graph_ = std::make_unique<GridGraph>(design_.get(), constants_);
44+
grid_graph_ = std::make_unique<GridGraph>(design_.get(), constants_, logger_);
4545
// Instantiate the global routing netlist
4646
const std::vector<CUGRNet>& baseNets = design_->getAllNets();
4747
gr_nets_.reserve(baseNets.size());
@@ -67,8 +67,11 @@ void CUGR::patternRoute(std::vector<int>& netIndices)
6767
logger_->report("stage 1: pattern routing");
6868
sortNetIndices(netIndices);
6969
for (const int netIndex : netIndices) {
70-
PatternRoute patternRoute(
71-
gr_nets_[netIndex].get(), grid_graph_.get(), stt_builder_, constants_);
70+
PatternRoute patternRoute(gr_nets_[netIndex].get(),
71+
grid_graph_.get(),
72+
stt_builder_,
73+
constants_,
74+
logger_);
7275
patternRoute.constructSteinerTree();
7376
patternRoute.constructRoutingDAG();
7477
patternRoute.run();
@@ -90,8 +93,9 @@ void CUGR::patternRouteWithDetours(std::vector<int>& netIndices)
9093
sortNetIndices(netIndices);
9194
for (const int netIndex : netIndices) {
9295
GRNet* net = gr_nets_[netIndex].get();
93-
grid_graph_->commitTree(net->getRoutingTree(), true);
94-
PatternRoute patternRoute(net, grid_graph_.get(), stt_builder_, constants_);
96+
grid_graph_->commitTree(net->getRoutingTree(), /*ripup*/ true);
97+
PatternRoute patternRoute(
98+
net, grid_graph_.get(), stt_builder_, constants_, logger_);
9599
patternRoute.constructSteinerTree();
96100
patternRoute.constructRoutingDAG();
97101
// KEY DIFFERENCE compared to stage 1 (patternRoute)
@@ -110,21 +114,23 @@ void CUGR::mazeRoute(std::vector<int>& netIndices)
110114
}
111115
logger_->report("stage 3: maze routing on sparsified routing graph");
112116
for (const int netIndex : netIndices) {
113-
grid_graph_->commitTree(gr_nets_[netIndex]->getRoutingTree(), true);
117+
grid_graph_->commitTree(gr_nets_[netIndex]->getRoutingTree(),
118+
/*ripup*/ true);
114119
}
115120
GridGraphView<CostT> wireCostView;
116121
grid_graph_->extractWireCostView(wireCostView);
117122
sortNetIndices(netIndices);
118123
SparseGrid grid(10, 10, 0, 0);
119124
for (const int netIndex : netIndices) {
120125
GRNet* net = gr_nets_[netIndex].get();
121-
MazeRoute mazeRoute(net, grid_graph_.get());
126+
MazeRoute mazeRoute(net, grid_graph_.get(), logger_);
122127
mazeRoute.constructSparsifiedGraph(wireCostView, grid);
123128
mazeRoute.run();
124129
std::shared_ptr<SteinerTreeNode> tree = mazeRoute.getSteinerTree();
125130
assert(tree != nullptr);
126131

127-
PatternRoute patternRoute(net, grid_graph_.get(), stt_builder_, constants_);
132+
PatternRoute patternRoute(
133+
net, grid_graph_.get(), stt_builder_, constants_, logger_);
128134
patternRoute.setSteinerTree(tree);
129135
patternRoute.constructRoutingDAG();
130136
patternRoute.run();
@@ -169,10 +175,10 @@ void CUGR::write(const std::string& guide_file)
169175
ss << net->getName() << '\n';
170176
ss << "(\n";
171177
for (const auto& guide : guides) {
172-
ss << grid_graph_->getGridline(0, guide.second.x.low()) << " "
173-
<< grid_graph_->getGridline(1, guide.second.y.low()) << " "
174-
<< grid_graph_->getGridline(0, guide.second.x.high() + 1) << " "
175-
<< grid_graph_->getGridline(1, guide.second.y.high() + 1) << " "
178+
ss << grid_graph_->getGridline(0, guide.second.lx()) << " "
179+
<< grid_graph_->getGridline(1, guide.second.ly()) << " "
180+
<< grid_graph_->getGridline(0, guide.second.hx() + 1) << " "
181+
<< grid_graph_->getGridline(1, guide.second.hy() + 1) << " "
176182
<< grid_graph_->getLayerName(guide.first) << "\n";
177183
}
178184
ss << ")\n";
@@ -325,8 +331,8 @@ void CUGR::getGuides(const GRNet* net,
325331
(int) grid_graph_->getSize(0) - 1),
326332
std::min(gpt.y() + padding,
327333
(int) grid_graph_->getSize(1) - 1)));
328-
area_of_pin_patches_ += (guides.back().second.x.range() + 1)
329-
* (guides.back().second.y.range() + 1);
334+
area_of_pin_patches_ += (guides.back().second.x().range() + 1)
335+
* (guides.back().second.y().range() + 1);
330336
}
331337
}
332338
}

src/grt/src/cugr/src/Design.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void Design::getAllObstacles(std::vector<std::vector<BoxT>>& all_obstacles,
274274

275275
for (const BoxOnLayer& obs : obstacles_) {
276276
if (obs.getLayerIdx() > 0 || !skip_m1) {
277-
all_obstacles[obs.getLayerIdx()].emplace_back(obs.x, obs.y);
277+
all_obstacles[obs.getLayerIdx()].emplace_back(obs.x(), obs.y());
278278
}
279279
}
280280
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ GRNet::GRNet(const CUGRNet& baseNet, const GridGraph* gridGraph)
2323
std::unordered_set<uint64_t> included;
2424
for (const auto& pinShape : pinShapes) {
2525
const BoxT cells = gridGraph->rangeSearchCells(pinShape);
26-
for (int x = cells.x.low(); x <= cells.x.high(); x++) {
27-
for (int y = cells.y.low(); y <= cells.y.high(); y++) {
26+
for (int x = cells.lx(); x <= cells.hx(); x++) {
27+
for (int y = cells.ly(); y <= cells.hy(); y++) {
2828
const GRPoint point(pinShape.getLayerIdx(), x, y);
2929
const uint64_t hash = gridGraph->hashCell(point);
3030
if (included.find(hash) == included.end()) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class GRNet
2323
odb::dbNet* getDbNet() const { return db_net_; }
2424
std::string getName() const { return db_net_->getName(); }
2525
int getNumPins() const { return pin_access_points_.size(); }
26+
// vector foreach pin -> list of APs
2627
const std::vector<std::vector<GRPoint>>& getPinAccessPoints() const
2728
{
2829
return pin_access_points_;

0 commit comments

Comments
 (0)