Skip to content

Commit 64ed2f1

Browse files
committed
pad: fix instance check
Signed-off-by: Peter Gadfort <[email protected]>
1 parent 75ee729 commit 64ed2f1

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/pad/src/ICeWall.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,29 +1185,36 @@ int ICeWall::placeInstance(odb::dbRow* row,
11851185
2,
11861186
"Shift required for {} to avoid {} ({} -> {})",
11871187
inst->getName(),
1188-
check_inst->getName(),
1188+
check_inst ? check_inst->getName() : "blockage",
11891189
index,
11901190
next_index);
11911191

11921192
return placeInstance(
11931193
row, next_index, inst, base_orient, allow_overlap, allow_shift);
11941194
} else if (!allow_overlap && check_obs) {
11951195
const auto& [check_inst, obs_rect] = *check_obs;
1196-
const odb::Rect check_rect = check_inst->getBBox()->getBox();
1196+
odb::Rect check_rect;
1197+
if (check_inst == nullptr) {
1198+
check_rect = obs_rect;
1199+
} else {
1200+
check_rect = check_inst->getBBox()->getBox();
1201+
}
11971202
logger_->error(utl::PAD,
11981203
1,
11991204
"Unable to place {} ({}) at ({:.3f}um, {:.3f}um) - "
12001205
"({:.3f}um, {:.3f}um) as it "
1201-
"overlaps with {} ({}) at ({:.3f}um, {:.3f}um) - "
1206+
"overlaps with {} at ({:.3f}um, {:.3f}um) - "
12021207
"({:.3f}um, {:.3f}um)",
12031208
inst->getName(),
12041209
inst->getMaster()->getName(),
12051210
inst_rect.xMin() / dbus,
12061211
inst_rect.yMin() / dbus,
12071212
inst_rect.xMax() / dbus,
12081213
inst_rect.yMax() / dbus,
1209-
check_inst->getName(),
1210-
check_inst->getMaster()->getName(),
1214+
check_inst ? fmt::format("{} ({})",
1215+
check_inst->getName(),
1216+
check_inst->getMaster()->getName())
1217+
: "blockage",
12111218
check_rect.xMin() / dbus,
12121219
check_rect.yMin() / dbus,
12131220
check_rect.xMax() / dbus,
@@ -1957,6 +1964,13 @@ ICeWall::checkInstancePlacement(odb::dbInst* inst, odb::dbRow* row) const
19571964
std::set<odb::dbInst*> covers;
19581965
auto* block = getBlock();
19591966
if (block) {
1967+
const odb::Rect inst_rect = inst->getBBox()->getBox();
1968+
for (odb::dbBlockage* blockage : block->getBlockages()) {
1969+
if (blockage->getBBox()->getBox().overlaps(inst_rect)) {
1970+
return std::make_pair(
1971+
nullptr, blockage->getBBox()->getBox().intersect(inst_rect));
1972+
}
1973+
}
19601974
for (auto* check_inst : block->getInsts()) {
19611975
if (check_inst == inst) {
19621976
continue;
@@ -1968,6 +1982,10 @@ ICeWall::checkInstancePlacement(odb::dbInst* inst, odb::dbRow* row) const
19681982
covers.insert(check_inst);
19691983
continue;
19701984
}
1985+
if (check_inst->getBBox()->getBox().overlaps(inst_rect)) {
1986+
return std::make_pair(
1987+
check_inst, check_inst->getBBox()->getBox().intersect(inst_rect));
1988+
}
19711989
}
19721990
}
19731991

0 commit comments

Comments
 (0)