grt: pins on the inner edges of a rectilinear (L-shaped) macro are entered through the macro (pin edge taken from the bounding box)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Describe the bug
initialize_floorplan accepts a polygonal die, and write_abstract_lef of such a block writes its outline as OBS polygons (and, when the technology has one, on the OVERLAP layer). When that abstract is used as a macro in a parent, global routing picks the side from which each macro pin is entered with Pin::determineEdge, which measures distances to the instance bounding box (src/grt/src/Pin.cpp, determineEdge(iterm->getInst()->getBBox()->getBox(), layers)).
For a pin on an inner (notch) edge of an L-shaped macro, the nearest bounding-box side lies across the macro. addResourcesForPinAccess, isPinReachable and getPositionNearInstEdge then treat the pin as reachable from that side, and FastRoute routes the net through the macro's blocked area:
global_routeends with[ERROR GRT-0116] Global routing finished with congestion; the congestion report shows the overflowing GCells inside the macro's arms, all on nets that connect notch-edge pins.- With
-allow_congestion,detailed_routefollows the guides and reports a Short between the net and the macro obstruction (an M3 wire running straight through the macro's arm to the notch-edge pin).
The same parent with a rectangular macro of the same design and the same nets routes with no overflow and no DRC. Notch-edge nets whose two pins abut (both pins in the same or adjacent GCells) are not affected.
Expected behavior
The entry side of a macro pin should be the side of the macro's real outline (OVERLAP obstruction, if present) nearest the pin, so a notch-edge pin is entered from the notch.
To reproduce (public data only: test/asap7 and test/aes_asap7)
- Block: run
test/flow.tclforaes_asap7with a polygonal die and core, e.g.
-die_area {0 0 104.112 0 104.112 26.19 33.102 26.19 33.102 96.39 0 96.39}
-core_area {2.052 2.16 102.06 2.16 102.06 24.03 31.05 24.03 31.05 94.23 2.052 94.23}.
The flow routes with 0 DRC;place_pinsputs many pins on the two inner edges. Writewrite_abstract_lef -bloat_occupied_layers aes_L.lefandwrite_timing_model aes_L.lib(optionally create an OVERLAP layer first so the LEF carries the outline on OVERLAP). - Parent: a 112.32 x 105.84 um die; instantiate
aes_cipher_topat (4.32, 4.32) FIRM and thegcd_asap7abstract (rectangular) at (41.472, 34.56), inside the L's notch. Connect a few gcd outputs to aes pins on the inner edges (and to aes pins elsewhere),place_pins, thenglobal_route -verbose -congestion_report_file grt.rpt. - Result: GRT-0116, overflow GCells inside the L. Control: replace the L-shaped aes abstract by the same design hardened on a 69 x 69 um rectangle and place gcd beside it: no overflow, detailed route 0 violations.
Scripts can be attached (they use only OpenROAD's test platform and designs).
Proposed fix
Compute the entry side from the instance outline: the master's OVERLAP obstructions transformed to the design, falling back to the bounding box when there are none (identical behavior for rectangular macros). For each pin box, take the distance the pin travels in each direction before leaving the outline (crossing touching rectangles), and pick the smallest. The same applies to block-level ports on a polygonal die (determineEdge(bterm->getBlock()->getDieArea(), ...) uses the die bounding box). A draft patch touching only Pin.cpp/Pin.h is below. It has not been compiled or tested; it is here to show the idea.
Possibly related: PR #12490 (gpl/dpl place around the OVERLAP outline of rectilinear blocks), PR #12019 (place_pin -force_to_die_boundary on polygon floorplans).
Environment
OpenROAD 26Q4 (26Q4-3-gc3aec97051), Linux. The relevant code is unchanged on the 26Q4 tag.
Draft patch (not compiled, not tested)
diff -ru a/src/grt/src/Pin.cpp b/src/grt/src/Pin.cpp
--- a/src/grt/src/Pin.cpp 2026-12-01 06:51:07.156898123 -0500
+++ b/src/grt/src/Pin.cpp 2026-12-01 06:51:26.620082230 -0500
@@ -13,9 +13,94 @@
#include "odb/db.h"
#include "odb/dbTypes.h"
#include "odb/geom.h"
+#include "odb/poly_decomp.h"
namespace grt {
+namespace {
+
+// The outline of an instance as rectangles in design coordinates: its master's
+// OVERLAP obstructions, which describe a rectilinear (e.g. L-shaped) block,
+// or its bounding box when the master has none.
+std::vector<odb::Rect> instanceOutline(odb::dbInst* inst)
+{
+ std::vector<odb::Rect> outline;
+ const odb::dbTransform transform = inst->getTransform();
+ for (odb::dbBox* box : inst->getMaster()->getObstructions()) {
+ odb::dbTechLayer* layer = box->getTechLayer();
+ if (layer != nullptr
+ && layer->getType() == odb::dbTechLayerType::OVERLAP) {
+ odb::Rect rect = box->getBox();
+ transform.apply(rect);
+ outline.push_back(rect);
+ }
+ }
+ if (outline.empty()) {
+ outline.push_back(inst->getBBox()->getBox());
+ }
+ return outline;
+}
+
+// The die outline as rectangles; a rectilinear die is decomposed.
+std::vector<odb::Rect> dieOutline(odb::dbBlock* block)
+{
+ const odb::Polygon die = block->getDieAreaPolygon();
+ if (die.isRect()) {
+ return {die.getEnclosingRect()};
+ }
+ std::vector<odb::Point> points = die.getPoints();
+ if (points.size() > 1 && points.front() == points.back()) {
+ points.pop_back();
+ }
+ if (!odb::polygon_is_clockwise(points)) {
+ std::ranges::reverse(points);
+ }
+ std::vector<odb::Rect> rects;
+ odb::decompose_polygon(points, rects);
+ if (rects.empty()) {
+ rects.push_back(die.getEnclosingRect());
+ }
+ return rects;
+}
+
+// Distance a point moving from (x, y) in the given direction travels before
+// it leaves the outline. Rectangles that touch are crossed in turn, so the
+// result is the distance to the outline's boundary, not to its bounding box.
+int exitDistance(const std::vector<odb::Rect>& outline,
+ const int x,
+ const int y,
+ const PinEdge dir)
+{
+ const bool vertical = dir == PinEdge::north || dir == PinEdge::south;
+ const bool positive = dir == PinEdge::north || dir == PinEdge::east;
+ const int start = vertical ? y : x;
+ int pos = start;
+ bool moved = true;
+ while (moved) {
+ moved = false;
+ for (const odb::Rect& r : outline) {
+ const int across = vertical ? x : y;
+ const int lo = vertical ? r.yMin() : r.xMin();
+ const int hi = vertical ? r.yMax() : r.xMax();
+ const int across_lo = vertical ? r.xMin() : r.yMin();
+ const int across_hi = vertical ? r.xMax() : r.yMax();
+ if (across < across_lo || across > across_hi) {
+ continue;
+ }
+ if (positive && lo <= pos && pos < hi) {
+ pos = hi;
+ moved = true;
+ } else if (!positive && lo < pos && pos <= hi) {
+ pos = lo;
+ moved = true;
+ }
+ }
+ }
+ return positive ? pos - start : start - pos;
+}
+
+} // namespace
+
Pin::Pin(odb::dbITerm* iterm,
const odb::Point& position,
const std::vector<odb::dbTechLayer*>& layers,
@@ -38,7 +123,7 @@
}
if (connected_to_pad_or_macro) {
- determineEdge(iterm->getInst()->getBBox()->getBox(), layers);
+ determineEdge(instanceOutline(iterm->getInst()), layers);
} else {
connection_layer_ = layers_.back();
}
@@ -65,27 +150,25 @@
boxes_per_layer_[layer->getRoutingLevel()] = boxes;
}
- determineEdge(bterm->getBlock()->getDieArea(), layers);
+ determineEdge(dieOutline(bterm->getBlock()), layers);
}
-void Pin::determineEdge(const odb::Rect& bounds,
+void Pin::determineEdge(const std::vector<odb::Rect>& outline,
const std::vector<odb::dbTechLayer*>& layers)
{
- odb::Point lower_left;
- odb::Point upper_right;
int n_count = 0;
int s_count = 0;
int e_count = 0;
int w_count = 0;
for (const auto& [layer, boxes] : boxes_per_layer_) {
for (const auto& box : boxes) {
- lower_left = box.ll();
- upper_right = box.ur();
- // Determine which edge is closest to the pin box
- const int n_dist = bounds.yMax() - upper_right.y();
- const int s_dist = lower_left.y() - bounds.yMin();
- const int e_dist = bounds.xMax() - upper_right.x();
- const int w_dist = lower_left.x() - bounds.xMin();
+ // Determine which side of the outline is closest to the pin box
+ const int cx = box.xCenter();
+ const int cy = box.yCenter();
+ const int n_dist = exitDistance(outline, cx, box.yMax(), PinEdge::north);
+ const int s_dist = exitDistance(outline, cx, box.yMin(), PinEdge::south);
+ const int e_dist = exitDistance(outline, box.xMax(), cy, PinEdge::east);
+ const int w_dist = exitDistance(outline, box.xMin(), cy, PinEdge::west);
const int min_dist = std::min({n_dist, s_dist, w_dist, e_dist});
if (n_dist == min_dist) {
n_count += 1;
diff -ru a/src/grt/src/Pin.h b/src/grt/src/Pin.h
--- a/src/grt/src/Pin.h 2026-12-01 06:51:07.193898473 -0500
+++ b/src/grt/src/Pin.h 2026-12-01 06:51:26.622082249 -0500
@@ -70,7 +70,7 @@
bool isCorePin() const;
private:
- void determineEdge(const odb::Rect& bounds,
+ void determineEdge(const std::vector<odb::Rect>& outline,
const std::vector<odb::dbTechLayer*>& layers);
union
- Ngôn ngữ chính
- Verilog
- Star
- 3.4k
- Fork
- 1.1k
- Merge trung bình
- 3 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 247
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của The-OpenROAD-Project/OpenROAD
-
drt: min-area patch owner search compares the origin-relative patch box with absolute shapes, so patches are droppedCó thể đã có người làm @bnmfw đã nhận 11 ngày trước. Đang mởbug drt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
The-OpenROAD-Project/OpenROAD#12191 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
odb LEF58_MINIMUMCUT: per-cut-class form never sets isPerCutClass, so drt silently drops the ruleCó thể đã có người làm @LucasYuki đã nhận 25 ngày trước. Đang mởbug drt odb
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
The-OpenROAD-Project/OpenROAD#12176 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
drt: LEF58_SPACING ENDOFLINE MINLENGTH l TWOSIDES is checked one-sided (io passes the TWOEDGES flag as TWOSIDES)Có thể đã có người làm @osamahammad21 đã nhận 25 ngày trước. Đang mởbug drt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
The-OpenROAD-Project/OpenROAD#12173 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cleanup-opportunity: BUILD files never refer to mockturtle in third-partty/Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbazel enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
The-OpenROAD-Project/OpenROAD#12160 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
odb: Bazel build fails on linux/aarch64 — char fc compared to EOF in def/lef lexersCó thể đã có người làm @shivarammysore đã nhận 32 ngày trước. Đang mởbazel bug odb
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
The-OpenROAD-Project/OpenROAD#12095 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày