Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 16 additions & 33 deletions src/pdn/src/straps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,15 +1456,15 @@ bool PadDirectConnectionStraps::refineShapes(
return GridComponent::refineShapes(all_shapes, all_obstructions);
}

std::vector<Shape*> refine;
std::vector<ShapePtr> refine;
for (const auto& [layer, shapes] : getShapes()) {
for (const auto& shape : shapes) {
if (!strapViaIsObstructed(
shape.get(), all_shapes, all_obstructions, false)) {
continue;
}

refine.push_back(shape.get());
refine.push_back(shape);
}
}

Expand All @@ -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> shape = refine_shape->copy();
removeShape(refine_shape);
for (const auto& refine_shape : refine) {
std::unique_ptr<Shape> 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;
}
}
Expand All @@ -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());

Expand Down Expand Up @@ -1549,7 +1536,7 @@ bool PadDirectConnectionStraps::refineShape(
new_rect.set_xhi(check_loc + getWidth());
}

std::unique_ptr<Shape> new_shape = shape->copy();
std::unique_ptr<Shape> new_shape(shape->copy());
new_shape->setRect(new_rect);

debugPrint(getLogger(),
Expand Down Expand Up @@ -1581,10 +1568,6 @@ bool PadDirectConnectionStraps::refineShape(
continue;
}

// add shape to all_shapes and all_obstructions
getObstructions(all_obstructions);
getShapes(all_shapes);

return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/pdn/src/straps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand Down
Loading