@@ -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+
18281836bool DetailedMgr::shift (std::vector<Node*>& cells,
18291837 std::vector<DbuX>& targetLeft,
18301838 std::vector<DbuX>& posLeft,
@@ -2297,14 +2305,6 @@ bool DetailedMgr::tryMove1(Node* ndi,
22972305 if (!alignPos (ndi, xj, lx, rx)) {
22982306 return false ;
22992307 }
2300- // Check if the site orientation is available at the new position
2301- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2302- const auto grid_x = grid_->gridX (xj);
2303- const auto grid_y = grid_->gridSnapDownY (yj);
2304- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2305- return false ;
2306- }
2307-
23082308 // Build the move list.
23092309 if (!addToMoveList (ndi, ndi->getLeft (), ndi->getBottom (), si, xj, yj, sj)) {
23102310 return false ;
@@ -2330,14 +2330,6 @@ bool DetailedMgr::tryMove1(Node* ndi,
23302330 return false ;
23312331 }
23322332
2333- // Check if the site orientation is available at the new position
2334- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2335- const auto grid_x = grid_->gridX (xj);
2336- const auto grid_y = grid_->gridSnapDownY (yj);
2337- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2338- return false ;
2339- }
2340-
23412333 // Build the move list.
23422334 if (!addToMoveList (ndi, ndi->getLeft (), ndi->getBottom (), si, xj, yj, sj)) {
23432335 return false ;
@@ -2367,14 +2359,6 @@ bool DetailedMgr::tryMove1(Node* ndi,
23672359 return false ;
23682360 }
23692361
2370- // Check if the site orientation is available at the new position
2371- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2372- const auto grid_x = grid_->gridX (xj);
2373- const auto grid_y = grid_->gridSnapDownY (yj);
2374- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2375- return false ;
2376- }
2377-
23782362 // Build the move list.
23792363 if (!addToMoveList (ndi, ndi->getLeft (), ndi->getBottom (), si, xj, yj, sj)) {
23802364 return false ;
@@ -2403,14 +2387,6 @@ bool DetailedMgr::tryMove1(Node* ndi,
24032387 return false ;
24042388 }
24052389
2406- // Check if the site orientation is available at the new position
2407- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2408- const auto grid_x = grid_->gridX (xj);
2409- const auto grid_y = grid_->gridSnapDownY (yj);
2410- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2411- return false ;
2412- }
2413-
24142390 // Build the move list.
24152391 if (!addToMoveList (ndi, ndi->getLeft (), ndi->getBottom (), si, xj, yj, sj)) {
24162392 return false ;
@@ -2500,13 +2476,6 @@ bool DetailedMgr::tryMove2(Node* ndi,
25002476 if (!alignPos (ndi, xj, lx, rx)) {
25012477 return false ;
25022478 }
2503- // Check if the site orientation is available at the new position
2504- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2505- const auto grid_x = grid_->gridX (xj);
2506- const auto grid_y = grid_->gridSnapDownY (yj);
2507- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2508- return false ;
2509- }
25102479
25112480 if (!addToMoveList (ndi, ndi->getLeft (), ndi->getBottom (), si, xj, yj, sj)) {
25122481 return false ;
@@ -2526,13 +2495,6 @@ bool DetailedMgr::tryMove2(Node* ndi,
25262495 if (!alignPos (ndi, xj, lx, rx)) {
25272496 return false ;
25282497 }
2529- // Check if the site orientation is available at the new position
2530- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2531- const auto grid_x = grid_->gridX (xj);
2532- const auto grid_y = grid_->gridSnapDownY (yj);
2533- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2534- return false ;
2535- }
25362498
25372499 if (!addToMoveList (ndi, ndi->getLeft (), ndi->getBottom (), si, xj, yj, sj)) {
25382500 return false ;
@@ -2698,13 +2660,6 @@ bool DetailedMgr::tryMove3(Node* ndi,
26982660 // Check if the site orientation is available at the new position
26992661 const DbuX new_x = xj;
27002662 const DbuY new_y = arch_->getRow (rb)->getBottom ();
2701- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2702- const auto grid_x = grid_->gridX (new_x);
2703- const auto grid_y = grid_->gridSnapDownY (new_y);
2704- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2705- return false ;
2706- }
2707-
27082663 if (!addToMoveList (ndi,
27092664 ndi->getLeft (),
27102665 ndi->getBottom (),
@@ -2832,24 +2787,6 @@ bool DetailedMgr::trySwap1(Node* ndi,
28322787 const DbuX x2 = ndj->getLeft ();
28332788 const DbuY y2 = ndj->getBottom ();
28342789 // Build move list.
2835- // Check if the site orientation is available at the new positions
2836- {
2837- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2838- const auto grid_x = grid_->gridX (xj);
2839- const auto grid_y = grid_->gridSnapDownY (y2);
2840- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2841- return false ;
2842- }
2843- }
2844- {
2845- odb::dbSite* site = ndj->getDbInst ()->getMaster ()->getSite ();
2846- const auto grid_x = grid_->gridX (xi);
2847- const auto grid_y = grid_->gridSnapDownY (y1);
2848- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2849- return false ;
2850- }
2851- }
2852-
28532790 if (!addToMoveList (ndi, x1, y1, si, xj, y2, sj)) {
28542791 return false ;
28552792 }
@@ -2949,23 +2886,6 @@ bool DetailedMgr::trySwap1(Node* ndi,
29492886 const DbuX x2 = ndj->getLeft ();
29502887 const DbuY y2 = ndj->getBottom ();
29512888 // Build move list.
2952- // Check if the site orientation is available at the new positions
2953- {
2954- odb::dbSite* site = ndi->getDbInst ()->getMaster ()->getSite ();
2955- const auto grid_x = grid_->gridX (xj);
2956- const auto grid_y = grid_->gridSnapDownY (y2);
2957- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2958- return false ;
2959- }
2960- }
2961- {
2962- odb::dbSite* site = ndj->getDbInst ()->getMaster ()->getSite ();
2963- const auto grid_x = grid_->gridX (xi);
2964- const auto grid_y = grid_->gridSnapDownY (y1);
2965- if (!grid_->getSiteOrientation (grid_x, grid_y, site).has_value ()) {
2966- return false ;
2967- }
2968- }
29692889
29702890 if (!addToMoveList (ndi, x1, y1, si, xj, y2, sj)) {
29712891 return false ;
@@ -2999,6 +2919,10 @@ bool DetailedMgr::addToMoveList(Node* ndi,
29992919 return false ;
30002920 }
30012921
2922+ if (!checkSiteOrientation (ndi, newLeft, newBottom)) {
2923+ return false ;
2924+ }
2925+
30022926 // Easy to observe displacement limit if using the
30032927 // manager to compose a move list. We can check
30042928 // only here whether or not a cell will violate its
@@ -3040,6 +2964,11 @@ bool DetailedMgr::addToMoveList(Node* ndi,
30402964 if (journal_.size () >= moveLimit_) {
30412965 return false ;
30422966 }
2967+
2968+ if (!checkSiteOrientation (ndi, newLeft, newBottom)) {
2969+ return false ;
2970+ }
2971+
30432972 // commit move and add to journal
30442973 eraseFromGrid (ndi);
30452974 for (const auto & curSeg : curSegs) {
0 commit comments