Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,11 @@ void GlobalRouter::updatePinAccessPoints(Net* net, odb::dbNet* db_net)
auto updatePinPos = [&](Pin& pin, auto* term, const auto& ap_map) {
if (auto it = ap_map.find(term); it != ap_map.end()) {
const auto& ap = it->second;
pin.setConnectionLayer(ap.z());
// CUGR clamps its APs to the ceiling; keep a top-metal pin's real layer
// so connectTopLevelPins still stacks the vias above it.
if (pin.getConnectionLayer() <= getMaxRoutingLayer()) {
pin.setConnectionLayer(ap.z());
Comment thread
eder-matheus marked this conversation as resolved.
}
pin.setOnGridPosition(
grid_->getPositionOnGrid(odb::Point(ap.x(), ap.y())));
}
Expand Down
10 changes: 8 additions & 2 deletions src/grt/src/cugr/src/CUGR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1623,9 +1623,15 @@ std::shared_ptr<GRTreeNode> CUGR::buildTreeFromRoute(const GRoute& route) const
};

for (const GSegment& segment : route) {
const int init_layer = segment.init_layer - 1;
const int final_layer = segment.final_layer - 1;
int init_layer = segment.init_layer - 1;
int final_layer = segment.final_layer - 1;
const int num_layers = grid_graph_->getNumLayers();
if (segment.isVia()) {
// connectTopLevelPins stacks vias above the ceiling for top-metal pins;
// clamp to a bare node instead of rejecting the whole tree.
init_layer = std::min(init_layer, num_layers - 1);
final_layer = std::min(final_layer, num_layers - 1);
}
if (init_layer < 0 || init_layer >= num_layers || final_layer < 0
|| final_layer >= num_layers) {
// Malformed/out-of-range segment; fall back to a reroute.
Expand Down
18 changes: 16 additions & 2 deletions src/grt/src/cugr/src/Design.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Design.h"

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iostream>
Expand Down Expand Up @@ -115,6 +116,13 @@ void Design::readNetlist()
}
}

// Pin shapes may sit above the max routing layer (bumps, top-metal ports);
// connectTopLevelPins re-stacks the vias above the ceiling on guide export.
int Design::clampPinLayerIdx(int layer_idx) const
{
return std::min(layer_idx, getNumLayers() - 1);
}

std::vector<CUGRPin> Design::makeNetPins(odb::dbNet* db_net)
{
std::vector<CUGRPin> pins;
Expand All @@ -126,8 +134,13 @@ std::vector<CUGRPin> Design::makeNetPins(odb::dbNet* db_net)
odb::Point position(x, y);
for (odb::dbBPin* bpin : db_bterm->getBPins()) {
for (odb::dbBox* bpin_box : bpin->getBoxes()) {
odb::dbTechLayer* tech_layer = bpin_box->getTechLayer();
if (tech_layer->getType() != odb::dbTechLayerType::ROUTING) {
continue;
}
Comment thread
eder-matheus marked this conversation as resolved.
// adjust layer idx to start with zero
int layer_idx = bpin_box->getTechLayer()->getRoutingLevel() - 1;
const int layer_idx
= clampPinLayerIdx(tech_layer->getRoutingLevel() - 1);
pin_shapes.emplace_back(layer_idx,
getBoxFromRect(bpin_box->getBox()));
}
Expand All @@ -151,7 +164,8 @@ std::vector<CUGRPin> Design::makeNetPins(odb::dbNet* db_net)
odb::Rect rect = box->getBox();
xform.apply(rect);

int layer_index = tech_layer->getRoutingLevel() - 1;
const int layer_index
= clampPinLayerIdx(tech_layer->getRoutingLevel() - 1);
pin_shapes.emplace_back(
layer_index, rect.xMin(), rect.yMin(), rect.xMax(), rect.yMax());
}
Expand Down
1 change: 1 addition & 0 deletions src/grt/src/cugr/src/Design.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Design
void readLayers();
void readNetlist();
std::vector<CUGRPin> makeNetPins(odb::dbNet* db_net);
int clampPinLayerIdx(int layer_idx) const;
void readInstanceObstructions();
int readSpecialNetObstructions();
void readDesignObstructions();
Expand Down
2 changes: 2 additions & 0 deletions src/grt/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ TESTS = [
"gcd",
"gcd_cugr",
"gcd_flute",
"global_route_above_max_layer_cugr",
"global_route_rerun_cugr",
"increase_capacity1",
"incremental_deleted_net",
Expand Down Expand Up @@ -101,6 +102,7 @@ TESTS = [
"repair_antennas_only_diodes_cugr",
"repair_antennas_only_jumpers",
"repair_antennas_only_jumpers_cugr",
"repair_antennas_post_drt_above_max_layer_cugr",
"repair_antennas_post_drt_below_min_cugr",
"repair_antennas_post_drt_cugr",
"repair_antennas_allow_congestion",
Expand Down
2 changes: 2 additions & 0 deletions src/grt/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ or_integration_tests(
gcd
gcd_cugr
gcd_flute
global_route_above_max_layer_cugr
global_route_rerun_cugr
increase_capacity1
incremental_deleted_net
Expand Down Expand Up @@ -101,6 +102,7 @@ or_integration_tests(
repair_antennas_only_diodes_cugr
repair_antennas_only_jumpers
repair_antennas_only_jumpers_cugr
repair_antennas_post_drt_above_max_layer_cugr
repair_antennas_post_drt_below_min_cugr
repair_antennas_post_drt_cugr
report_wire_length1
Expand Down
Loading
Loading