Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dpl/include/dpl/Opendp.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class Opendp
GridY y,
GridX x_end,
GridY y_end) const;
bool checkMasterSym(unsigned masterSym, unsigned cellOri) const;
bool shiftMove(Node* cell);
bool mapMove(Node* cell);
bool mapMove(Node* cell, const GridPt& grid_pt);
Expand Down
43 changes: 43 additions & 0 deletions src/dpl/src/Place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "odb/dbTransform.h"
#include "odb/geom.h"
#include "util/journal.h"
#include "util/symmetry.h"
#include "utl/Logger.h"
// #define ODP_DEBUG

Expand All @@ -55,6 +56,7 @@ std::string Opendp::printBgBox(
queryBox.max_corner().x(),
queryBox.max_corner().y());
}

void Opendp::detailedPlacement()
{
if (debug_observer_) {
Expand Down Expand Up @@ -948,9 +950,50 @@ bool Opendp::checkPixels(const Node* cell,
}
}
const auto orient = grid_->getSiteOrientation(x, y, site).value();

// Check for symmetry
auto* dbMaster = cell->getDbInst()->getMaster();
unsigned masterSym = 0;
if (dbMaster->getSymmetryX()) {
masterSym |= Symmetry_X;
}
if (dbMaster->getSymmetryY()) {
masterSym |= Symmetry_Y;
}
if (dbMaster->getSymmetryR90()) {
masterSym |= Symmetry_ROT90;
}
if (!checkMasterSym(masterSym, orient)) {
return false;
}

return drc_engine_->checkDRC(cell, x, y, orient);
}

bool Opendp::checkMasterSym(unsigned masterSym, unsigned cellOri) const
{
using odb::dbOrientType;
switch (cellOri) {
case dbOrientType::R0:
return true;
case dbOrientType::MX:
return (masterSym & Symmetry_X) != 0;
case dbOrientType::MY:
return (masterSym & Symmetry_Y) != 0;
case dbOrientType::R180:
return (masterSym & Symmetry_X) && (masterSym & Symmetry_Y);
case dbOrientType::R90:
case dbOrientType::R270:
return (masterSym & Symmetry_ROT90) != 0;
case dbOrientType::MXR90:
case dbOrientType::MYR90:
return (masterSym & Symmetry_ROT90) && (masterSym & Symmetry_X)
&& (masterSym & Symmetry_Y);
default:
return false;
}
}

////////////////////////////////////////////////////////////////

// Legalize cell origin
Expand Down
55 changes: 55 additions & 0 deletions src/dpl/src/optimization/detailed_manager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,42 @@
#include "odb/dbTransform.h"
#include "odb/geom.h"
#include "util/journal.h"
#include "util/symmetry.h"
#include "util/utility.h"
#include "utl/Logger.h"

using utl::DPL;

namespace dpl {

// Helper to check if a cell's master allows the orientation required by the row
static bool checkMasterSymmetry(Architecture* arch, const Node* nd, int rowId)
{
const auto* rowPtr = arch->getRow(rowId);
const unsigned rowOri = rowPtr->getOrient();

auto* dbMaster = nd->getDbInst()->getMaster();
unsigned masterSym = 0;
if (dbMaster->getSymmetryX()) {
masterSym |= Symmetry_X;
}
if (dbMaster->getSymmetryY()) {
masterSym |= Symmetry_Y;
}
if (dbMaster->getSymmetryR90()) {
masterSym |= Symmetry_ROT90;
}

using odb::dbOrientType;
if (rowOri == dbOrientType::R0 || rowOri == dbOrientType::MY) {
return true;
}
if (rowOri == dbOrientType::MX || rowOri == dbOrientType::R180) {
return (masterSym & Symmetry_X) != 0;
}
return false;
}

DetailedMgr::DetailedMgr(Architecture* arch,
Network* network,
Grid* grid,
Expand Down Expand Up @@ -512,6 +541,9 @@ DetailedSeg* DetailedMgr::findClosestSegment(const Node* nd)
if (nd->getGroupId() != curr->getRegId()) {
continue;
}
if (!checkMasterSymmetry(arch_, nd, curr->getRowId())) {
continue;
}

// Work with left edge.
const DbuX x1 = curr->getMinX();
Expand Down Expand Up @@ -551,6 +583,9 @@ DetailedSeg* DetailedMgr::findClosestSegment(const Node* nd)
if (nd->getGroupId() != curr->getRegId()) {
continue;
}
if (!checkMasterSymmetry(arch_, nd, curr->getRowId())) {
continue;
}

// Work with left edge.
const DbuX x1 = curr->getMinX();
Expand Down Expand Up @@ -591,6 +626,9 @@ DetailedSeg* DetailedMgr::findClosestSegment(const Node* nd)
if (nd->getGroupId() != curr->getRegId()) {
continue;
}
if (!checkMasterSymmetry(arch_, nd, curr->getRowId())) {
continue;
}

// Work with left edge.
const DbuX x1 = curr->getMinX();
Expand Down Expand Up @@ -698,6 +736,10 @@ bool DetailedMgr::findClosestSpanOfSegments(Node* nd,
continue;
}

if (!checkMasterSymmetry(arch_, nd, r)) {
continue;
}

// Scan the segments in this row and look for segments in the required
// number of rows above and below that result in non-zero interval.
const int b = r;
Expand Down Expand Up @@ -2193,6 +2235,11 @@ bool DetailedMgr::tryMove(Node* ndi,
{
// Based on the input, call an appropriate routine to try
// and generate a move.
if (!checkMasterSymmetry(arch_, ndi, segments_[sj]->getRowId())) {
rejectMove();
return false;
}

if (arch_->getCellHeightInRows(ndi) == 1) {
// Single height cell.
if (si != sj) {
Expand Down Expand Up @@ -2227,6 +2274,10 @@ bool DetailedMgr::trySwap(Node* ndi,
const DbuY yj,
const int sj)
{
if (!checkMasterSymmetry(arch_, ndi, segments_[sj]->getRowId())) {
rejectMove();
return false;
}
if (trySwap1(ndi, xi, yi, si, xj, yj, sj)) {
return verifyMove();
}
Expand Down Expand Up @@ -2702,6 +2753,10 @@ bool DetailedMgr::trySwap1(Node* ndi,
if (ndj == ndi || ndj == nullptr) {
return false;
}
if (!checkMasterSymmetry(arch_, ndj, segments_[si]->getRowId())) {
return false;
}

if (arch_->getCellHeightInRows(ndi) != 1
|| arch_->getCellHeightInRows(ndj) != 1) {
return false;
Expand Down
Loading