From c4e43b169321745c4b026e88c6de0e6cbca22227 Mon Sep 17 00:00:00 2001 From: Peter Gadfort Date: Sun, 15 Mar 2026 13:00:42 -0400 Subject: [PATCH] pad: fix test instability Signed-off-by: Peter Gadfort --- src/pdn/src/straps.cpp | 49 ++++++------------- src/pdn/src/straps.h | 4 +- ...ack_parrot_flipchip_connect_overpads.defok | 2 + 3 files changed, 20 insertions(+), 35 deletions(-) diff --git a/src/pdn/src/straps.cpp b/src/pdn/src/straps.cpp index d6c08941c05..9ccecbe8d9d 100644 --- a/src/pdn/src/straps.cpp +++ b/src/pdn/src/straps.cpp @@ -1456,7 +1456,7 @@ bool PadDirectConnectionStraps::refineShapes( return GridComponent::refineShapes(all_shapes, all_obstructions); } - std::vector refine; + std::vector refine; for (const auto& [layer, shapes] : getShapes()) { for (const auto& shape : shapes) { if (!strapViaIsObstructed( @@ -1464,7 +1464,7 @@ bool PadDirectConnectionStraps::refineShapes( continue; } - refine.push_back(shape.get()); + refine.push_back(shape); } } @@ -1475,37 +1475,24 @@ bool PadDirectConnectionStraps::refineShapes( const auto [first, last] = std::ranges::unique(refine.begin(), refine.end()); refine.erase(first, last); - for (auto* refine_shape : refine) { - std::unique_ptr shape = refine_shape->copy(); - removeShape(refine_shape); + for (const auto& refine_shape : refine) { + std::unique_ptr shape(refine_shape->copy()); + const auto& target_pin = target_pin_shape_[refine_shape.get()]; + removeShape(refine_shape.get()); - // remove shape from all_shapes and all_obstructions - auto* layer = shape->getLayer(); - auto find_shape = [&refine_shape](const ShapePtr& other) { - return other.get() == refine_shape; - }; // remove from all_shapes - auto& layer_shapes = all_shapes[layer]; - auto find_all_shapes_itr = layer_shapes.qbegin(bgi::satisfies(find_shape)); - if (find_all_shapes_itr != layer_shapes.qend()) { - layer_shapes.remove(*find_all_shapes_itr); - } - // remove from all_obstructions - auto& layer_obstruction = all_obstructions[layer]; - auto find_all_obstructions_itr - = layer_obstruction.qbegin(bgi::satisfies(find_shape)); - if (find_all_obstructions_itr != layer_obstruction.qend()) { - layer_obstruction.remove(*find_all_obstructions_itr); - } + auto* layer = shape->getLayer(); + all_shapes[layer].remove(refine_shape); + all_obstructions[layer].remove(refine_shape); const TechLayer tech_layer(layer); for (int width : {getWidth(), tech_layer.getMinWidth()}) { setWidth(width); - if (refineShape(shape.get(), - target_pin_shape_[refine_shape], - all_shapes, - all_obstructions)) { + if (refineShape(shape.get(), target_pin, all_shapes, all_obstructions)) { + // add shape to all_shapes and all_obstructions + getObstructions(all_obstructions); + getShapes(all_shapes); break; } } @@ -1517,8 +1504,8 @@ bool PadDirectConnectionStraps::refineShapes( bool PadDirectConnectionStraps::refineShape( Shape* shape, const odb::Rect& pin_shape, - Shape::ShapeTreeMap& all_shapes, - Shape::ObstructionTreeMap& all_obstructions) + const Shape::ShapeTreeMap& all_shapes, + const Shape::ObstructionTreeMap& all_obstructions) { const TechLayer tech_layer(shape->getLayer()); @@ -1549,7 +1536,7 @@ bool PadDirectConnectionStraps::refineShape( new_rect.set_xhi(check_loc + getWidth()); } - std::unique_ptr new_shape = shape->copy(); + std::unique_ptr new_shape(shape->copy()); new_shape->setRect(new_rect); debugPrint(getLogger(), @@ -1581,10 +1568,6 @@ bool PadDirectConnectionStraps::refineShape( continue; } - // add shape to all_shapes and all_obstructions - getObstructions(all_obstructions); - getShapes(all_shapes); - return true; } } diff --git a/src/pdn/src/straps.h b/src/pdn/src/straps.h index a843e1a2a3b..e8517348783 100644 --- a/src/pdn/src/straps.h +++ b/src/pdn/src/straps.h @@ -204,8 +204,8 @@ class PadDirectConnectionStraps : public Straps bool refineShape(Shape* shape, const odb::Rect& pin_shape, - Shape::ShapeTreeMap& all_shapes, - Shape::ObstructionTreeMap& all_obstructions); + const Shape::ShapeTreeMap& all_shapes, + const Shape::ObstructionTreeMap& all_obstructions); bool isTargetShape(const Shape* shape) const; }; diff --git a/src/pdn/test/pads_black_parrot_flipchip_connect_overpads.defok b/src/pdn/test/pads_black_parrot_flipchip_connect_overpads.defok index bfafbdd9b23..ae14c976952 100644 --- a/src/pdn/test/pads_black_parrot_flipchip_connect_overpads.defok +++ b/src/pdn/test/pads_black_parrot_flipchip_connect_overpads.defok @@ -4564,6 +4564,7 @@ SPECIALNETS 139 ; NEW metal10 1660 + SHAPE STRIPE ( 5355810 5604000 ) ( 5355810 5902000 ) NEW metal10 1660 + SHAPE STRIPE ( 895810 98000 ) ( 895810 396400 ) NEW metal10 1660 + SHAPE STRIPE ( 5595810 5604000 ) ( 5595810 5902000 ) + NEW metal10 1660 + SHAPE STRIPE ( 5603680 5600830 ) ( 5902000 5600830 ) NEW metal10 1660 + SHAPE STRIPE ( 5603680 5595810 ) ( 5902000 5595810 ) NEW metal10 1660 + SHAPE STRIPE ( 5603680 5585810 ) ( 5902000 5585810 ) NEW metal10 1660 + SHAPE STRIPE ( 5603680 5575810 ) ( 5902000 5575810 ) @@ -4854,6 +4855,7 @@ SPECIALNETS 139 ; NEW metal9 10000 + SHAPE RING ( 386140 391400 ) ( 5613680 391400 ) NEW metal8 10000 + SHAPE RING ( 5608680 386400 ) ( 5608680 5614000 ) NEW metal8 10000 + SHAPE RING ( 391140 386400 ) ( 391140 5614000 ) + NEW metal9 0 + SHAPE STRIPE ( 5900000 5600830 ) via9_10_4000_1660_1_1_3360_3360 NEW metal9 0 + SHAPE STRIPE ( 5900000 5595810 ) via9_10_4000_1660_1_1_3360_3360 NEW metal9 0 + SHAPE STRIPE ( 5900000 5585810 ) via9_10_4000_1660_1_1_3360_3360 NEW metal9 0 + SHAPE STRIPE ( 5900000 5575810 ) via9_10_4000_1660_1_1_3360_3360