Skip to content

Commit 85c703e

Browse files
committed
grt: make updateRouteGridsLayer more generic and add some comments
Signed-off-by: Jonas Gava <[email protected]>
1 parent 8a07873 commit 85c703e

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

src/grt/include/grt/GlobalRouter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class GlobalRouter
206206
const int& final_x,
207207
const int& final_y,
208208
const int& layer_level,
209+
const int& new_layer_level,
209210
odb::dbNet* db_net);
210211
// Incremental global routing functions.
211212
// See class IncrementalGRoute.

src/grt/src/GlobalRouter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,7 @@ void GlobalRouter::updateFastRouteGridsLayer(const int& init_x,
17151715
const int& final_x,
17161716
const int& final_y,
17171717
const int& layer_level,
1718+
const int& new_layer_level,
17181719
odb::dbNet* db_net)
17191720
{
17201721
// transform from real position to grid pos of fastrouter
@@ -1730,6 +1731,7 @@ void GlobalRouter::updateFastRouteGridsLayer(const int& init_x,
17301731
grid_final_x,
17311732
grid_final_y,
17321733
layer_level - 1,
1734+
new_layer_level - 1,
17331735
db_net);
17341736
}
17351737

src/grt/src/RepairAntennas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ void RepairAntennas::addJumperAndVias(GRoute& route,
609609
init_x, init_y, final_x, final_y, layer_level + 2, 1, db_net);
610610
// Update FastRoute Tree Edges
611611
grouter_->updateFastRouteGridsLayer(
612-
init_x, init_y, final_x, final_y, layer_level, db_net);
612+
init_x, init_y, final_x, final_y, layer_level, layer_level + 2, db_net);
613613
}
614614

615615
void RepairAntennas::addJumperToRoute(GRoute& route,

src/grt/src/fastroute/include/FastRoute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "boost/icl/interval_set.hpp"
2020
#include "boost/multi_array.hpp"
2121
#include "grt/GRoute.h"
22-
#include "odb/db.h"
2322
#include "odb/geom.h"
2423
#include "stt/SteinerTreeBuilder.h"
2524

@@ -209,6 +208,7 @@ class FastRouteCore
209208
int x2,
210209
int y2,
211210
int layer,
211+
int new_layer,
212212
odb::dbNet* db_net);
213213
void setVerbose(bool v);
214214
void setCriticalNetsPercentage(float u);

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,30 +859,44 @@ NetRouteMap FastRouteCore::getRoutes()
859859
return routes;
860860
}
861861

862+
// Updates the layer assignment for specific route segments after repair
863+
// antennas. This function is called after jumper insertion during antenna
864+
// violation repair. When a jumper is inserted to fix an antenna violation,
865+
// certain route segments need to be moved to a different layer. This function
866+
// searches through all edges of the specified net and updates the layer
867+
// assignment for any route points that fall within the specified region.
862868
void FastRouteCore::updateRouteGridsLayer(int x1,
863869
int y1,
864870
int x2,
865871
int y2,
866872
int layer,
873+
int new_layer,
867874
odb::dbNet* db_net)
868875
{
876+
// Get the internal net ID from the database net object
869877
int net_id;
870878
bool exists;
871879
getNetId(db_net, net_id, exists);
872880

881+
// Access the routing tree edges for this net
873882
std::vector<TreeEdge>& treeedges = sttrees_[net_id].edges;
874883
const int num_edges = sttrees_[net_id].num_edges();
875884

885+
// Iterate through all edges in the net's routing tree
876886
for (int edgeID = 0; edgeID < num_edges; edgeID++) {
877887
TreeEdge* treeedge = &(treeedges[edgeID]);
888+
// Only process edges that have actual routing
878889
if (treeedge->len > 0 || treeedge->route.routelen > 0) {
879890
int routeLen = treeedge->route.routelen;
880891
std::vector<GPoint3D>& grids = treeedge->route.grids;
881892

893+
// If the point is within the specified rectangular region AND on the
894+
// original layer
882895
for (int i = 0; i <= routeLen; i++) {
883896
if (grids[i].x >= x1 && grids[i].x <= x2 && grids[i].y >= y1
884897
&& grids[i].y <= y2 && grids[i].layer == layer) {
885-
grids[i].layer = layer + 2;
898+
// Update to the new layer
899+
grids[i].layer = new_layer;
886900
}
887901
}
888902
}

0 commit comments

Comments
 (0)