Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#4350 from arthurjolo/grt_dele…
Browse files Browse the repository at this point in the history
…te_FrNet

grt: delete fr net
  • Loading branch information
eder-matheus committed Dec 11, 2023
2 parents 76e2cd8 + abd7faa commit 41f53d4
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 60 deletions.
3 changes: 0 additions & 3 deletions src/grt/src/fastroute/include/DataType.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,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_; }
Expand Down Expand Up @@ -120,7 +119,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_;
Expand All @@ -137,7 +135,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<std::vector<int>> edge_cost_per_layer_;
bool is_routed_ = false;
bool is_deleted_ = false;
};

struct Edge // An Edge is the routing track holder between two adjacent
Expand Down
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
18 changes: 8 additions & 10 deletions src/grt/src/fastroute/src/FastRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -670,7 +672,7 @@ NetRouteMap FastRouteCore::getRoutes()
{
NetRouteMap routes;
for (int netID = 0; netID < netCount(); netID++) {
if (nets_[netID]->isRouted() || nets_[netID]->isDeleted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -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 (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -1020,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()) {
if (nets_[netID]->getDbNet() == debug_->net_ && !skipNet(netID)) {
StTreeVisualization(sttrees_[netID], nets_[netID], false);
}
}
Expand Down Expand Up @@ -1272,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()) {
if (nets_[netID]->getDbNet() == debug_->net_ && !skipNet(netID)) {
StTreeVisualization(sttrees_[netID], nets_[netID], false);
}
}
Expand Down Expand Up @@ -1330,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()) {
if (nets_[netID]->getDbNet() == debug_->net_ && !skipNet(netID)) {
StTreeVisualization(sttrees_[netID], nets_[netID], true);
}
}
Expand Down Expand Up @@ -1563,7 +1562,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;
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->isRouted() || net->isDeleted()) {
if (skipNet(i)) {
continue;
}

FrNet* net = nets_[i];

float coeffV = 1.36;

bool cong;
Expand Down
12 changes: 6 additions & 6 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]->isRouted() && !nets_[netID]->isDeleted()) {
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]->isRouted() && !nets_[netID]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
if (skipNet(netID)) {
continue;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -2264,7 +2264,7 @@ void FastRouteCore::setCongestionNets(std::set<odb::dbNet*>& 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;
}

Expand Down Expand Up @@ -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;
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->isRouted() || net->isDeleted()) {
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]->isRouted() || nets_[i]->isDeleted()) {
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]->isRouted() || nets_[i]->isDeleted()) {
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]->isRouted() || nets_[i]->isDeleted()) {
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]->isRouted() && !nets_[i]->isDeleted()) {
if (!skipNet(i)) {
newrouteL(i, RouteType::NoRoute, viaGuided); // do L-routing
}
}
} else {
for (int i = 0; i < netCount(); i++) {
if (!nets_[i]->isRouted() && !nets_[i]->isDeleted()) {
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]->isRouted() && !nets_[i]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
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]->isRouted() || nets_[netID]->isDeleted()) {
if (skipNet(netID)) {
continue;
}

Expand Down
Loading

0 comments on commit 41f53d4

Please sign in to comment.