Skip to content

Commit a7d947e

Browse files
Fix: adjustments in detailed_manager.cxx
Signed-off-by: Jorge Ferreira <[email protected]>
1 parent 54e7b7c commit a7d947e

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

src/dpl/src/optimization/detailed_manager.cxx

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,6 +2297,14 @@ bool DetailedMgr::tryMove1(Node* ndi,
22972297
if (!alignPos(ndi, xj, lx, rx)) {
22982298
return false;
22992299
}
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+
23002308
// Build the move list.
23012309
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
23022310
return false;
@@ -2322,6 +2330,14 @@ bool DetailedMgr::tryMove1(Node* ndi,
23222330
return false;
23232331
}
23242332

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+
23252341
// Build the move list.
23262342
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
23272343
return false;
@@ -2351,6 +2367,14 @@ bool DetailedMgr::tryMove1(Node* ndi,
23512367
return false;
23522368
}
23532369

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+
23542378
// Build the move list.
23552379
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
23562380
return false;
@@ -2379,6 +2403,14 @@ bool DetailedMgr::tryMove1(Node* ndi,
23792403
return false;
23802404
}
23812405

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+
23822414
// Build the move list.
23832415
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
23842416
return false;
@@ -2468,6 +2500,14 @@ bool DetailedMgr::tryMove2(Node* ndi,
24682500
if (!alignPos(ndi, xj, lx, rx)) {
24692501
return false;
24702502
}
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+
}
2510+
24712511
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
24722512
return false;
24732513
}
@@ -2486,6 +2526,14 @@ bool DetailedMgr::tryMove2(Node* ndi,
24862526
if (!alignPos(ndi, xj, lx, rx)) {
24872527
return false;
24882528
}
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+
}
2536+
24892537
if (!addToMoveList(ndi, ndi->getLeft(), ndi->getBottom(), si, xj, yj, sj)) {
24902538
return false;
24912539
}
@@ -2647,6 +2695,16 @@ bool DetailedMgr::tryMove3(Node* ndi,
26472695
old_segs.push_back(seg->getSegId());
26482696
}
26492697

2698+
// Check if the site orientation is available at the new position
2699+
const DbuX new_x = xj;
2700+
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+
26502708
if (!addToMoveList(ndi,
26512709
ndi->getLeft(),
26522710
ndi->getBottom(),
@@ -2774,6 +2832,24 @@ bool DetailedMgr::trySwap1(Node* ndi,
27742832
const DbuX x2 = ndj->getLeft();
27752833
const DbuY y2 = ndj->getBottom();
27762834
// 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+
27772853
if (!addToMoveList(ndi, x1, y1, si, xj, y2, sj)) {
27782854
return false;
27792855
}
@@ -2873,6 +2949,24 @@ bool DetailedMgr::trySwap1(Node* ndi,
28732949
const DbuX x2 = ndj->getLeft();
28742950
const DbuY y2 = ndj->getBottom();
28752951
// 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+
}
2969+
28762970
if (!addToMoveList(ndi, x1, y1, si, xj, y2, sj)) {
28772971
return false;
28782972
}
@@ -2989,6 +3083,7 @@ void DetailedMgr::paintInGrid(Node* node)
29893083
const auto grid_x = grid_->gridX(node);
29903084
const auto grid_y = grid_->gridSnapDownY(node);
29913085
odb::dbSite* site = node->getDbInst()->getMaster()->getSite();
3086+
29923087
const auto orientation
29933088
= grid_->getSiteOrientation(grid_x, grid_y, site).value();
29943089
grid_->paintPixel(node, grid_x, grid_y);

0 commit comments

Comments
 (0)