From fc647307d286b3e1f342f6cda3774c7f4b52424a Mon Sep 17 00:00:00 2001 From: arthur Date: Tue, 5 Dec 2023 22:38:39 -0300 Subject: [PATCH 1/2] new approach, deleting FrNet Signed-off-by: arthur --- src/grt/src/fastroute/include/DataType.h | 3 -- src/grt/src/fastroute/src/FastRoute.cpp | 21 ++++++----- src/grt/src/fastroute/src/RSMT.cpp | 2 +- src/grt/src/fastroute/src/maze.cpp | 12 +++--- src/grt/src/fastroute/src/maze3D.cpp | 2 +- src/grt/src/fastroute/src/route.cpp | 24 ++++++------ src/grt/src/fastroute/src/utility.cpp | 48 ++++++++++++------------ 7 files changed, 55 insertions(+), 57 deletions(-) diff --git a/src/grt/src/fastroute/include/DataType.h b/src/grt/src/fastroute/include/DataType.h index cc532136992..43092ba518e 100644 --- a/src/grt/src/fastroute/include/DataType.h +++ b/src/grt/src/fastroute/include/DataType.h @@ -87,7 +87,6 @@ struct FrNet // A Net is a set of connected MazePoints bool isClock() const { return is_clock_; } bool isRouted() const { return is_routed_; } bool isCritical() { return is_critical_; } - bool isDeleted() { return is_deleted_; } float getSlack() const { return slack_; } odb::dbNet* getDbNet() const { return db_net_; } int getDriverIdx() const { return driver_idx_; } @@ -118,7 +117,6 @@ struct FrNet // A Net is a set of connected MazePoints void setMinLayer(int min_layer) { min_layer_ = min_layer; } void setSlack(float slack) { slack_ = slack; } void setIsCritical(bool is_critical) { is_critical_ = is_critical; } - void setIsDeleted(bool is_deleted) { is_deleted_ = is_deleted; } private: odb::dbNet* db_net_; @@ -135,7 +133,6 @@ struct FrNet // A Net is a set of connected MazePoints // Non-null when an NDR has been applied to the net. std::unique_ptr> edge_cost_per_layer_; bool is_routed_ = false; - bool is_deleted_ = false; }; struct Edge // An Edge is the routing track holder between two adjacent diff --git a/src/grt/src/fastroute/src/FastRoute.cpp b/src/grt/src/fastroute/src/FastRoute.cpp index 866539d4a6d..baf6eac8af4 100644 --- a/src/grt/src/fastroute/src/FastRoute.cpp +++ b/src/grt/src/fastroute/src/FastRoute.cpp @@ -289,8 +289,10 @@ void FastRouteCore::removeNet(odb::dbNet* db_net) // FrNet and update the nets list if (db_net_id_map_.find(db_net) != db_net_id_map_.end()) { int netID = db_net_id_map_[db_net]; - nets_[netID]->setIsDeleted(true); clearNetRoute(netID); + FrNet* delete_net = nets_[netID]; + nets_[netID] = nullptr; + delete delete_net; db_net_id_map_.erase(db_net); } } @@ -670,7 +672,7 @@ NetRouteMap FastRouteCore::getRoutes() { NetRouteMap routes; for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -746,7 +748,7 @@ NetRouteMap FastRouteCore::getPlanarRoutes() // Get routes before layer assignment for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1020,8 +1022,8 @@ 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()) { + if (nets_[netID]->getDbNet() == debug_->net_ && !nets_[netID]->isRouted() + && nets_[netID] != nullptr) { StTreeVisualization(sttrees_[netID], nets_[netID], false); } } @@ -1272,8 +1274,8 @@ 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()) { + if (nets_[netID]->getDbNet() == debug_->net_ && !nets_[netID]->isRouted() + && nets_[netID] != nullptr) { StTreeVisualization(sttrees_[netID], nets_[netID], false); } } @@ -1330,8 +1332,8 @@ 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()) { + if (nets_[netID]->getDbNet() == debug_->net_ && !nets_[netID]->isRouted() + && nets_[netID] != nullptr) { StTreeVisualization(sttrees_[netID], nets_[netID], true); } } @@ -1563,7 +1565,6 @@ void FrNet::reset(odb::dbNet* db_net, db_net_ = db_net; is_routed_ = false; is_critical_ = false; - is_deleted_ = false; is_clock_ = is_clock; driver_idx_ = driver_idx; edge_cost_ = edge_cost; diff --git a/src/grt/src/fastroute/src/RSMT.cpp b/src/grt/src/fastroute/src/RSMT.cpp index 951c89fb5bf..32e578280cb 100644 --- a/src/grt/src/fastroute/src/RSMT.cpp +++ b/src/grt/src/fastroute/src/RSMT.cpp @@ -658,7 +658,7 @@ void FastRouteCore::gen_brk_RSMT(const bool congestionDriven, for (int i = 0; i < netCount(); i++) { FrNet* net = nets_[i]; - if (net->isRouted() || net->isDeleted()) { + if (net == nullptr || net->isRouted()) { continue; } diff --git a/src/grt/src/fastroute/src/maze.cpp b/src/grt/src/fastroute/src/maze.cpp index a13f957fefe..85ed8203a13 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]->isRouted() && !nets_[netID]->isDeleted()) { + if (nets_[netID] != nullptr && !nets_[netID]->isRouted()) { 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]->isRouted() && !nets_[netID]->isDeleted()) { + if (nets_[netID] != nullptr && !nets_[netID]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -2153,7 +2153,7 @@ void FastRouteCore::findCongestedEdgesNets( bool vertical) { for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr) { continue; } @@ -2264,7 +2264,7 @@ void FastRouteCore::setCongestionNets(std::set& congestion_nets, for (int netID = 0; netID < netCount(); netID++) { if ((congestion_nets.find(nets_[netID]->getDbNet()) != congestion_nets.end()) - || nets_[netID]->isDeleted()) { + || nets_[netID] == nullptr) { continue; } @@ -2583,7 +2583,7 @@ void FastRouteCore::InitLastUsage(const int upType) void FastRouteCore::SaveLastRouteLen() { for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr) { continue; } auto& treeedges = sttrees_[netID].edges; diff --git a/src/grt/src/fastroute/src/maze3D.cpp b/src/grt/src/fastroute/src/maze3D.cpp index 4764171c51f..d8cc384a72c 100644 --- a/src/grt/src/fastroute/src/maze3D.cpp +++ b/src/grt/src/fastroute/src/maze3D.cpp @@ -890,7 +890,7 @@ void FastRouteCore::mazeRouteMSMDOrder3D(int expand, const int netID = tree_order_pv_[orderIndex].treeIndex; FrNet* net = nets_[netID]; - if (net->isRouted() || net->isDeleted()) { + if (net == nullptr || net->isRouted()) { continue; } diff --git a/src/grt/src/fastroute/src/route.cpp b/src/grt/src/fastroute/src/route.cpp index 178fbe7f37e..bfb5f8113ea 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]->isRouted() || nets_[i]->isDeleted()) { + if (nets_[i] == nullptr || nets_[i]->isRouted()) { continue; } @@ -240,7 +240,7 @@ void FastRouteCore::routeLAll(bool firstTime) } // L route for (int i = 0; i < netCount(); i++) { - if (nets_[i]->isRouted() || nets_[i]->isDeleted()) { + if (nets_[i] == nullptr || nets_[i]->isRouted()) { 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]->isRouted() || nets_[i]->isDeleted()) { + if (nets_[i] == nullptr || nets_[i]->isRouted()) { continue; } @@ -419,13 +419,13 @@ void FastRouteCore::newrouteLAll(bool firstTime, bool viaGuided) { if (firstTime) { for (int i = 0; i < netCount(); i++) { - if (!nets_[i]->isRouted() && !nets_[i]->isDeleted()) { + if (nets_[i] != nullptr && !nets_[i]->isRouted()) { newrouteL(i, RouteType::NoRoute, viaGuided); // do L-routing } } } else { for (int i = 0; i < netCount(); i++) { - if (!nets_[i]->isRouted() && !nets_[i]->isDeleted()) { + if (nets_[i] != nullptr && !nets_[i]->isRouted()) { 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]->isRouted() && !nets_[i]->isDeleted()) { + if (nets_[i] != nullptr && !nets_[i]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1296,7 +1296,7 @@ void FastRouteCore::spiralRouteAll() } for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1326,7 +1326,7 @@ void FastRouteCore::spiralRouteAll() std::queue edgeQueue; for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1382,7 +1382,7 @@ void FastRouteCore::spiralRouteAll() } for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } diff --git a/src/grt/src/fastroute/src/utility.cpp b/src/grt/src/fastroute/src/utility.cpp index 15f7f32d806..994a6508897 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -147,7 +147,7 @@ void FastRouteCore::netpinOrderInc() tree_order_pv_.clear(); for (int j = 0; j < netCount(); j++) { - if (nets_[j]->isRouted() || nets_[j]->isDeleted()) { + if (nets_[j] == nullptr || nets_[j]->isRouted()) { continue; } @@ -180,7 +180,7 @@ void FastRouteCore::fillVIA() int numVIAT2 = 0; for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -324,7 +324,7 @@ int FastRouteCore::threeDVIA() int numVIA = 0; for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } auto& treeedges = sttrees_[netID].edges; @@ -753,7 +753,7 @@ void FastRouteCore::layerAssignmentV4() TreeEdge* treeedge; for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -895,7 +895,7 @@ void FastRouteCore::layerAssignment() TreeEdge* treeedge; for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -946,7 +946,7 @@ void FastRouteCore::layerAssignment() } for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1030,7 +1030,7 @@ void FastRouteCore::checkRoute3D() bool gridFlag; for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1151,15 +1151,15 @@ void FastRouteCore::StNetOrder() i = 0; for (j = 0; j < netCount(); j++) { - stree = &(sttrees_[j]); - tree_order_cong_[j].xmin = 0; - tree_order_cong_[j].treeIndex = j; - // if the net is routed - if (nets_[j]->isRouted() || nets_[j]->isDeleted()) { + if (nets_[j] == nullptr || nets_[j]->isRouted()) { continue; } + stree = &(sttrees_[j]); + tree_order_cong_[j].xmin = 0; + tree_order_cong_[j].treeIndex = j; + for (ind = 0; ind < stree->num_edges(); ind++) { const auto& treeedges = stree->edges; const TreeEdge* treeedge = &(treeedges[ind]); @@ -1224,7 +1224,7 @@ float FastRouteCore::CalculatePartialSlack() } } for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { 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]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1398,7 +1398,7 @@ void FastRouteCore::verifyEdgeUsage() boost::extents[num_layers_][y_grid_][x_grid_ - 1]); for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr) { continue; } const auto& treeedges = sttrees_[netID].edges; @@ -1471,7 +1471,7 @@ void FastRouteCore::verify2DEdgesUsage() multi_array h_edges(boost::extents[y_grid_][x_grid_ - 1]); for (int netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr) { continue; } const auto& treenodes = sttrees_[netID].nodes; @@ -1765,7 +1765,7 @@ void FastRouteCore::copyRS(void) if (!sttrees_bk_.empty()) { for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1783,7 +1783,7 @@ void FastRouteCore::copyRS(void) sttrees_bk_.resize(netCount()); for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1838,7 +1838,7 @@ void FastRouteCore::copyBR(void) if (!sttrees_bk_.empty()) { for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1852,7 +1852,7 @@ void FastRouteCore::copyBR(void) } for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } @@ -1952,7 +1952,7 @@ void FastRouteCore::freeRR(void) int netID, edgeID, numEdges; if (!sttrees_bk_.empty()) { for (netID = 0; netID < netCount(); netID++) { - if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) { + if (nets_[netID] == nullptr || nets_[netID]->isRouted()) { continue; } From f1ccd52d902fdccdcb0d57db4b0b319ff3fae289 Mon Sep 17 00:00:00 2001 From: arthur Date: Thu, 7 Dec 2023 11:55:21 -0300 Subject: [PATCH 2/2] transform skip net check into method Signed-off-by: arthur --- src/grt/src/fastroute/include/FastRoute.h | 1 + src/grt/src/fastroute/src/FastRoute.cpp | 13 +++---- src/grt/src/fastroute/src/RSMT.cpp | 6 ++-- src/grt/src/fastroute/src/maze.cpp | 6 ++-- src/grt/src/fastroute/src/maze3D.cpp | 5 +-- src/grt/src/fastroute/src/route.cpp | 24 ++++++------- src/grt/src/fastroute/src/utility.cpp | 41 +++++++++++++---------- 7 files changed, 50 insertions(+), 46 deletions(-) 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; }