Skip to content

Commit 44d5b3d

Browse files
committed
pdn: attempt to snap to manufactoring grid for via creation
Signed-off-by: Peter Gadfort <[email protected]>
1 parent eeae9db commit 44d5b3d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/pdn/src/connect.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,30 @@ void Connect::makeVia(odb::dbSWire* wire,
447447
{
448448
const odb::Rect& lower_rect = lower->getRect();
449449
const odb::Rect& upper_rect = upper->getRect();
450-
const odb::Rect intersection = lower_rect.intersect(upper_rect);
450+
odb::Rect intersection = lower_rect.intersect(upper_rect);
451451

452452
auto* tech = layer0_->getTech();
453+
454+
// Attempt to snap to grid
455+
if (tech->hasManufacturingGrid()) {
456+
const odb::Rect new_intersection(
457+
TechLayer::snapToManufacturingGrid(tech, intersection.xMin(), true, 2),
458+
TechLayer::snapToManufacturingGrid(tech, intersection.yMin(), true, 2),
459+
TechLayer::snapToManufacturingGrid(tech, intersection.xMax(), false, 2),
460+
TechLayer::snapToManufacturingGrid(
461+
tech, intersection.yMax(), false, 2));
462+
if (intersection != new_intersection) {
463+
debugPrint(grid_->getLogger(),
464+
utl::PDN,
465+
"Via",
466+
2,
467+
"intersection changed: {} -> {}",
468+
Shape::getRectText(intersection, tech->getLefUnits()),
469+
Shape::getRectText(new_intersection, tech->getLefUnits()));
470+
intersection = new_intersection;
471+
}
472+
}
473+
453474
const int x = std::round(0.5 * (intersection.xMin() + intersection.xMax()));
454475
const int y = std::round(0.5 * (intersection.yMin() + intersection.yMax()));
455476

0 commit comments

Comments
 (0)