Skip to content

Commit 20d9928

Browse files
authored
Merge pull request #9025 from gadfort/pdn-importvias
pdn: import vias as part of existing shapes import
2 parents 471f14a + 6b1abf1 commit 20d9928

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

src/pdn/src/shape.cpp

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

504-
odb::Rect rect = box->getBox();
525+
odb::Rect rect = box->getBox();
505526

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);
527+
ShapePtr shape = std::make_shared<Shape>(
528+
layer, net, rect, box->getWireShapeType());
529+
shape->setShapeType(Shape::FIXED);
530+
if (box->getDirection() == odb::dbSBox::OCTILINEAR) {
531+
// cannot connect this this safely so make it an obstruction
532+
shape->setNet(nullptr);
533+
shape->setShapeType(Shape::OBS);
534+
}
535+
shape->generateObstruction();
536+
map[layer].push_back(std::move(shape));
513537
}
514-
shape->generateObstruction();
515-
map[layer].push_back(std::move(shape));
516538
}
517539
}
518540
}

0 commit comments

Comments
 (0)