Skip to content

Commit f46af5d

Browse files
Merge pull request #8919 from The-OpenROAD-Project-staging/fix-detailed-manager-files
Fix dpl site orientation validation
2 parents 22368d9 + b4edbb1 commit f46af5d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/dpl/src/optimization/detailed_manager.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,14 @@ bool DetailedMgr::alignPos(const Node* ndi, DbuX& xi, const DbuX xl, DbuX xr)
18251825

18261826
////////////////////////////////////////////////////////////////////////////////
18271827
////////////////////////////////////////////////////////////////////////////////
1828+
bool DetailedMgr::checkSiteOrientation(Node* node, DbuX x, DbuY y)
1829+
{
1830+
odb::dbSite* site = node->getDbInst()->getMaster()->getSite();
1831+
const auto grid_x = grid_->gridX(x);
1832+
const auto grid_y = grid_->gridSnapDownY(y);
1833+
return grid_->getSiteOrientation(grid_x, grid_y, site).has_value();
1834+
}
1835+
18281836
bool DetailedMgr::shift(std::vector<Node*>& cells,
18291837
std::vector<DbuX>& targetLeft,
18301838
std::vector<DbuX>& posLeft,
@@ -2468,6 +2476,7 @@ bool DetailedMgr::tryMove2(Node* ndi,
24682476
if (!alignPos(ndi, xj, lx, rx)) {
24692477
return false;
24702478
}
2479+
24712480
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
24722481
return false;
24732482
}
@@ -2486,6 +2495,7 @@ bool DetailedMgr::tryMove2(Node* ndi,
24862495
if (!alignPos(ndi, xj, lx, rx)) {
24872496
return false;
24882497
}
2498+
24892499
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
24902500
return false;
24912501
}
@@ -2873,6 +2883,7 @@ bool DetailedMgr::trySwap1(Node* ndi,
28732883
const DbuX x2 = ndj->getLeft();
28742884
const DbuY y2 = ndj->getBottom();
28752885
// Build move list.
2886+
28762887
if (!addToMoveList(ndi, x1, y1, si, xj, y2, sj)) {
28772888
return false;
28782889
}
@@ -2905,6 +2916,10 @@ bool DetailedMgr::addToMoveList(Node* ndi,
29052916
return false;
29062917
}
29072918

2919+
if (!checkSiteOrientation(ndi, newLeft, newBottom)) {
2920+
return false;
2921+
}
2922+
29082923
// Easy to observe displacement limit if using the
29092924
// manager to compose a move list. We can check
29102925
// only here whether or not a cell will violate its
@@ -2946,6 +2961,11 @@ bool DetailedMgr::addToMoveList(Node* ndi,
29462961
if (journal_.size() >= moveLimit_) {
29472962
return false;
29482963
}
2964+
2965+
if (!checkSiteOrientation(ndi, newLeft, newBottom)) {
2966+
return false;
2967+
}
2968+
29492969
// commit move and add to journal
29502970
eraseFromGrid(ndi);
29512971
for (const auto& curSeg : curSegs) {
@@ -2989,6 +3009,7 @@ void DetailedMgr::paintInGrid(Node* node)
29893009
const auto grid_x = grid_->gridX(node);
29903010
const auto grid_y = grid_->gridSnapDownY(node);
29913011
odb::dbSite* site = node->getDbInst()->getMaster()->getSite();
3012+
29923013
const auto orientation
29933014
= grid_->getSiteOrientation(grid_x, grid_y, site).value();
29943015
grid_->paintPixel(node, grid_x, grid_y);

src/dpl/src/optimization/detailed_manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ class DetailedMgr
298298
bool trySwap1(Node* ndi, DbuX xi, DbuY yi, int si, DbuX xj, DbuY yj, int sj);
299299

300300
// Helper routines for making moves and swaps.
301+
bool checkSiteOrientation(Node* node, DbuX x, DbuY y);
301302
bool shift(std::vector<Node*>& cells,
302303
std::vector<DbuX>& targetLeft,
303304
std::vector<DbuX>& posLeft,

0 commit comments

Comments
 (0)