Skip to content

Commit dc6dc6d

Browse files
dpl: fix topological sort cycle with multi-height cells in shift legalizer
Multi-height cells appear in segments across multiple rows. When a single-height cell sits inside the row span of two multi-height cells, the ordering differs per row, creating a cycle in the topological sort which triggers DPL-0400. Fix: only add dependency edges when both cells' bottom Y matches the current segment's row bottom, ensuring each multi-height cell contributes edges only from its primary (bottom) row. Fixes #9932 Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
1 parent 45a537e commit dc6dc6d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/dpl/src/legalize_shift.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,18 @@ bool ShiftLegalizer::legalize(DetailedMgr& mgr)
120120
outgoing_.resize(size);
121121
for (size_t i = 0; i < mgr.getNumSegments(); i++) {
122122
const int segId = mgr.getSegment(i)->getSegId();
123+
const int rowId = mgr.getSegment(i)->getRowId();
124+
const DbuY rowBottom{arch_->getRow(rowId)->getBottom()};
123125
for (size_t j = 1; j < mgr.getNumCellsInSeg(segId); j++) {
124126
const Node* prev = mgr.getCellsInSeg(segId)[j - 1];
125127
const Node* curr = mgr.getCellsInSeg(segId)[j];
126128

129+
// Only add edges from a cell's bottom (primary) row to avoid
130+
// cycles in the topological sort caused by multi-height cells
131+
// appearing in multiple row segments with conflicting orderings.
132+
if (prev->getBottom() != rowBottom || curr->getBottom() != rowBottom) {
133+
continue;
134+
}
127135
incoming_[curr->getId()].push_back(prev->getId());
128136
outgoing_[prev->getId()].push_back(curr->getId());
129137
}

0 commit comments

Comments
 (0)