diff --git a/src/grt/include/grt/GlobalRouter.h b/src/grt/include/grt/GlobalRouter.h index 0454f5decf6..ff43345feac 100644 --- a/src/grt/include/grt/GlobalRouter.h +++ b/src/grt/include/grt/GlobalRouter.h @@ -312,6 +312,7 @@ class GlobalRouter : public ant::GlobalRouteSource void getMinMaxLayer(int& min_layer, int& max_layer); void getCapacityReductionData(CapacityReductionData& cap_red_data); bool isInitialized() const { return initialized_; } + bool isCongested() const { return is_congested_; } void setDbBlock(odb::dbBlock* block) { block_ = block; } void setRenderer(std::unique_ptr groute_renderer); @@ -492,6 +493,7 @@ class GlobalRouter : public ant::GlobalRouteSource int macro_extension_; bool initialized_; int total_diodes_count_; + bool is_congested_{false}; // TODO: remove this flag after support incremental updates on DRT PA bool skip_drt_aps_{false}; diff --git a/src/grt/src/GlobalRouter.cpp b/src/grt/src/GlobalRouter.cpp index 4dd533b25cc..e21fae2b5e1 100644 --- a/src/grt/src/GlobalRouter.cpp +++ b/src/grt/src/GlobalRouter.cpp @@ -218,6 +218,7 @@ void GlobalRouter::applyAdjustments(int min_routing_layer, // previous congestion report file. void GlobalRouter::saveCongestion() { + is_congested_ = fastroute_->totalOverflow() > 0; fastroute_->saveCongestion(); } @@ -330,7 +331,7 @@ void GlobalRouter::globalRoute(bool save_guides, } } - if (fastroute_->totalOverflow() > 0) { + if (is_congested_) { if (allow_congestion_) { logger_->warn(GRT, 115, @@ -2308,8 +2309,7 @@ void GlobalRouter::saveGuides() int offset_x = grid_origin_.x(); int offset_y = grid_origin_.y(); - bool is_congested = fastroute_->has2Doverflow() && !allow_congestion_; - + bool guide_is_congested = is_congested_ && !allow_congestion_; for (odb::dbNet* db_net : block_->getNets()) { auto iter = routes_.find(db_net); if (iter == routes_.end()) { @@ -2336,15 +2336,18 @@ void GlobalRouter::saveGuides() int layer_idx2 = segment.final_layer; odb::dbTechLayer* layer1 = routing_layers_[layer_idx1]; odb::dbTechLayer* layer2 = routing_layers_[layer_idx2]; - odb::dbGuide::create(db_net, layer1, layer2, box, is_congested); - odb::dbGuide::create(db_net, layer2, layer1, box, is_congested); + odb::dbGuide::create( + db_net, layer1, layer2, box, guide_is_congested); + odb::dbGuide::create( + db_net, layer2, layer1, box, guide_is_congested); } else { int layer_idx = std::min(segment.init_layer, segment.final_layer); int via_layer_idx = std::max(segment.init_layer, segment.final_layer); odb::dbTechLayer* layer = routing_layers_[layer_idx]; odb::dbTechLayer* via_layer = routing_layers_[via_layer_idx]; - odb::dbGuide::create(db_net, layer, via_layer, box, is_congested); + odb::dbGuide::create( + db_net, layer, via_layer, box, guide_is_congested); } } else if (segment.init_layer == segment.final_layer) { if (segment.init_layer < getMinRoutingLayer() @@ -2357,7 +2360,7 @@ void GlobalRouter::saveGuides() } odb::dbTechLayer* layer = routing_layers_[segment.init_layer]; - odb::dbGuide::create(db_net, layer, layer, box, is_congested); + odb::dbGuide::create(db_net, layer, layer, box, guide_is_congested); } } } @@ -4756,6 +4759,7 @@ std::vector GlobalRouter::updateDirtyRoutes(bool save_guides) add_max--; } if (fastroute_->has2Doverflow()) { + is_congested_ = true; saveCongestion(); logger_->error(GRT, 232, diff --git a/src/grt/src/MakeWireParasitics.cpp b/src/grt/src/MakeWireParasitics.cpp index fddb71ea2c6..58143e5f409 100644 --- a/src/grt/src/MakeWireParasitics.cpp +++ b/src/grt/src/MakeWireParasitics.cpp @@ -184,13 +184,18 @@ void MakeWireParasitics::makeRouteParasitics( NodeRoutePtMap& node_map) { const int min_routing_layer = grouter_->getMinRoutingLayer(); + const bool is_congested = grouter_->isCongested(); size_t resistor_id_ = 1; for (GSegment& segment : route) { const int wire_length_dbu = segment.length(); const int init_layer = segment.init_layer; - sta::ParasiticNode* n1 = (init_layer >= min_routing_layer) + // allow segments out of the layer range only when the design have + // congestion, becaus GRT may produce segments out of the layer range in + // this scenario. + bool is_valid_layer = init_layer >= min_routing_layer || is_congested; + sta::ParasiticNode* n1 = is_valid_layer ? ensureParasiticNode(segment.init_x, segment.init_y, init_layer, @@ -200,7 +205,8 @@ void MakeWireParasitics::makeRouteParasitics( : nullptr; const int final_layer = segment.final_layer; - sta::ParasiticNode* n2 = (final_layer >= min_routing_layer) + is_valid_layer = final_layer >= min_routing_layer || is_congested; + sta::ParasiticNode* n2 = is_valid_layer ? ensureParasiticNode(segment.final_x, segment.final_y, final_layer,