Skip to content

Commit 1bad408

Browse files
authored
Merge pull request #8617 from gadfort/pdn-warn-on-partial-overlap
pdn: error on complete pin coverage and warn on partial coverage
2 parents d31e6ad + b52891e commit 1bad408

9 files changed

Lines changed: 71533 additions & 10 deletions

src/pdn/src/grid.cpp

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <algorithm>
77
#include <array>
8+
#include <cstdint>
89
#include <map>
910
#include <memory>
1011
#include <set>
@@ -1697,6 +1698,8 @@ void InstanceGrid::checkSetup() const
16971698

16981699
if (top != nullptr) {
16991700
const int top_idx = top->getNumber();
1701+
std::map<odb::Rect, int64_t> overlap_area;
1702+
std::set<odb::dbTechLayer*> layers;
17001703
for (auto* master_obs : inst_->getMaster()->getObstructions()) {
17011704
auto* obs_layer = master_obs->getTechLayer();
17021705
if (obs_layer == nullptr) {
@@ -1707,18 +1710,57 @@ void InstanceGrid::checkSetup() const
17071710
}
17081711
if (obs_layer->getNumber() > top_idx) {
17091712
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());
1713+
const odb::Rect mobs = master_obs->getBox();
1714+
1715+
if (mobs.intersects(pin)) {
1716+
// Determine level of obstruction
1717+
const odb::Rect overlap = mobs.intersect(pin);
1718+
overlap_area[pin] += overlap.area();
1719+
layers.insert(obs_layer);
17181720
}
17191721
}
17201722
}
17211723
}
1724+
1725+
if (!overlap_area.empty()) {
1726+
int64_t total_pin_area = 0;
1727+
int64_t total_overlap = 0;
1728+
std::string layer_txt;
1729+
for (const auto* layer : layers) {
1730+
if (!layer_txt.empty()) {
1731+
layer_txt += ", ";
1732+
}
1733+
layer_txt += layer->getName();
1734+
}
1735+
for (const auto& [pin, overlap] : overlap_area) {
1736+
const int64_t pinarea = pin.area();
1737+
total_overlap += overlap;
1738+
total_pin_area += pinarea;
1739+
1740+
if (overlap >= pinarea) {
1741+
// pin completely obstructed
1742+
getLogger()->error(
1743+
utl::PDN,
1744+
6,
1745+
"{} on {} is blocked by obstructions on {} for {}",
1746+
iterm->getMTerm()->getName(),
1747+
top->getName(),
1748+
layer_txt,
1749+
inst_->getName());
1750+
}
1751+
}
1752+
const float pct
1753+
= 100 * static_cast<float>(total_overlap) / total_pin_area;
1754+
getLogger()->warn(utl::PDN,
1755+
7,
1756+
"{} on {} is partially blocked ({:.1f}%) by "
1757+
"obstructions on {} for {}",
1758+
iterm->getMTerm()->getName(),
1759+
top->getName(),
1760+
pct,
1761+
layer_txt,
1762+
inst_->getName());
1763+
}
17221764
}
17231765
}
17241766
}

src/pdn/test/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ COMPULSORY_TESTS = [
77
"add_double_global_connection",
88
"asap7_failed_macro_covered",
99
"asap7_failed_macro_grid",
10+
"asap7_macro_covered_partial",
1011
"asap7_no_via_generate",
1112
"asap7_no_via_generate_v1_snapped",
1213
"asap7_offcenter_via",
@@ -183,6 +184,7 @@ filegroup(
183184
"Nangate45_vias/Nangate45_adjacentcuts.lef",
184185
"asap7_data/fakeram7_256x32.lef",
185186
"asap7_data/fakeram7_256x32_covered.lef",
187+
"asap7_data/fakeram7_256x32_covered_partial.lef",
186188
"asap7_data/fakeram7_256x32_notcovered.lef",
187189
"asap7_vias/asap7_tech_1x.lef",
188190
"asap7_vias/asap7_tech_1x_arrayspacing.lef",
@@ -278,6 +280,7 @@ filegroup(
278280
],
279281
) + {
280282
"asap7_failed_macro_covered": ["asap7_failed_macro_grid.def"],
283+
"asap7_macro_covered_partial": ["asap7_failed_macro_grid.def"],
281284
"asap7_macro_notcovered": ["asap7_failed_macro_grid.def"],
282285
"core_grid_auto_domain": ["core_grid.defok"],
283286
"core_grid_with_rings_connect": ["core_grid_with_rings.defok"],

src/pdn/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ or_integration_tests(
44
add_double_global_connection
55
asap7_failed_macro_covered
66
asap7_failed_macro_grid
7+
asap7_macro_covered_partial
78
asap7_no_via_generate
89
asap7_no_via_generate_v1_snapped
910
asap7_offcenter_via

src/pdn/test/asap7_data/fakeram7_256x32_covered.lef

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ MACRO fakeram7_256x32
879879
LAYER M4 ;
880880
RECT 0.1 0 4.080 67.200 ;
881881
LAYER M5 ;
882-
RECT 0.1 0 4.080 67.200 ;
882+
RECT 0.048 0 4.132 67.200 ;
883883
END
884884
END fakeram7_256x32
885885

0 commit comments

Comments
 (0)