Skip to content

Commit 052fd0c

Browse files
committed
pdn: import vias as part of existing shapes import
Signed-off-by: Peter Gadfort <[email protected]>
1 parent 3d6955e commit 052fd0c

File tree

1 file changed

+35
-14
lines changed

1 file changed

+35
-14
lines changed

src/pdn/src/shape.cpp

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "grid.h"
1818
#include "grid_component.h"
1919
#include "odb/db.h"
20+
#include "odb/dbTransform.h"
2021
#include "odb/dbTypes.h"
2122
#include "odb/geom.h"
2223
#include "techlayer.h"
@@ -496,23 +497,43 @@ void Shape::populateMapFromDb(odb::dbNet* net, ShapeVectorMap& map)
496497
// collect existing routing
497498
for (auto* swire : net->getSWires()) {
498499
for (auto* box : swire->getWires()) {
499-
auto* layer = box->getTechLayer();
500-
if (layer == nullptr) {
501-
continue;
502-
}
500+
if (box->isVia()) {
501+
odb::dbSet<odb::dbBox> via_boxes;
502+
const odb::dbTransform transform(box->getViaXY());
503+
if (auto* techvia = box->getTechVia()) {
504+
via_boxes = techvia->getBoxes();
505+
} else if (auto* blockvia = box->getBlockVia()) {
506+
via_boxes = blockvia->getBoxes();
507+
}
508+
for (auto* via_box : via_boxes) {
509+
odb::dbTechLayer* layer = via_box->getTechLayer();
510+
if (layer == nullptr) {
511+
continue;
512+
}
513+
odb::Rect rect = via_box->getBox();
514+
transform.apply(rect);
515+
ShapePtr shape = std::make_shared<Shape>(
516+
layer, net, rect, box->getWireShapeType());
517+
shape->setShapeType(Shape::FIXED);
518+
shape->generateObstruction();
519+
map[layer].push_back(std::move(shape));
520+
}
521+
} else {
522+
odb::dbTechLayer* layer = box->getTechLayer();
503523

504-
odb::Rect rect = box->getBox();
524+
odb::Rect rect = box->getBox();
505525

506-
ShapePtr shape
507-
= std::make_shared<Shape>(layer, net, rect, box->getWireShapeType());
508-
shape->setShapeType(Shape::FIXED);
509-
if (box->getDirection() == odb::dbSBox::OCTILINEAR) {
510-
// cannot connect this this safely so make it an obstruction
511-
shape->setNet(nullptr);
512-
shape->setShapeType(Shape::OBS);
526+
ShapePtr shape = std::make_shared<Shape>(
527+
layer, net, rect, box->getWireShapeType());
528+
shape->setShapeType(Shape::FIXED);
529+
if (box->getDirection() == odb::dbSBox::OCTILINEAR) {
530+
// cannot connect this this safely so make it an obstruction
531+
shape->setNet(nullptr);
532+
shape->setShapeType(Shape::OBS);
533+
}
534+
shape->generateObstruction();
535+
map[layer].push_back(std::move(shape));
513536
}
514-
shape->generateObstruction();
515-
map[layer].push_back(std::move(shape));
516537
}
517538
}
518539
}

0 commit comments

Comments
 (0)