Skip to content

Commit 68fcfab

Browse files
authored
Merge pull request #8851 from gadfort/pdn-bterms
pdn: add handling of fixed bpins in power grids
2 parents f54a059 + 9700372 commit 68fcfab

File tree

10 files changed

+1918
-3
lines changed

10 files changed

+1918
-3
lines changed

src/pdn/src/PdnGen.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@ void PdnGen::buildGrids(bool trim)
7171
insts_in_grids.insert(insts_in_grid.begin(), insts_in_grid.end());
7272
}
7373

74+
std::set<odb::dbNet*> grid_nets;
75+
for (auto* grid : grids) {
76+
const auto nets = grid->getNets();
77+
grid_nets.insert(nets.begin(), nets.end());
78+
}
79+
7480
ShapeVectorMap block_obs_vec;
75-
Grid::makeInitialObstructions(block, block_obs_vec, insts_in_grids, logger_);
81+
Grid::makeInitialObstructions(
82+
block, block_obs_vec, insts_in_grids, grid_nets, logger_);
7683
for (auto* grid : grids) {
7784
grid->getGridLevelObstructions(block_obs_vec);
7885
}

src/pdn/src/grid.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ void Grid::getGridLevelObstructions(ShapeVectorMap& obstructions) const
10871087
void Grid::makeInitialObstructions(odb::dbBlock* block,
10881088
ShapeVectorMap& obs,
10891089
const std::set<odb::dbInst*>& skip_insts,
1090+
const std::set<odb::dbNet*>& skip_nets,
10901091
utl::Logger* logger)
10911092
{
10921093
debugPrint(logger, utl::PDN, "Make", 2, "Get initial obstructions - begin");
@@ -1157,6 +1158,11 @@ void Grid::makeInitialObstructions(odb::dbBlock* block,
11571158

11581159
// fixed pins obs
11591160
for (auto* bterm : block->getBTerms()) {
1161+
if (skip_nets.find(bterm->getNet()) != skip_nets.end()) {
1162+
// these shapes will be collected as existing to the grid.
1163+
continue;
1164+
}
1165+
11601166
for (auto* bpin : bterm->getBPins()) {
11611167
if (!bpin->getPlacementStatus().isFixed()) {
11621168
continue;

src/pdn/src/grid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class Grid
146146
static void makeInitialObstructions(odb::dbBlock* block,
147147
ShapeVectorMap& obs,
148148
const std::set<odb::dbInst*>& skip_insts,
149+
const std::set<odb::dbNet*>& skip_nets,
149150
utl::Logger* logger);
150151
static void makeInitialShapes(odb::dbBlock* block,
151152
ShapeVectorMap& shapes,

src/pdn/src/renderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void PDNRenderer::update()
6060
auto* domain = pdn_->getDomains()[0];
6161
ShapeVectorMap initial_shapes;
6262
Grid::makeInitialObstructions(
63-
domain->getBlock(), initial_shapes, {}, domain->getLogger());
63+
domain->getBlock(), initial_shapes, {}, {}, domain->getLogger());
6464
initial_obstructions_
6565
= Shape::convertVectorToObstructionTree(initial_shapes);
6666
}

src/pdn/src/shape.cpp

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,25 @@ bool Shape::cut(const ObstructionTree& obstructions,
242242
it != obstructions.qend();
243243
it++) {
244244
const auto& other_shape = *it;
245+
246+
if (other_shape->net_ != nullptr && net_ == other_shape->net_) {
247+
// obstruction is of the same net, so see if the violation is completely
248+
// inside the new strap and therefore is okay
249+
if (is_horizontal) {
250+
if (rect_.yMin() <= other_shape->rect_.yMin()
251+
&& rect_.yMax() >= other_shape->rect_.yMax()) {
252+
continue;
253+
}
254+
} else {
255+
if (rect_.xMin() <= other_shape->rect_.xMin()
256+
&& rect_.xMax() >= other_shape->rect_.xMax()) {
257+
continue;
258+
}
259+
}
260+
}
261+
245262
odb::Rect vio_rect
246263
= other_shape->getRectWithLargestObstructionHalo(obs_halo);
247-
248264
// ensure the violation overlap fully with the shape to make cut correctly
249265
if (is_horizontal) {
250266
vio_rect.set_ylo(std::min(obs_.yMin(), vio_rect.yMin()));
@@ -451,6 +467,33 @@ odb::dbBox* Shape::addBPinToDb(const odb::Rect& rect) const
451467

452468
void Shape::populateMapFromDb(odb::dbNet* net, ShapeVectorMap& map)
453469
{
470+
// collect fixed bterms
471+
for (auto* bterm : net->getBTerms()) {
472+
for (auto* bpin : bterm->getBPins()) {
473+
if (!bpin->getPlacementStatus().isFixed()) {
474+
continue;
475+
}
476+
for (auto* box : bpin->getBoxes()) {
477+
auto* layer = box->getTechLayer();
478+
if (layer == nullptr) {
479+
continue;
480+
}
481+
if (layer->getRoutingLevel() == 0) {
482+
continue;
483+
}
484+
485+
odb::Rect rect = box->getBox();
486+
487+
ShapePtr shape = std::make_shared<Shape>(
488+
layer, net, rect, odb::dbWireShapeType::NONE);
489+
shape->setShapeType(Shape::FIXED);
490+
shape->generateObstruction();
491+
map[layer].push_back(std::move(shape));
492+
}
493+
}
494+
}
495+
496+
// collect existing routing
454497
for (auto* swire : net->getSWires()) {
455498
for (auto* box : swire->getWires()) {
456499
auto* layer = box->getTechLayer();

src/pdn/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ COMPULSORY_TESTS = [
5050
"core_grid_via_snap",
5151
"core_grid_with_M6_min_area",
5252
"core_grid_with_M7_pins",
53+
"core_grid_with_bterms",
5354
"core_grid_with_dual_rings",
5455
"core_grid_with_fixed_pins",
5556
"core_grid_with_m2_straps",

src/pdn/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ or_integration_tests(
4747
core_grid_via_snap
4848
core_grid_with_M6_min_area
4949
core_grid_with_M7_pins
50+
core_grid_with_bterms
5051
core_grid_with_dual_rings
5152
core_grid_with_fixed_pins
5253
core_grid_with_m2_straps

0 commit comments

Comments
 (0)