Skip to content

Commit

Permalink
Merge pull request #6232 from eder-matheus/grt_fix_warns
Browse files Browse the repository at this point in the history
grt: MakeWireParasitics consider segments out of range when the design is congested
  • Loading branch information
eder-matheus authored Nov 25, 2024
2 parents dbedd98 + 74049fd commit 45d014f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/grt/include/grt/GlobalRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbstractGrouteRenderer> groute_renderer);
Expand Down Expand Up @@ -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};

Expand Down
18 changes: 11 additions & 7 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -330,7 +331,7 @@ void GlobalRouter::globalRoute(bool save_guides,
}
}

if (fastroute_->totalOverflow() > 0) {
if (is_congested_) {
if (allow_congestion_) {
logger_->warn(GRT,
115,
Expand Down Expand Up @@ -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()) {
Expand All @@ -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()
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -4756,6 +4759,7 @@ std::vector<Net*> GlobalRouter::updateDirtyRoutes(bool save_guides)
add_max--;
}
if (fastroute_->has2Doverflow()) {
is_congested_ = true;
saveCongestion();
logger_->error(GRT,
232,
Expand Down
10 changes: 8 additions & 2 deletions src/grt/src/MakeWireParasitics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 45d014f

Please sign in to comment.