Skip to content

Commit 0541fb3

Browse files
dpl: make legalPt() Y-clamp origin-independent (#6704)
detailed_placement is expected to legalize a centered floorplan (a DIEAREA whose lower-left is not the origin) the same way it does an origin-anchored one. dpl works in a core-relative coordinate frame, but legalPt(cell, pt) clamped the y coordinate against the absolute core_.yMax() while pt.y is core-relative. The X clamp in the same function already uses the relative core width; this aligns Y with it by using core_.dy(). For an origin-anchored core (yMin == 0) core_.dy() == core_.yMax(), so this is a no-op there and the full dpl regression suite (origin-0 goldens) is unchanged. Adds a centered_floorplan regression test (DIEAREA lower-left at non-zero coordinates) that legalizes overlapping cells cleanly, registered for both CMake and Bazel. Note: I was unable to reproduce the exploded-displacement symptom from #6704 on current master; the dpl module already handles a nonzero core/die origin consistently. See AGENT_REPORT.md for the full investigation, the fail-to-reproduce evidence, and a documented residual frame inconsistency in the placement-order comparator (left unchanged to avoid QoR golden churn). Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
1 parent 4c26918 commit 0541fb3

7 files changed

Lines changed: 81 additions & 1 deletion

File tree

src/dpl/src/Place.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ DbuPt Opendp::legalPt(const Node* cell, const DbuPt& pt) const
11521152
const DbuX legal_x{gridToDbu(grid_x, site_width)};
11531153
// Align to row
11541154
const DbuY core_y
1155-
= std::clamp(pt.y, DbuY{0}, DbuY{core_.yMax()} - cell->getHeight());
1155+
= std::clamp(pt.y, DbuY{0}, DbuY{core_.dy()} - cell->getHeight());
11561156
const GridY grid_y = grid_->gridRoundY(core_y);
11571157
DbuY legal_y = grid_->gridYToDbu(grid_y);
11581158

src/dpl/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ COMPULSORY_TESTS = [
1313
"blockage01",
1414
"cell_on_block1",
1515
"cell_on_block2",
16+
"centered_floorplan",
1617
"check1",
1718
"check2",
1819
"check3",

src/dpl/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ or_integration_tests(
88
blockage01
99
cell_on_block1
1010
cell_on_block2
11+
centered_floorplan
1112
check1
1213
check2
1314
check3
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
VERSION 5.8 ;
2+
DIVIDERCHAR "/" ;
3+
BUSBITCHARS "[]" ;
4+
DESIGN centered_dpl ;
5+
UNITS DISTANCE MICRONS 2000 ;
6+
DIEAREA ( 76000 140000 ) ( 91200 151200 ) ;
7+
ROW ROW_0 FreePDK45_38x28_10R_NP_162NW_34O 76000 140000 FS DO 40 BY 1 STEP 380 0 ;
8+
ROW ROW_1 FreePDK45_38x28_10R_NP_162NW_34O 76000 142800 N DO 40 BY 1 STEP 380 0 ;
9+
ROW ROW_2 FreePDK45_38x28_10R_NP_162NW_34O 76000 145600 FS DO 40 BY 1 STEP 380 0 ;
10+
ROW ROW_3 FreePDK45_38x28_10R_NP_162NW_34O 76000 148400 N DO 40 BY 1 STEP 380 0 ;
11+
COMPONENTS 6 ;
12+
- u0 BUF_X1 + PLACED ( 76000 140000 ) N ;
13+
- u1 BUF_X1 + PLACED ( 76380 140000 ) N ;
14+
- u2 BUF_X1 + PLACED ( 76760 140000 ) N ;
15+
- u3 INV_X1 + PLACED ( 77140 140000 ) N ;
16+
- u4 INV_X1 + PLACED ( 77520 140000 ) N ;
17+
- u5 BUF_X1 + PLACED ( 77900 140000 ) N ;
18+
END COMPONENTS
19+
END DESIGN
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
VERSION 5.8 ;
2+
DIVIDERCHAR "/" ;
3+
BUSBITCHARS "[]" ;
4+
DESIGN centered_dpl ;
5+
UNITS DISTANCE MICRONS 2000 ;
6+
DIEAREA ( 76000 140000 ) ( 91200 151200 ) ;
7+
ROW ROW_0 FreePDK45_38x28_10R_NP_162NW_34O 76000 140000 FS DO 40 BY 1 STEP 380 0 ;
8+
ROW ROW_1 FreePDK45_38x28_10R_NP_162NW_34O 76000 142800 N DO 40 BY 1 STEP 380 0 ;
9+
ROW ROW_2 FreePDK45_38x28_10R_NP_162NW_34O 76000 145600 FS DO 40 BY 1 STEP 380 0 ;
10+
ROW ROW_3 FreePDK45_38x28_10R_NP_162NW_34O 76000 148400 N DO 40 BY 1 STEP 380 0 ;
11+
COMPONENTS 6 ;
12+
- u0 BUF_X1 + PLACED ( 76000 142800 ) N ;
13+
- u1 BUF_X1 + PLACED ( 79040 140000 ) FS ;
14+
- u2 BUF_X1 + PLACED ( 76760 140000 ) FS ;
15+
- u3 INV_X1 + PLACED ( 77140 142800 ) N ;
16+
- u4 INV_X1 + PLACED ( 76000 140000 ) FS ;
17+
- u5 BUF_X1 + PLACED ( 77900 140000 ) FS ;
18+
END COMPONENTS
19+
NETS 0 ;
20+
END NETS
21+
END DESIGN

src/dpl/test/centered_floorplan.ok

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: centered_dpl
3+
[INFO ODB-0131] Created 6 components and 24 component-terminals.
4+
[INFO DPL-0006] Core area: 42.56 um^2, Instances area: 4.26 um^2, Utilization: 10.0%
5+
[INFO DPL-0005] Diamond search max displacement: +/- 500 sites horizontally, +/- 100 rows vertically.
6+
[INFO DPL-1101] Legalizing using diamond search.
7+
Movements Summary
8+
---------------------------------------
9+
Total cells: 6
10+
Diamond Move Success: 6 (100.00%)
11+
Diamond Move Failure: 0
12+
Rip-up and replace Success: 0 ( 0.00% of diamond failures)
13+
Rip-up and replace Failure: 0
14+
Total Placement Failures: 0
15+
---------------------------------------
16+
Placement Analysis
17+
---------------------------------
18+
total displacement 4.9 u
19+
average displacement 0.8 u
20+
max displacement 1.4 u
21+
original HPWL 0.0 u
22+
legalized HPWL 0.0 u
23+
delta HPWL 0 %
24+
25+
No differences found.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Centered (non-origin) floorplan: DIEAREA lower-left is not (0,0).
2+
# Regression guard for #6704 -- detailed_placement must legalize a centered
3+
# floorplan the same way it does an origin-anchored one (no exploded
4+
# displacement, clean check_placement).
5+
source "helpers.tcl"
6+
read_lef Nangate45/Nangate45.lef
7+
read_def centered_floorplan.def
8+
detailed_placement
9+
check_placement
10+
11+
set def_file [make_result_file centered_floorplan.def]
12+
write_def $def_file
13+
diff_file centered_floorplan.defok $def_file

0 commit comments

Comments
 (0)