Skip to content

Commit 5627478

Browse files
authored
Merge pull request #8963 from gadfort/pdn-correct-sort
pdn: fix working error to ensure stable ordering in write to db
2 parents 57e8f1d + f377e47 commit 5627478

39 files changed

+11940
-11953
lines changed

src/pdn/src/grid.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ odb::Rect CoreGrid::getDomainBoundary() const
12821282
void CoreGrid::setupDirectConnect(
12831283
const std::vector<odb::dbTechLayer*>& connect_pad_layers)
12841284
{
1285-
std::set<PadDirectConnectionStraps*> straps;
1285+
std::vector<PadDirectConnectionStraps*> straps;
12861286
// look for pads that need to be connected
12871287
for (auto* net : getNets()) {
12881288
std::vector<odb::dbITerm*> iterms;
@@ -1299,23 +1299,11 @@ void CoreGrid::setupDirectConnect(
12991299
iterms.push_back(iterm);
13001300
}
13011301

1302-
// sort by name to keep stable
1303-
std::stable_sort(
1304-
iterms.begin(), iterms.end(), [](odb::dbITerm* l, odb::dbITerm* r) {
1305-
const int name_compare
1306-
= r->getInst()->getName().compare(l->getInst()->getName());
1307-
if (name_compare != 0) {
1308-
return name_compare < 0;
1309-
}
1310-
1311-
return r->getMTerm()->getName() < l->getMTerm()->getName();
1312-
});
1313-
13141302
for (auto* iterm : iterms) {
13151303
auto pad_connect = std::make_unique<PadDirectConnectionStraps>(
13161304
this, iterm, connect_pad_layers);
13171305
if (pad_connect->canConnect()) {
1318-
straps.insert(pad_connect.get());
1306+
straps.push_back(pad_connect.get());
13191307
addStrap(std::move(pad_connect));
13201308
} else {
13211309
debugPrint(getLogger(),

src/pdn/src/grid_component.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ std::map<Shape*, std::vector<odb::dbBox*>> GridComponent::writeToDb(
343343
all_shapes.begin(), all_shapes.end(), [](const auto& l, const auto& r) {
344344
auto* l_layer = l->getLayer();
345345
int l_level = l_layer->getNumber();
346-
auto* r_layer = l->getLayer();
346+
auto* r_layer = r->getLayer();
347347
int r_level = r_layer->getNumber();
348348

349349
return std::tie(l_level, l->getRect())

src/pdn/src/straps.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ void PadDirectConnectionStraps::cutShapes(
13151315
}
13161316

13171317
void PadDirectConnectionStraps::unifyConnectionTypes(
1318-
const std::set<PadDirectConnectionStraps*>& straps)
1318+
const std::vector<PadDirectConnectionStraps*>& straps)
13191319
{
13201320
std::set<ConnectionType> types;
13211321
for (auto* strap : straps) {
@@ -1415,22 +1415,25 @@ bool PadDirectConnectionStraps::refineShapes(
14151415
return GridComponent::refineShapes(all_shapes, all_obstructions);
14161416
}
14171417

1418-
std::set<Shape*> refine;
1418+
std::vector<Shape*> refine;
14191419
for (const auto& [layer, shapes] : getShapes()) {
14201420
for (const auto& shape : shapes) {
14211421
if (!strapViaIsObstructed(
14221422
shape.get(), all_shapes, all_obstructions, false)) {
14231423
continue;
14241424
}
14251425

1426-
refine.insert(shape.get());
1426+
refine.push_back(shape.get());
14271427
}
14281428
}
14291429

14301430
if (refine.empty()) {
14311431
return false;
14321432
}
14331433

1434+
const auto [first, last] = std::ranges::unique(refine.begin(), refine.end());
1435+
refine.erase(first, last);
1436+
14341437
for (auto* refine_shape : refine) {
14351438
std::unique_ptr<Shape> shape = refine_shape->copy();
14361439
removeShape(refine_shape);

src/pdn/src/straps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class PadDirectConnectionStraps : public Straps
140140
void cutShapes(const Shape::ObstructionTreeMap& obstructions) override;
141141

142142
static void unifyConnectionTypes(
143-
const std::set<PadDirectConnectionStraps*>& straps);
143+
const std::vector<PadDirectConnectionStraps*>& straps);
144144

145145
private:
146146
enum class ConnectionType

src/pdn/test/BUILD

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,7 @@ MANUAL_TESTS = [
139139

140140
# TODO: Enable once difference between bazel and ctest is resolved.
141141
MANUAL_FOR_BAZEL_TESTS = [
142-
"pads_black_parrot",
143-
"pads_black_parrot_flipchip",
144-
"pads_black_parrot_flipchip_connect_bumps",
145142
"pads_black_parrot_flipchip_connect_overpads",
146-
"pads_black_parrot_offset",
147143
]
148144

149145
ALL_TESTS = COMPULSORY_TESTS + MANUAL_TESTS

src/pdn/test/core_grid_no_trim.defok

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,9 @@ SPECIALNETS 2 ;
820820
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 28000 ) ( 196500 28000 )
821821
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 22400 ) ( 196500 22400 )
822822
NEW metal6 4000 + SHAPE RING ( 194500 6400 ) ( 194500 195200 )
823+
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
823824
NEW metal5 4000 + SHAPE RING ( 4140 193200 ) ( 196500 193200 )
824825
NEW metal5 4000 + SHAPE RING ( 4140 8400 ) ( 196500 8400 )
825-
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
826826
NEW metal5 0 + SHAPE RING ( 194500 193200 ) via5_6_4000_4000_7_7_600_600
827827
NEW metal5 0 + SHAPE RING ( 194500 8400 ) via5_6_4000_4000_7_7_600_600
828828
NEW metal5 0 + SHAPE RING ( 6140 193200 ) via5_6_4000_4000_7_7_600_600
@@ -1147,9 +1147,9 @@ SPECIALNETS 2 ;
11471147
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 30800 ) ( 196500 30800 )
11481148
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 25200 ) ( 196500 25200 )
11491149
NEW metal6 4000 + SHAPE RING ( 186500 14400 ) ( 186500 187200 )
1150+
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
11501151
NEW metal5 4000 + SHAPE RING ( 12140 185200 ) ( 188500 185200 )
11511152
NEW metal5 4000 + SHAPE RING ( 12140 16400 ) ( 188500 16400 )
1152-
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
11531153
NEW metal5 0 + SHAPE RING ( 186500 185200 ) via5_6_4000_4000_7_7_600_600
11541154
NEW metal5 0 + SHAPE RING ( 186500 16400 ) via5_6_4000_4000_7_7_600_600
11551155
NEW metal5 0 + SHAPE RING ( 14140 185200 ) via5_6_4000_4000_7_7_600_600

src/pdn/test/core_grid_obstruction.defok

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,9 @@ SPECIALNETS 2 ;
849849
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 28000 ) ( 196500 28000 )
850850
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 22400 ) ( 196500 22400 )
851851
NEW metal6 4000 + SHAPE RING ( 194500 6400 ) ( 194500 195200 )
852+
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
852853
NEW metal5 4000 + SHAPE RING ( 4140 193200 ) ( 196500 193200 )
853854
NEW metal5 4000 + SHAPE RING ( 4140 8400 ) ( 196500 8400 )
854-
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
855855
NEW metal5 0 + SHAPE RING ( 194500 193200 ) via5_6_4000_4000_7_7_600_600
856856
NEW metal5 0 + SHAPE RING ( 194500 8400 ) via5_6_4000_4000_7_7_600_600
857857
NEW metal5 0 + SHAPE RING ( 6140 193200 ) via5_6_4000_4000_7_7_600_600
@@ -2500,9 +2500,9 @@ SPECIALNETS 2 ;
25002500
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 30800 ) ( 188500 30800 )
25012501
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 25200 ) ( 188500 25200 )
25022502
NEW metal6 4000 + SHAPE RING ( 186500 14400 ) ( 186500 187200 )
2503+
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
25032504
NEW metal5 4000 + SHAPE RING ( 12140 185200 ) ( 188500 185200 )
25042505
NEW metal5 4000 + SHAPE RING ( 12140 16400 ) ( 188500 16400 )
2505-
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
25062506
NEW metal5 0 + SHAPE RING ( 186500 185200 ) via5_6_4000_4000_7_7_600_600
25072507
NEW metal5 0 + SHAPE RING ( 186500 16400 ) via5_6_4000_4000_7_7_600_600
25082508
NEW metal5 0 + SHAPE RING ( 14140 185200 ) via5_6_4000_4000_7_7_600_600

src/pdn/test/core_grid_snap.defok

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,9 @@ SPECIALNETS 2 ;
839839
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 28000 ) ( 196500 28000 )
840840
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 22400 ) ( 196500 22400 )
841841
NEW metal6 4000 + SHAPE RING ( 194500 6400 ) ( 194500 195200 )
842+
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
842843
NEW metal5 4000 + SHAPE RING ( 4140 193200 ) ( 196500 193200 )
843844
NEW metal5 4000 + SHAPE RING ( 4140 8400 ) ( 196500 8400 )
844-
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
845845
NEW metal5 0 + SHAPE RING ( 194500 193200 ) via5_6_4000_4000_7_7_600_600
846846
NEW metal5 0 + SHAPE RING ( 194500 8400 ) via5_6_4000_4000_7_7_600_600
847847
NEW metal5 0 + SHAPE RING ( 6140 193200 ) via5_6_4000_4000_7_7_600_600
@@ -2517,9 +2517,9 @@ SPECIALNETS 2 ;
25172517
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 30800 ) ( 188500 30800 )
25182518
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 25200 ) ( 188500 25200 )
25192519
NEW metal6 4000 + SHAPE RING ( 186500 14400 ) ( 186500 187200 )
2520+
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
25202521
NEW metal5 4000 + SHAPE RING ( 12140 185200 ) ( 188500 185200 )
25212522
NEW metal5 4000 + SHAPE RING ( 12140 16400 ) ( 188500 16400 )
2522-
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
25232523
NEW metal5 0 + SHAPE RING ( 186500 185200 ) via5_6_4000_4000_7_7_600_600
25242524
NEW metal5 0 + SHAPE RING ( 186500 16400 ) via5_6_4000_4000_7_7_600_600
25252525
NEW metal5 0 + SHAPE RING ( 14140 185200 ) via5_6_4000_4000_7_7_600_600

src/pdn/test/core_grid_split_cuts.defok

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,9 @@ SPECIALNETS 2 ;
840840
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 28000 ) ( 196500 28000 )
841841
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 22400 ) ( 196500 22400 )
842842
NEW metal6 4000 + SHAPE RING ( 194500 6400 ) ( 194500 195200 )
843+
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
843844
NEW metal5 4000 + SHAPE RING ( 4140 193200 ) ( 196500 193200 )
844845
NEW metal5 4000 + SHAPE RING ( 4140 8400 ) ( 196500 8400 )
845-
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
846846
NEW metal5 0 + SHAPE RING ( 194500 193200 ) via5_6_4000_4000_7_7_600_600
847847
NEW metal5 0 + SHAPE RING ( 194500 8400 ) via5_6_4000_4000_7_7_600_600
848848
NEW metal5 0 + SHAPE RING ( 6140 193200 ) via5_6_4000_4000_7_7_600_600
@@ -3535,9 +3535,9 @@ SPECIALNETS 2 ;
35353535
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 30800 ) ( 188500 30800 )
35363536
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 25200 ) ( 188500 25200 )
35373537
NEW metal6 4000 + SHAPE RING ( 186500 14400 ) ( 186500 187200 )
3538+
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
35383539
NEW metal5 4000 + SHAPE RING ( 12140 185200 ) ( 188500 185200 )
35393540
NEW metal5 4000 + SHAPE RING ( 12140 16400 ) ( 188500 16400 )
3540-
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
35413541
NEW metal5 0 + SHAPE RING ( 186500 185200 ) via5_6_4000_4000_7_7_600_600
35423542
NEW metal5 0 + SHAPE RING ( 186500 16400 ) via5_6_4000_4000_7_7_600_600
35433543
NEW metal5 0 + SHAPE RING ( 14140 185200 ) via5_6_4000_4000_7_7_600_600

src/pdn/test/core_grid_start_power.defok

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,9 @@ SPECIALNETS 2 ;
820820
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 28000 ) ( 188500 28000 )
821821
NEW metal1 340 + SHAPE FOLLOWPIN ( 12140 22400 ) ( 188500 22400 )
822822
NEW metal6 4000 + SHAPE RING ( 186500 14400 ) ( 186500 187200 )
823+
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
823824
NEW metal5 4000 + SHAPE RING ( 12140 185200 ) ( 188500 185200 )
824825
NEW metal5 4000 + SHAPE RING ( 12140 16400 ) ( 188500 16400 )
825-
NEW metal6 4000 + SHAPE RING ( 14140 14400 ) ( 14140 187200 )
826826
NEW metal5 0 + SHAPE RING ( 186500 185200 ) via5_6_4000_4000_7_7_600_600
827827
NEW metal5 0 + SHAPE RING ( 186500 16400 ) via5_6_4000_4000_7_7_600_600
828828
NEW metal5 0 + SHAPE RING ( 14140 185200 ) via5_6_4000_4000_7_7_600_600
@@ -1147,9 +1147,9 @@ SPECIALNETS 2 ;
11471147
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 30800 ) ( 196500 30800 )
11481148
NEW metal1 340 + SHAPE FOLLOWPIN ( 4140 25200 ) ( 196500 25200 )
11491149
NEW metal6 4000 + SHAPE RING ( 194500 6400 ) ( 194500 195200 )
1150+
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
11501151
NEW metal5 4000 + SHAPE RING ( 4140 193200 ) ( 196500 193200 )
11511152
NEW metal5 4000 + SHAPE RING ( 4140 8400 ) ( 196500 8400 )
1152-
NEW metal6 4000 + SHAPE RING ( 6140 6400 ) ( 6140 195200 )
11531153
NEW metal5 0 + SHAPE RING ( 194500 193200 ) via5_6_4000_4000_7_7_600_600
11541154
NEW metal5 0 + SHAPE RING ( 194500 8400 ) via5_6_4000_4000_7_7_600_600
11551155
NEW metal5 0 + SHAPE RING ( 6140 193200 ) via5_6_4000_4000_7_7_600_600

0 commit comments

Comments
 (0)