Skip to content

Commit c4e43b1

Browse files
committed
pad: fix test instability
Signed-off-by: Peter Gadfort <peter.gadfort@gmail.com>
1 parent 7cf7b72 commit c4e43b1

3 files changed

Lines changed: 20 additions & 35 deletions

File tree

src/pdn/src/straps.cpp

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,15 +1456,15 @@ bool PadDirectConnectionStraps::refineShapes(
14561456
return GridComponent::refineShapes(all_shapes, all_obstructions);
14571457
}
14581458

1459-
std::vector<Shape*> refine;
1459+
std::vector<ShapePtr> refine;
14601460
for (const auto& [layer, shapes] : getShapes()) {
14611461
for (const auto& shape : shapes) {
14621462
if (!strapViaIsObstructed(
14631463
shape.get(), all_shapes, all_obstructions, false)) {
14641464
continue;
14651465
}
14661466

1467-
refine.push_back(shape.get());
1467+
refine.push_back(shape);
14681468
}
14691469
}
14701470

@@ -1475,37 +1475,24 @@ bool PadDirectConnectionStraps::refineShapes(
14751475
const auto [first, last] = std::ranges::unique(refine.begin(), refine.end());
14761476
refine.erase(first, last);
14771477

1478-
for (auto* refine_shape : refine) {
1479-
std::unique_ptr<Shape> shape = refine_shape->copy();
1480-
removeShape(refine_shape);
1478+
for (const auto& refine_shape : refine) {
1479+
std::unique_ptr<Shape> shape(refine_shape->copy());
1480+
const auto& target_pin = target_pin_shape_[refine_shape.get()];
1481+
removeShape(refine_shape.get());
14811482

1482-
// remove shape from all_shapes and all_obstructions
1483-
auto* layer = shape->getLayer();
1484-
auto find_shape = [&refine_shape](const ShapePtr& other) {
1485-
return other.get() == refine_shape;
1486-
};
14871483
// remove from all_shapes
1488-
auto& layer_shapes = all_shapes[layer];
1489-
auto find_all_shapes_itr = layer_shapes.qbegin(bgi::satisfies(find_shape));
1490-
if (find_all_shapes_itr != layer_shapes.qend()) {
1491-
layer_shapes.remove(*find_all_shapes_itr);
1492-
}
1493-
// remove from all_obstructions
1494-
auto& layer_obstruction = all_obstructions[layer];
1495-
auto find_all_obstructions_itr
1496-
= layer_obstruction.qbegin(bgi::satisfies(find_shape));
1497-
if (find_all_obstructions_itr != layer_obstruction.qend()) {
1498-
layer_obstruction.remove(*find_all_obstructions_itr);
1499-
}
1484+
auto* layer = shape->getLayer();
1485+
all_shapes[layer].remove(refine_shape);
1486+
all_obstructions[layer].remove(refine_shape);
15001487

15011488
const TechLayer tech_layer(layer);
15021489
for (int width : {getWidth(), tech_layer.getMinWidth()}) {
15031490
setWidth(width);
15041491

1505-
if (refineShape(shape.get(),
1506-
target_pin_shape_[refine_shape],
1507-
all_shapes,
1508-
all_obstructions)) {
1492+
if (refineShape(shape.get(), target_pin, all_shapes, all_obstructions)) {
1493+
// add shape to all_shapes and all_obstructions
1494+
getObstructions(all_obstructions);
1495+
getShapes(all_shapes);
15091496
break;
15101497
}
15111498
}
@@ -1517,8 +1504,8 @@ bool PadDirectConnectionStraps::refineShapes(
15171504
bool PadDirectConnectionStraps::refineShape(
15181505
Shape* shape,
15191506
const odb::Rect& pin_shape,
1520-
Shape::ShapeTreeMap& all_shapes,
1521-
Shape::ObstructionTreeMap& all_obstructions)
1507+
const Shape::ShapeTreeMap& all_shapes,
1508+
const Shape::ObstructionTreeMap& all_obstructions)
15221509
{
15231510
const TechLayer tech_layer(shape->getLayer());
15241511

@@ -1549,7 +1536,7 @@ bool PadDirectConnectionStraps::refineShape(
15491536
new_rect.set_xhi(check_loc + getWidth());
15501537
}
15511538

1552-
std::unique_ptr<Shape> new_shape = shape->copy();
1539+
std::unique_ptr<Shape> new_shape(shape->copy());
15531540
new_shape->setRect(new_rect);
15541541

15551542
debugPrint(getLogger(),
@@ -1581,10 +1568,6 @@ bool PadDirectConnectionStraps::refineShape(
15811568
continue;
15821569
}
15831570

1584-
// add shape to all_shapes and all_obstructions
1585-
getObstructions(all_obstructions);
1586-
getShapes(all_shapes);
1587-
15881571
return true;
15891572
}
15901573
}

src/pdn/src/straps.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ class PadDirectConnectionStraps : public Straps
204204

205205
bool refineShape(Shape* shape,
206206
const odb::Rect& pin_shape,
207-
Shape::ShapeTreeMap& all_shapes,
208-
Shape::ObstructionTreeMap& all_obstructions);
207+
const Shape::ShapeTreeMap& all_shapes,
208+
const Shape::ObstructionTreeMap& all_obstructions);
209209
bool isTargetShape(const Shape* shape) const;
210210
};
211211

src/pdn/test/pads_black_parrot_flipchip_connect_overpads.defok

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4564,6 +4564,7 @@ SPECIALNETS 139 ;
45644564
NEW metal10 1660 + SHAPE STRIPE ( 5355810 5604000 ) ( 5355810 5902000 )
45654565
NEW metal10 1660 + SHAPE STRIPE ( 895810 98000 ) ( 895810 396400 )
45664566
NEW metal10 1660 + SHAPE STRIPE ( 5595810 5604000 ) ( 5595810 5902000 )
4567+
NEW metal10 1660 + SHAPE STRIPE ( 5603680 5600830 ) ( 5902000 5600830 )
45674568
NEW metal10 1660 + SHAPE STRIPE ( 5603680 5595810 ) ( 5902000 5595810 )
45684569
NEW metal10 1660 + SHAPE STRIPE ( 5603680 5585810 ) ( 5902000 5585810 )
45694570
NEW metal10 1660 + SHAPE STRIPE ( 5603680 5575810 ) ( 5902000 5575810 )
@@ -4854,6 +4855,7 @@ SPECIALNETS 139 ;
48544855
NEW metal9 10000 + SHAPE RING ( 386140 391400 ) ( 5613680 391400 )
48554856
NEW metal8 10000 + SHAPE RING ( 5608680 386400 ) ( 5608680 5614000 )
48564857
NEW metal8 10000 + SHAPE RING ( 391140 386400 ) ( 391140 5614000 )
4858+
NEW metal9 0 + SHAPE STRIPE ( 5900000 5600830 ) via9_10_4000_1660_1_1_3360_3360
48574859
NEW metal9 0 + SHAPE STRIPE ( 5900000 5595810 ) via9_10_4000_1660_1_1_3360_3360
48584860
NEW metal9 0 + SHAPE STRIPE ( 5900000 5585810 ) via9_10_4000_1660_1_1_3360_3360
48594861
NEW metal9 0 + SHAPE STRIPE ( 5900000 5575810 ) via9_10_4000_1660_1_1_3360_3360

0 commit comments

Comments
 (0)