Skip to content

Commit 6918d1e

Browse files
committed
tap: address review comments in computeOpenSpans and corner overlap check
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent 0257c1a commit 6918d1e

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/tap/src/tapcell.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,17 @@ static std::vector<std::pair<int, int>> computeOpenSpans(
249249
std::vector<std::pair<int, int>> open_spans;
250250
int cursor = start;
251251
for (const auto& [b_start, b_end] : blockers) {
252-
if (b_end <= cursor || b_start >= end) {
252+
// blockers are sorted by start, so none of the rest can open a span
253+
if (b_start >= end) {
254+
break;
255+
}
256+
if (b_end <= cursor) {
253257
continue;
254258
}
255259
if (b_start > cursor) {
256260
open_spans.emplace_back(cursor, b_start);
257261
}
258-
cursor = std::max(cursor, b_end);
262+
cursor = b_end;
259263
}
260264
if (cursor < end) {
261265
open_spans.emplace_back(cursor, end);
@@ -1084,9 +1088,7 @@ Tapcell::CornerMap Tapcell::placeEndcapCorner(const Tapcell::Corner& corner,
10841088
const odb::Rect cell(
10851089
ll.getX(), ll.getY(), ll.getX() + width, ll.getY() + height);
10861090
for (auto* other : placed->second) {
1087-
const odb::Rect obb = other->getBBox()->getBox();
1088-
if (cell.xMax() > obb.xMin() && cell.xMin() < obb.xMax()
1089-
&& cell.yMax() > obb.yMin() && cell.yMin() < obb.yMax()) {
1091+
if (cell.overlaps(other->getBBox()->getBox())) {
10901092
return {};
10911093
}
10921094
}
@@ -1279,6 +1281,8 @@ int Tapcell::fillEndcapEdge(odb::dbRow* row,
12791281
x_end,
12801282
master->getName());
12811283

1284+
// Stop if the master is not symmetric for this row: retrying the same
1285+
// position (as the old continue did) would loop forever since x is fixed.
12821286
if (!checkSymmetry(master, row->getOrient())) {
12831287
break;
12841288
}

0 commit comments

Comments
 (0)