Skip to content

Commit

Permalink
transform skip net check into method
Browse files Browse the repository at this point in the history
Signed-off-by: arthur <[email protected]>
  • Loading branch information
arthurjolo committed Dec 7, 2023
1 parent 1e97f31 commit f1ccd52
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 46 deletions.
1 change: 1 addition & 0 deletions src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ class FastRouteCore
int l,
bool horizontal,
int& best_cost);
bool skipNet(int netID);
void assignEdge(int netID, int edgeID, bool processDIR);
void recoverEdge(int netID, int edgeID);
void layerAssignmentV4();
Expand Down
13 changes: 5 additions & 8 deletions src/grt/src/fastroute/src/FastRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ NetRouteMap FastRouteCore::getRoutes()
{
NetRouteMap routes;
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -748,7 +748,7 @@ NetRouteMap FastRouteCore::getPlanarRoutes()
// Get routes before layer assignment

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1022,8 +1022,7 @@ NetRouteMap FastRouteCore::run()
// debug mode Rectilinear Steiner Tree before overflow iterations
if (debug_->isOn() && debug_->rectilinearSTree_) {
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID]->getDbNet() == debug_->net_ && !nets_[netID]->isRouted()
&& nets_[netID] != nullptr) {
if (nets_[netID]->getDbNet() == debug_->net_ && !skipNet(netID)) {
StTreeVisualization(sttrees_[netID], nets_[netID], false);
}
}
Expand Down Expand Up @@ -1274,8 +1273,7 @@ NetRouteMap FastRouteCore::run()
// Debug mode Tree 2D after overflow iterations
if (debug_->isOn() && debug_->tree2D_) {
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID]->getDbNet() == debug_->net_ && !nets_[netID]->isRouted()
&& nets_[netID] != nullptr) {
if (nets_[netID]->getDbNet() == debug_->net_ && !skipNet(netID)) {
StTreeVisualization(sttrees_[netID], nets_[netID], false);
}
}
Expand Down Expand Up @@ -1332,8 +1330,7 @@ NetRouteMap FastRouteCore::run()
// Debug mode Tree 3D after layer assignament
if (debug_->isOn() && debug_->tree3D_) {
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID]->getDbNet() == debug_->net_ && !nets_[netID]->isRouted()
&& nets_[netID] != nullptr) {
if (nets_[netID]->getDbNet() == debug_->net_ && !skipNet(netID)) {
StTreeVisualization(sttrees_[netID], nets_[netID], true);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/grt/src/fastroute/src/RSMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,12 @@ void FastRouteCore::gen_brk_RSMT(const bool congestionDriven,
const int flute_accuracy = 2;

for (int i = 0; i < netCount(); i++) {
FrNet* net = nets_[i];

if (net == nullptr || net->isRouted()) {
if (skipNet(i)) {
continue;
}

FrNet* net = nets_[i];

float coeffV = 1.36;

bool cong;
Expand Down
6 changes: 3 additions & 3 deletions src/grt/src/fastroute/src/maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void FastRouteCore::fixEmbeddedTrees()
// i.e., when running overflow iterations
if (overflow_iterations_ > 0) {
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] != nullptr && !nets_[netID]->isRouted()) {
if (!skipNet(netID)) {
checkAndFixEmbeddedTree(netID);
}
}
Expand Down Expand Up @@ -500,7 +500,7 @@ void FastRouteCore::convertToMazerouteNet(const int netID)
void FastRouteCore::convertToMazeroute()
{
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] != nullptr && !nets_[netID]->isRouted()) {
if (!skipNet(netID)) {
convertToMazerouteNet(netID);
}
}
Expand Down Expand Up @@ -1383,7 +1383,7 @@ void FastRouteCore::mazeRouteMSMD(const int iter,
for (int nidRPC = 0; nidRPC < netCount(); nidRPC++) {
const int netID = ordering ? tree_order_cong_[nidRPC].treeIndex : nidRPC;

if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down
5 changes: 3 additions & 2 deletions src/grt/src/fastroute/src/maze3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,12 +888,13 @@ void FastRouteCore::mazeRouteMSMDOrder3D(int expand,

for (int orderIndex = 0; orderIndex < endIND; orderIndex++) {
const int netID = tree_order_pv_[orderIndex].treeIndex;
FrNet* net = nets_[netID];

if (net == nullptr || net->isRouted()) {
if (skipNet(netID)) {
continue;
}

FrNet* net = nets_[netID];

int enlarge = expand;
const int num_terminals = sttrees_[netID].num_terminals;
auto& treeedges = sttrees_[netID].edges;
Expand Down
24 changes: 12 additions & 12 deletions src/grt/src/fastroute/src/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void FastRouteCore::routeLAll(bool firstTime)
if (firstTime) { // no previous route
// estimate congestion with 0.5+0.5 L
for (int i = 0; i < netCount(); i++) {
if (nets_[i] == nullptr || nets_[i]->isRouted()) {
if (skipNet(i)) {
continue;
}

Expand All @@ -240,7 +240,7 @@ void FastRouteCore::routeLAll(bool firstTime)
}
// L route
for (int i = 0; i < netCount(); i++) {
if (nets_[i] == nullptr || nets_[i]->isRouted()) {
if (skipNet(i)) {
continue;
}

Expand All @@ -252,7 +252,7 @@ void FastRouteCore::routeLAll(bool firstTime)
}
} else { // previous is L-route
for (int i = 0; i < netCount(); i++) {
if (nets_[i] == nullptr || nets_[i]->isRouted()) {
if (skipNet(i)) {
continue;
}

Expand Down Expand Up @@ -419,13 +419,13 @@ void FastRouteCore::newrouteLAll(bool firstTime, bool viaGuided)
{
if (firstTime) {
for (int i = 0; i < netCount(); i++) {
if (nets_[i] != nullptr && !nets_[i]->isRouted()) {
if (!skipNet(i)) {
newrouteL(i, RouteType::NoRoute, viaGuided); // do L-routing
}
}
} else {
for (int i = 0; i < netCount(); i++) {
if (nets_[i] != nullptr && !nets_[i]->isRouted()) {
if (!skipNet(i)) {
newrouteL(i, RouteType::LRoute, viaGuided);
}
}
Expand Down Expand Up @@ -859,7 +859,7 @@ void FastRouteCore::newrouteZ(int netID, int threshold)
void FastRouteCore::newrouteZAll(int threshold)
{
for (int i = 0; i < netCount(); i++) {
if (nets_[i] != nullptr && !nets_[i]->isRouted()) {
if (!skipNet(i)) {
newrouteZ(i, threshold); // ripup previous route and do Z-routing
}
}
Expand Down Expand Up @@ -1059,7 +1059,7 @@ void FastRouteCore::routeMonotonic(int netID, int edgeID, int threshold)
void FastRouteCore::routeMonotonicAll(int threshold)
{
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1245,7 +1245,7 @@ void FastRouteCore::spiralRoute(int netID, int edgeID)
void FastRouteCore::spiralRouteAll()
{
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1296,7 +1296,7 @@ void FastRouteCore::spiralRouteAll()
}

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1326,7 +1326,7 @@ void FastRouteCore::spiralRouteAll()

std::queue<int> edgeQueue;
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1382,7 +1382,7 @@ void FastRouteCore::spiralRouteAll()
}

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1725,7 +1725,7 @@ void FastRouteCore::routeLVAll(int threshold, int expand, float logis_cof)
multi_array<float, 2> d2(boost::extents[y_range_][x_range_]);

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down
41 changes: 23 additions & 18 deletions src/grt/src/fastroute/src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void FastRouteCore::ConvertToFull3DType2()
short tmpX[MAXLEN], tmpY[MAXLEN], tmpL[MAXLEN];

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -147,7 +147,7 @@ void FastRouteCore::netpinOrderInc()
tree_order_pv_.clear();

for (int j = 0; j < netCount(); j++) {
if (nets_[j] == nullptr || nets_[j]->isRouted()) {
if (skipNet(j)) {
continue;
}

Expand Down Expand Up @@ -180,7 +180,7 @@ void FastRouteCore::fillVIA()
int numVIAT2 = 0;

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -324,7 +324,7 @@ int FastRouteCore::threeDVIA()
int numVIA = 0;

for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}
auto& treeedges = sttrees_[netID].edges;
Expand Down Expand Up @@ -753,7 +753,7 @@ void FastRouteCore::layerAssignmentV4()
TreeEdge* treeedge;

for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand All @@ -772,7 +772,7 @@ void FastRouteCore::layerAssignmentV4()
for (i = 0; i < tree_order_pv_.size(); i++) {
netID = tree_order_pv_[i].treeIndex;

if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -895,7 +895,7 @@ void FastRouteCore::layerAssignment()
TreeEdge* treeedge;

for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -946,7 +946,7 @@ void FastRouteCore::layerAssignment()
}

for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1030,7 +1030,7 @@ void FastRouteCore::checkRoute3D()
bool gridFlag;

for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1152,7 +1152,7 @@ void FastRouteCore::StNetOrder()
i = 0;
for (j = 0; j < netCount(); j++) {
// if the net is routed
if (nets_[j] == nullptr || nets_[j]->isRouted()) {
if (skipNet(j)) {
continue;
}

Expand Down Expand Up @@ -1224,7 +1224,7 @@ float FastRouteCore::CalculatePartialSlack()
}
}
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}
auto fr_net = nets_[netID];
Expand All @@ -1245,7 +1245,7 @@ float FastRouteCore::CalculatePartialSlack()
// Set the non critical nets slack as the lowest float, so they can be
// ordered by overflow (and ordered first than the critical nets)
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}
if (nets_[netID]->getSlack() > slack_th) {
Expand Down Expand Up @@ -1335,7 +1335,7 @@ void FastRouteCore::recoverEdge(int netID, int edgeID)
void FastRouteCore::removeLoops()
{
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1666,6 +1666,11 @@ void FastRouteCore::printTree2D(int netID)
}
}

bool FastRouteCore::skipNet(int netID)
{
return nets_[netID] == nullptr || nets_[netID]->isRouted();
}

bool FastRouteCore::checkRoute2DTree(int netID)
{
bool STHwrong = false;
Expand Down Expand Up @@ -1765,7 +1770,7 @@ void FastRouteCore::copyRS(void)

if (!sttrees_bk_.empty()) {
for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand All @@ -1783,7 +1788,7 @@ void FastRouteCore::copyRS(void)
sttrees_bk_.resize(netCount());

for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1838,7 +1843,7 @@ void FastRouteCore::copyBR(void)

if (!sttrees_bk_.empty()) {
for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand All @@ -1852,7 +1857,7 @@ void FastRouteCore::copyBR(void)
}

for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1952,7 +1957,7 @@ void FastRouteCore::freeRR(void)
int netID, edgeID, numEdges;
if (!sttrees_bk_.empty()) {
for (netID = 0; netID < netCount(); netID++) {
if (nets_[netID] == nullptr || nets_[netID]->isRouted()) {
if (skipNet(netID)) {
continue;
}

Expand Down

0 comments on commit f1ccd52

Please sign in to comment.