diff --git a/src/grt/src/fastroute/include/FastRoute.h b/src/grt/src/fastroute/include/FastRoute.h index 0b5b89cb7aa..8219923884d 100644 --- a/src/grt/src/fastroute/include/FastRoute.h +++ b/src/grt/src/fastroute/include/FastRoute.h @@ -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(); diff --git a/src/grt/src/fastroute/src/FastRoute.cpp b/src/grt/src/fastroute/src/FastRoute.cpp index baf6eac8af4..773ec5e5377 100644 --- a/src/grt/src/fastroute/src/FastRoute.cpp +++ b/src/grt/src/fastroute/src/FastRoute.cpp @@ -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; } @@ -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; } @@ -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); } } @@ -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); } } @@ -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); } } diff --git a/src/grt/src/fastroute/src/RSMT.cpp b/src/grt/src/fastroute/src/RSMT.cpp index 32e578280cb..abdbc86d112 100644 --- a/src/grt/src/fastroute/src/RSMT.cpp +++ b/src/grt/src/fastroute/src/RSMT.cpp @@ -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; diff --git a/src/grt/src/fastroute/src/maze.cpp b/src/grt/src/fastroute/src/maze.cpp index 85ed8203a13..491396ddb7a 100644 --- a/src/grt/src/fastroute/src/maze.cpp +++ b/src/grt/src/fastroute/src/maze.cpp @@ -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); } } @@ -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); } } @@ -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; } diff --git a/src/grt/src/fastroute/src/maze3D.cpp b/src/grt/src/fastroute/src/maze3D.cpp index d8cc384a72c..7be45f0bc90 100644 --- a/src/grt/src/fastroute/src/maze3D.cpp +++ b/src/grt/src/fastroute/src/maze3D.cpp @@ -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; diff --git a/src/grt/src/fastroute/src/route.cpp b/src/grt/src/fastroute/src/route.cpp index bfb5f8113ea..1308257c45c 100644 --- a/src/grt/src/fastroute/src/route.cpp +++ b/src/grt/src/fastroute/src/route.cpp @@ -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; } @@ -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; } @@ -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; } @@ -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); } } @@ -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 } } @@ -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; } @@ -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; } @@ -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; } @@ -1326,7 +1326,7 @@ void FastRouteCore::spiralRouteAll() std::queue edgeQueue; for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { + if (skipNet(netID)) { continue; } @@ -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; } @@ -1725,7 +1725,7 @@ void FastRouteCore::routeLVAll(int threshold, int expand, float logis_cof) multi_array 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; } diff --git a/src/grt/src/fastroute/src/utility.cpp b/src/grt/src/fastroute/src/utility.cpp index 994a6508897..b595e1375d5 100644 --- a/src/grt/src/fastroute/src/utility.cpp +++ b/src/grt/src/fastroute/src/utility.cpp @@ -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; } @@ -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; } @@ -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; } @@ -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; @@ -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; } @@ -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; } @@ -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; } @@ -946,7 +946,7 @@ void FastRouteCore::layerAssignment() } for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { + if (skipNet(netID)) { continue; } @@ -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; } @@ -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; } @@ -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]; @@ -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) { @@ -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; } @@ -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; @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; }