|
17 | 17 | #include "grid.h" |
18 | 18 | #include "grid_component.h" |
19 | 19 | #include "odb/db.h" |
| 20 | +#include "odb/dbSet.h" |
| 21 | +#include "odb/dbTransform.h" |
20 | 22 | #include "odb/dbTypes.h" |
21 | 23 | #include "odb/geom.h" |
22 | 24 | #include "techlayer.h" |
@@ -496,23 +498,43 @@ void Shape::populateMapFromDb(odb::dbNet* net, ShapeVectorMap& map) |
496 | 498 | // collect existing routing |
497 | 499 | for (auto* swire : net->getSWires()) { |
498 | 500 | 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(); |
503 | 524 |
|
504 | | - odb::Rect rect = box->getBox(); |
| 525 | + odb::Rect rect = box->getBox(); |
505 | 526 |
|
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)); |
513 | 537 | } |
514 | | - shape->generateObstruction(); |
515 | | - map[layer].push_back(std::move(shape)); |
516 | 538 | } |
517 | 539 | } |
518 | 540 | } |
|
0 commit comments