Skip to content

Commit 779caf9

Browse files
committed
Merge remote-tracking branch 'origin' into ant_check_special_nets_issue
Signed-off-by: luis201420 <[email protected]>
2 parents 7e53229 + 42d275f commit 779caf9

26 files changed

+241
-159
lines changed

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,7 @@ build:openroad-dev --google_default_credentials=true
9797
build:openroad-dev --disk_cache=/workspace/.cache/bazel-disk-cache
9898
build:openroad-dev --repository_cache=/workspace/.cache/bazel-repository-cache
9999

100+
# Without this, bazelisk build ... builds the bazel-orfs tests
101+
build --build_tag_filters=-orfs
102+
100103
try-import %workspace%/user.bazelrc

MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bazel_dep(name = "bazel-orfs")
152152
# To bump version, run: bazelisk run @bazel-orfs//:bump
153153
git_override(
154154
module_name = "bazel-orfs",
155-
commit = "25aa6f643146394f201eac5ef4df69887c83859f",
155+
commit = "f9c37f21de8e1095276e878d1628ac7a2f7908ab",
156156
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
157157
)
158158

@@ -161,10 +161,10 @@ orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
161161
# To bump version, run: bazelisk run @bazel-orfs//:bump
162162
orfs.default(
163163
# Official image https://hub.docker.com/r/openroad/orfs/tags
164-
image = "docker.io/openroad/orfs:v3.0-3766-g33e29bff",
164+
image = "docker.io/openroad/orfs:v3.0-3780-g2f349ade",
165165
# Use OpenROAD of this repo instead of from the docker image
166166
openroad = "//:openroad",
167-
sha256 = "edaf81aaab215ffa82e21f1b98fadb0d42da35444b39b524452a6ee52db5fea5",
167+
sha256 = "637ffa1af0f224e17e3d5cddbe6b45d9b00102016acc9e866226e8c4e830aeab",
168168
)
169169
use_repo(orfs, "com_github_nixos_patchelf_download")
170170
use_repo(orfs, "docker_orfs")

MODULE.bazel.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

etc/DependencyInstaller.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ _installCommonDev() {
7575
spdlogVersion=1.15.0
7676
gtestVersion=1.13.0
7777
gtestChecksum="a1279c6fb5bf7d4a5e0d0b2a4adb39ac"
78+
abslVersion=20250814.0
79+
abslChecksum="016feacd6a6b3b9a47ab844e61f4f7bd"
7880
bisonVersion=3.8.2
7981
bisonChecksum="1e541a097cda9eca675d29dd2832921f"
8082
flexVersion=2.6.4
@@ -262,6 +264,21 @@ _installCommonDev() {
262264
fi
263265
CMAKE_PACKAGE_ROOT_ARGS+=" -D GTest_ROOT=$(realpath $gtestPrefix) "
264266

267+
# Abseil
268+
abslPrefix=${PREFIX:-"/usr/local"}
269+
if [[ ! -d ${abslPrefix}/absl/base ]]; then
270+
cd "${baseDir}"
271+
eval wget https://github.com/abseil/abseil-cpp/releases/download/${abslVersion}/abseil-cpp-${abslVersion}.tar.gz
272+
md5sum -c <(echo "${abslChecksum} abseil-cpp-${abslVersion}.tar.gz") || exit 1
273+
tar xf abseil-cpp-${abslVersion}.tar.gz
274+
cd abseil-cpp-${abslVersion}
275+
${cmakePrefix}/bin/cmake -DCMAKE_INSTALL_PREFIX="${abslPrefix}" -DCMAKE_CXX_STANDARD=17 -B build .
276+
${cmakePrefix}/bin/cmake --build build --target install
277+
else
278+
echo "Abseil already installed."
279+
fi
280+
CMAKE_PACKAGE_ROOT_ARGS+=" -D ABSL_ROOT=$(realpath $abslPrefix) "
281+
265282
if [[ ${equivalenceDeps} == "yes" ]]; then
266283
_equivalenceDeps
267284
fi

src/grt/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ cc_library(
6565
cc_library(
6666
name = "cugr",
6767
srcs = [
68+
"src/cugr/src/geo.h",
6869
"src/cugr/src/CUGR.cpp",
6970
"src/cugr/src/Design.cpp",
7071
"src/cugr/src/Design.h",
@@ -88,7 +89,6 @@ cc_library(
8889
],
8990
hdrs = [
9091
"src/cugr/include/CUGR.h",
91-
"src/cugr/include/geo.h",
9292
],
9393
includes = [
9494
"include",

src/grt/src/cugr/include/CUGR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <utility>
77
#include <vector>
88

9-
#include "geo.h"
109
#include "grt/GRoute.h"
1110

1211
namespace odb {
@@ -26,6 +25,7 @@ namespace grt {
2625
class Design;
2726
class GridGraph;
2827
class GRNet;
28+
class BoxT;
2929

3030
struct Constants
3131
{

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ void CUGR::route()
7575
netIndices.push_back(net->getIndex());
7676
}
7777
}
78-
std::cout << netIndices.size() << " / " << gr_nets_.size()
79-
<< " gr_nets_ have overflows.\n";
78+
logger_->report(
79+
"{} / {} gr_nets_ have overflows.", netIndices.size(), gr_nets_.size());
8080

8181
// Stage 2: Pattern routing with possible detours
8282
if (!netIndices.empty()) {
@@ -108,13 +108,13 @@ void CUGR::route()
108108
netIndices.push_back(net->getIndex());
109109
}
110110
}
111-
std::cout << netIndices.size() << " / " << gr_nets_.size()
112-
<< " gr_nets_ have overflows.\n";
111+
logger_->report(
112+
"{} / {} gr_nets_ have overflows.", netIndices.size(), gr_nets_.size());
113113
}
114114

115115
// Stage 3: maze routing on sparsified routing graph
116116
if (!netIndices.empty()) {
117-
std::cout << "stage 3: maze routing on sparsified routing graph\n";
117+
logger_->report("stage 3: maze routing on sparsified routing graph");
118118
for (const int netIndex : netIndices) {
119119
grid_graph_->commitTree(gr_nets_[netIndex]->getRoutingTree(), true);
120120
}
@@ -148,8 +148,8 @@ void CUGR::route()
148148
netIndices.push_back(net->getIndex());
149149
}
150150
}
151-
std::cout << netIndices.size() << " / " << gr_nets_.size()
152-
<< " gr_nets_ have overflows.\n";
151+
logger_->report(
152+
"{} / {} gr_nets_ have overflows.", netIndices.size(), gr_nets_.size());
153153
}
154154

155155
printStatistics();
@@ -202,7 +202,7 @@ NetRouteMap CUGR::getRoutes()
202202
if (routing_tree) {
203203
GRTreeNode::preorder(
204204
routing_tree, [&](const std::shared_ptr<GRTreeNode>& node) {
205-
for (const auto& child : node->children) {
205+
for (const auto& child : node->getChildren()) {
206206
if (node->getLayerIdx() == child->getLayerIdx()) {
207207
auto [min_x, max_x] = std::minmax({node->x(), child->x()});
208208
auto [min_y, max_y] = std::minmax({node->y(), child->y()});
@@ -263,7 +263,7 @@ void CUGR::getGuides(const GRNet* net,
263263
// 0. Basic guides
264264
GRTreeNode::preorder(
265265
routingTree, [&](const std::shared_ptr<GRTreeNode>& node) {
266-
for (const auto& child : node->children) {
266+
for (const auto& child : node->getChildren()) {
267267
if (node->getLayerIdx() == child->getLayerIdx()) {
268268
guides.emplace_back(node->getLayerIdx(),
269269
BoxT(std::min(node->x(), child->x()),
@@ -334,7 +334,7 @@ void CUGR::getGuides(const GRNet* net,
334334
// 2. Wire segment patches
335335
GRTreeNode::preorder(
336336
routingTree, [&](const std::shared_ptr<GRTreeNode>& node) {
337-
for (const auto& child : node->children) {
337+
for (const auto& child : node->getChildren()) {
338338
if (node->getLayerIdx() == child->getLayerIdx()) {
339339
double wire_patch_threshold = constants_.wire_patch_threshold;
340340
unsigned direction
@@ -389,7 +389,7 @@ void CUGR::printStatistics() const
389389
for (const auto& net : gr_nets_) {
390390
GRTreeNode::preorder(
391391
net->getRoutingTree(), [&](const std::shared_ptr<GRTreeNode>& node) {
392-
for (const auto& child : node->children) {
392+
for (const auto& child : node->getChildren()) {
393393
if (node->getLayerIdx() == child->getLayerIdx()) {
394394
unsigned direction
395395
= grid_graph_->getLayerDirection(node->getLayerIdx());
@@ -436,13 +436,13 @@ void CUGR::printStatistics() const
436436
}
437437
}
438438

439-
std::cout << "wire length (metric): "
440-
<< wireLength / grid_graph_->getM2Pitch() << "\n";
441-
std::cout << "total via count: " << viaCount << "\n";
442-
std::cout << "total wire overflow: " << (int) overflow << "\n";
439+
logger_->report("wire length (metric): {}",
440+
wireLength / grid_graph_->getM2Pitch());
441+
logger_->report("total via count: {}", viaCount);
442+
logger_->report("total wire overflow: {}", (int) overflow);
443443

444-
std::cout << "min resource: " << minResource << "\n";
445-
std::cout << "bottleneck: " << bottleneck << "\n";
444+
logger_->report("min resource: {}", minResource);
445+
logger_->report("bottleneck: {}", bottleneck);
446446
}
447447

448448
} // namespace grt

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

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Design::Design(odb::dbDatabase* db,
3333
void Design::read()
3434
{
3535
lib_dbu_ = block_->getDbUnitsPerMicron();
36-
auto dieBound = block_->getDieArea();
36+
const odb::Rect dieBound = block_->getDieArea();
3737
die_region_ = getBoxFromRect(dieBound);
3838

3939
readLayers();
@@ -42,18 +42,19 @@ void Design::read()
4242

4343
readInstanceObstructions();
4444

45-
int num_special_nets = 0;
46-
readSpecialNetObstructions(num_special_nets);
45+
const int num_special_nets = readSpecialNetObstructions();
4746

4847
computeGrid();
4948

50-
std::cout << "design statistics\n";
51-
std::cout << "lib DBU: " << lib_dbu_ << '\n';
52-
std::cout << "die region (in DBU): " << die_region_ << '\n';
53-
std::cout << "num of nets : " << nets_.size() << '\n';
54-
std::cout << "num of special nets: " << num_special_nets << '\n';
55-
std::cout << "gcell grid: " << gridlines_[0].size() - 1 << " x "
56-
<< gridlines_[1].size() - 1 << " x " << getNumLayers() << '\n';
49+
logger_->report("design statistics");
50+
logger_->report("lib DBU: {}", lib_dbu_);
51+
logger_->report("die region (in DBU): {}", die_region_);
52+
logger_->report("num of nets : {}", nets_.size());
53+
logger_->report("num of special nets: {}", num_special_nets);
54+
logger_->report("gcell grid: {} x {} x {}",
55+
gridlines_[0].size() - 1,
56+
gridlines_[1].size() - 1,
57+
getNumLayers());
5758
}
5859

5960
void Design::readLayers()
@@ -184,14 +185,16 @@ void Design::readInstanceObstructions()
184185
}
185186
}
186187

187-
void Design::readSpecialNetObstructions(int& num_special_nets)
188+
int Design::readSpecialNetObstructions()
188189
{
190+
int num_special_nets = 0;
189191
for (odb::dbNet* db_net : block_->getNets()) {
190192
if (!db_net->isSpecial() && !db_net->getSigType().isSupply()) {
191193
continue;
192194
}
193195

194-
odb::uint wire_cnt = 0, via_cnt = 0;
196+
odb::uint wire_cnt = 0;
197+
odb::uint via_cnt = 0;
195198
db_net->getWireCount(wire_cnt, via_cnt);
196199
if (wire_cnt == 0) {
197200
continue;
@@ -231,6 +234,7 @@ void Design::readSpecialNetObstructions(int& num_special_nets)
231234

232235
num_special_nets++;
233236
}
237+
return num_special_nets;
234238
}
235239

236240
void Design::computeGrid()
@@ -251,7 +255,7 @@ void Design::computeGrid()
251255

252256
void Design::setUnitCosts()
253257
{
254-
int m2_pitch = layers_[1].getPitch();
258+
const int m2_pitch = layers_[1].getPitch();
255259
unit_length_wire_cost_ = constants_.weight_wire_length / m2_pitch;
256260
unit_via_cost_ = constants_.weight_via_number;
257261
unit_length_short_costs_.resize(layers_.size());
@@ -264,7 +268,7 @@ void Design::setUnitCosts()
264268
}
265269

266270
void Design::getAllObstacles(std::vector<std::vector<BoxT>>& all_obstacles,
267-
bool skip_m1) const
271+
const bool skip_m1) const
268272
{
269273
all_obstacles.resize(getNumLayers());
270274

@@ -278,13 +282,13 @@ void Design::getAllObstacles(std::vector<std::vector<BoxT>>& all_obstacles,
278282
void Design::printNets() const
279283
{
280284
for (const CUGRNet& net : nets_) {
281-
std::cout << "Net: " << net.getName() << '\n';
285+
logger_->report("Net: {}", net.getName());
282286
for (const auto& pin : net.getPins()) {
283-
std::cout << "\tPin: " << pin.getName() << "\n";
287+
logger_->report("\tPin: {}", pin.getName());
284288
for (const auto& box : pin.getPinShapes()) {
285-
std::cout << "\t\t" << box << "\n"; // adjust to 1-based
289+
logger_->report("\t\t{}", box);
286290
}
287-
std::cout << '\n';
291+
logger_->report("");
288292
}
289293
}
290294
}
@@ -293,14 +297,13 @@ void Design::printBlockages() const
293297
{
294298
std::vector<std::vector<BoxT>> all_obstacles;
295299
getAllObstacles(all_obstacles, true);
296-
std::cout << "design obstacles: " << all_obstacles.size() << '\n';
300+
logger_->report("design obstacles: {}", all_obstacles.size());
297301
for (int i = 0; i < all_obstacles.size(); i++) {
298-
std::cout << "obs in layer " << (i + 1) << ": " << all_obstacles[i].size()
299-
<< '\n';
302+
logger_->report("obs in layer {}: {}", (i + 1), all_obstacles[i].size());
300303
for (const auto& obstacle : all_obstacles[i]) {
301-
std::cout << " Obstacle on layer "
302-
<< (i + 1) // adjust to 1-based layer index
303-
<< ": " << obstacle << '\n';
304+
logger_->report(" Obstacle on layer {}: {}",
305+
(i + 1), // adjust to 1-based layer index
306+
obstacle);
304307
}
305308
}
306309
}

src/grt/src/cugr/src/Design.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Design
6363
void readLayers();
6464
void readNetlist();
6565
void readInstanceObstructions();
66-
void readSpecialNetObstructions(int& num_special_nets);
66+
int readSpecialNetObstructions();
6767
void computeGrid();
6868
void setUnitCosts();
6969

@@ -90,9 +90,9 @@ class Design
9090
int default_gridline_spacing_;
9191
std::vector<std::vector<int>> gridlines_;
9292

93-
Constants constants_;
94-
int min_routing_layer_;
95-
int max_routing_layer_;
93+
const Constants constants_;
94+
const int min_routing_layer_;
95+
const int max_routing_layer_;
9696
};
9797

9898
} // namespace grt

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
namespace grt {
1414

15-
GRNet::GRNet(const CUGRNet& baseNet, GridGraph* gridGraph)
15+
GRNet::GRNet(const CUGRNet& baseNet, const GridGraph* gridGraph)
1616
{
1717
index_ = baseNet.getIndex();
1818
db_net_ = baseNet.getDbNet();
19-
int numPins = baseNet.getNumPins();
19+
const int numPins = baseNet.getNumPins();
2020
pin_access_points_.resize(numPins);
2121
for (CUGRPin& pin : baseNet.getPins()) {
22-
std::vector<BoxOnLayer> pinShapes = pin.getPinShapes();
22+
const std::vector<BoxOnLayer> pinShapes = pin.getPinShapes();
2323
std::unordered_set<uint64_t> included;
2424
for (const auto& pinShape : pinShapes) {
25-
BoxT cells = gridGraph->rangeSearchCells(pinShape);
25+
const BoxT cells = gridGraph->rangeSearchCells(pinShape);
2626
for (int x = cells.x.low; x <= cells.x.high; x++) {
2727
for (int y = cells.y.low; y <= cells.y.high; y++) {
28-
GRPoint point(pinShape.getLayerIdx(), x, y);
29-
uint64_t hash = gridGraph->hashCell(point);
28+
const GRPoint point(pinShape.getLayerIdx(), x, y);
29+
const uint64_t hash = gridGraph->hashCell(point);
3030
if (included.find(hash) == included.end()) {
3131
pin_access_points_[pin.getIndex()].emplace_back(
3232
pinShape.getLayerIdx(), x, y);

0 commit comments

Comments
 (0)