Skip to content

Commit 56debb6

Browse files
authored
Merge pull request #8404 from gadfort/pdn-macro-check
pdn: add check for macro pin access before running power grid generation
2 parents fef01f9 + f5efe4e commit 56debb6

11 files changed

+40190
-1
lines changed

src/pdn/src/grid.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,63 @@ bool InstanceGrid::isValid() const
16661666
return true;
16671667
}
16681668

1669+
void InstanceGrid::checkSetup() const
1670+
{
1671+
Grid::checkSetup();
1672+
1673+
// check blockages above pins
1674+
const auto nets = getNets(startsWithPower());
1675+
for (auto* iterm : inst_->getITerms()) {
1676+
if (std::find(nets.begin(), nets.end(), iterm->getNet()) == nets.end()) {
1677+
continue;
1678+
}
1679+
odb::dbTechLayer* top = nullptr;
1680+
std::set<odb::Rect> boxes;
1681+
for (auto* mpin : iterm->getMTerm()->getMPins()) {
1682+
for (auto* box : mpin->getGeometry()) {
1683+
auto* layer = box->getTechLayer();
1684+
if (layer == nullptr) {
1685+
continue;
1686+
}
1687+
if (top == nullptr
1688+
|| top->getRoutingLevel() < layer->getRoutingLevel()) {
1689+
top = layer;
1690+
boxes.clear();
1691+
}
1692+
if (layer == top) {
1693+
boxes.insert(box->getBox());
1694+
}
1695+
}
1696+
}
1697+
1698+
if (top != nullptr) {
1699+
const int top_idx = top->getNumber();
1700+
for (auto* master_obs : inst_->getMaster()->getObstructions()) {
1701+
auto* obs_layer = master_obs->getTechLayer();
1702+
if (obs_layer == nullptr) {
1703+
continue;
1704+
}
1705+
if (obs_layer->getType() != odb::dbTechLayerType::ROUTING) {
1706+
continue;
1707+
}
1708+
if (obs_layer->getNumber() > top_idx) {
1709+
for (const auto& pin : boxes) {
1710+
if (pin.intersects(master_obs->getBox())) {
1711+
getLogger()->error(
1712+
utl::PDN,
1713+
6,
1714+
"Pins on {} are blocked by obstructions on {} for {}",
1715+
top->getName(),
1716+
obs_layer->getName(),
1717+
inst_->getName());
1718+
}
1719+
}
1720+
}
1721+
}
1722+
}
1723+
}
1724+
}
1725+
16691726
////////
16701727

16711728
BumpGrid::BumpGrid(VoltageDomain* domain,

src/pdn/src/grid.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class Grid
153153

154154
virtual bool isReplaceable() const { return false; }
155155

156-
void checkSetup() const;
156+
virtual void checkSetup() const;
157157

158158
void setSwitchedPower(GridSwitchedPower* cell);
159159

@@ -251,6 +251,7 @@ class InstanceGrid : public Grid
251251
bool isReplaceable() const override { return replaceable_; }
252252

253253
virtual bool isValid() const;
254+
void checkSetup() const override;
254255

255256
static ShapeVectorMap getInstanceObstructions(odb::dbInst* inst,
256257
const Halo& halo

src/pdn/test/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ load("//test:regression.bzl", "regression_test")
33
# From CMakeLists.txt or_integration_tests(TESTS
44
COMPULSORY_TESTS = [
55
"add_double_global_connection",
6+
"asap7_failed_macro_covered",
67
"asap7_failed_macro_grid",
78
"asap7_no_via_generate",
89
"asap7_no_via_generate_v1_snapped",
@@ -19,6 +20,7 @@ COMPULSORY_TESTS = [
1920
"asap7_vias_max_rows_columns",
2021
"asap7_M1_M3_followpins",
2122
"asap7_M1_M3_followpins_staggered",
23+
"asap7_macro_notcovered",
2224
"bpin_removal",
2325
"core_grid",
2426
"core_grid_adjacentcuts",
@@ -168,6 +170,8 @@ filegroup(
168170
"Nangate45/work_around_yosys/cells.v",
169171
"Nangate45_vias/Nangate45_adjacentcuts.lef",
170172
"asap7_data/fakeram7_256x32.lef",
173+
"asap7_data/fakeram7_256x32_covered.lef",
174+
"asap7_data/fakeram7_256x32_notcovered.lef",
171175
"asap7_vias/asap7_tech_1x.lef",
172176
"asap7_vias/asap7_tech_1x_arrayspacing.lef",
173177
"asap7_vias/asap7_tech_1x_arrayspacing_tightspacing.lef",
@@ -269,6 +273,8 @@ filegroup(
269273
"ihp_ethmac/RM_IHPSG13_1P_256x48_c2_bm_bist.lef",
270274
"ihp_ethmac/floorplan.def",
271275
],
276+
"asap7_failed_macro_covered": ["asap7_failed_macro_grid.def"],
277+
"asap7_macro_notcovered": ["asap7_failed_macro_grid.def"],
272278
}.get(test_name, []),
273279
)
274280
for test_name in ALL_TESTS

src/pdn/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ or_integration_tests(
22
"pdn"
33
TESTS
44
add_double_global_connection
5+
asap7_failed_macro_covered
56
asap7_failed_macro_grid
67
asap7_no_via_generate
78
asap7_no_via_generate_v1_snapped
@@ -18,6 +19,7 @@ or_integration_tests(
1819
asap7_vias_max_rows_columns
1920
asap7_M1_M3_followpins
2021
asap7_M1_M3_followpins_staggered
22+
asap7_macro_notcovered
2123
bpin_removal
2224
core_grid
2325
core_grid_adjacentcuts

0 commit comments

Comments
 (0)