Skip to content

Commit ca6917b

Browse files
committed
grt: fix function that return capacity and usage per gcell
Signed-off-by: Eder Monteiro <[email protected]>
1 parent 0509bde commit ca6917b

File tree

1 file changed

+29
-21
lines changed

1 file changed

+29
-21
lines changed

src/grt/src/fastroute/src/FastRoute.cpp

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,31 +1281,39 @@ void FastRouteCore::getCapacityReductionData(
12811281
}
12821282

12831283
for (int k = 0; k < num_layers_; k++) {
1284-
const uint8_t capH = h_capacity_3D_[k];
1285-
const uint8_t capV = v_capacity_3D_[k];
1286-
const uint8_t last_row_capH = last_row_h_capacity_3D_[k];
1287-
const uint8_t last_col_capV = last_col_v_capacity_3D_[k];
12881284
bool is_horizontal
12891285
= layer_directions_[k] == odb::dbTechLayerDir::HORIZONTAL;
1290-
for (int x = 0; x < x_grid_; x++) {
1286+
const uint8_t capH = h_capacity_3D_[k];
1287+
const uint8_t capV = v_capacity_3D_[k];
1288+
1289+
if (is_horizontal) {
1290+
int last_cell_cap_h = 0;
12911291
for (int y = 0; y < y_grid_; y++) {
1292-
if (is_horizontal) {
1293-
if (!regular_y_ && y == y_grid_ - 1) {
1294-
cap_red_data[x][y].capacity += last_row_capH;
1295-
} else if (x != x_grid_ - 1 || y == y_grid_ - 1) {
1296-
// don't add horizontal cap in the last col because there is no
1297-
// usage there
1298-
cap_red_data[x][y].capacity += capH;
1299-
}
1300-
} else {
1301-
if (!regular_x_ && x == x_grid_ - 1) {
1302-
cap_red_data[x][y].capacity += last_col_capV;
1303-
} else if (y != y_grid_ - 1 || x == x_grid_ - 1) {
1304-
// don't add vertical cap in the last row because there is no usage
1305-
// there
1306-
cap_red_data[x][y].capacity += capV;
1307-
}
1292+
for (int x = 0; x < x_grid_; x++) {
1293+
const uint8_t cap_h
1294+
= x == x_grid_ - 1
1295+
? last_cell_cap_h
1296+
: h_edges_3D_[k][y][x].cap + h_edges_3D_[k][y][x].red;
1297+
cap_red_data[x][y].capacity += cap_h;
1298+
last_cell_cap_h = cap_h;
13081299
}
1300+
}
1301+
} else {
1302+
int last_cell_cap_v = 0;
1303+
for (int x = 0; x < x_grid_; x++) {
1304+
for (int y = 0; y < y_grid_; y++) {
1305+
const uint8_t cap_v
1306+
= y == y_grid_ - 1
1307+
? last_cell_cap_v
1308+
: v_edges_3D_[k][y][x].cap + v_edges_3D_[k][y][x].red;
1309+
cap_red_data[x][y].capacity += cap_v;
1310+
last_cell_cap_v = cap_v;
1311+
}
1312+
}
1313+
}
1314+
1315+
for (int x = 0; x < x_grid_; x++) {
1316+
for (int y = 0; y < y_grid_; y++) {
13091317
if (x == x_grid_ - 1 && y == y_grid_ - 1 && x_grid_ > 1
13101318
&& y_grid_ > 1) {
13111319
uint8_t blockageH = h_edges_3D_[k][y][x - 1].red;

0 commit comments

Comments
 (0)