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
54 changes: 0 additions & 54 deletions src/dpl/include/dpl/Opendp.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,58 +121,6 @@ struct Cell
Rect *region_; // group rect
};

struct Cell
{
Cell();
const char *name() const;
bool inGroup() const { return group_ != nullptr; }
int64_t area() const;

dbInst *db_inst_;
int x_, y_; // lower left wrt core DBU
dbOrientType orient_;
int width_, height_; // DBU
bool is_placed_;
bool hold_;
Group *group_;
Rect *region_; // group rect
};

//access points
struct AccessP
{
AccessP();

int x, y;
};

struct Pin_RPA
{
Pin_RPA();

int x_min;
vector<dpl::AccessP> xAPs;
vector<dpl::AccessP> yAPs;
};

struct Cell_RPA
{
Cell_RPA();
const char *name_RPA() const;
bool inGroup_RPA() const { return group_ != nullptr; }
int64_t area_RPA() const;

dbInst *db_inst_;
int x_, y_; // lower left wrt core DBU
dbOrientType orient_;
int width_, height_; // DBU
bool is_placed_;
bool hold_;
Group *group_;
Rect *region_; // group rect
vector<dpl::Pin_RPA> pins;
};

struct Group
{
Group();
Expand Down Expand Up @@ -259,7 +207,6 @@ class Opendp
// max_displacment is in sites. use zero for defaults.
void detailedPlacement(int max_displacement_x,
int max_displacement_y);
void GenerateAP();
void reportLegalizationStats() const;
void setPaddingGlobal(int left, int right);
void setPadding(dbMaster *inst,
Expand Down Expand Up @@ -513,7 +460,6 @@ class Opendp
MasterPaddingMap master_padding_map_;

vector<Cell> cells_;
vector<Cell_RPA> cell_rpas_;
vector<Group> groups_;

map<const dbMaster *, Macro> db_master_map_;
Expand Down
147 changes: 1 addition & 146 deletions src/dpl/src/Opendp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ comparator3(const dpRow *lhs, const dpRow *rhs);

static bool
comparator2(const Cell *lhs, const Cell *rhs);

static bool
comparator6(const Pin_RPA lhs, const Pin_RPA rhs);

static bool
comparator4(const AccessP lhs, const AccessP rhs);

static bool
comparator5(const AccessP lhs, const AccessP rhs);

move::move(int64_t movementt, int64_t deltaa, bool flipp) :
movement(movementt),
Expand Down Expand Up @@ -151,55 +142,8 @@ dpRow::dpRow(int x, int y) :
y_(y)
{
}

Cell_RPA::Cell_RPA() :
db_inst_(nullptr),
x_(0),
y_(0),
width_(0),
height_(0),
is_placed_(false),
hold_(false),
group_(nullptr),
region_(nullptr)
{
}

const char *
Cell_RPA::name_RPA() const
{
return db_inst_->getConstName();
}

int64_t
Cell_RPA::area_RPA() const
{
dbMaster *master = db_inst_->getMaster();
return master->getWidth() * master->getHeight();
}

Pin_RPA::Pin_RPA()
{
}

AccessP::AccessP()
{
}

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

static bool comparator6(const Pin_RPA lhs, const Pin_RPA rhs) {
return lhs.x_min < rhs.x_min;
}

static bool comparator4(const AccessP lhs, const AccessP rhs) {
return lhs.x < rhs.x;
}

static bool comparator5(const AccessP lhs, const AccessP rhs) {
return lhs.y < rhs.y;
}

bool
Opendp::isFixed(const Cell *cell) const
{
Expand Down Expand Up @@ -256,7 +200,7 @@ void
Opendp::initBlock()
{
block_ = db_->getChip()->getBlock();
block_->getCoreArea(core_);
core_ = ord::getCore(block_);
}

void
Expand Down Expand Up @@ -303,82 +247,6 @@ Opendp::setDebug(bool displacement,
}
}

/*
Cell_RPA -> inst
-> pins
pins -> shape -> APS
*/
void
Opendp::GenerateAP()
{
for(Cell_RPA cell: cell_rpas_)
{
odb::dbMaster *master = cell.db_inst_->getMaster();
for ( dbMTerm *mterm: master->getMTerms()) {
if ( mterm->getSigType().isSupply())
continue;
for ( dbMPin *mpin: mterm->getMPins()) {
odb::dbSet<odb::dbBox> pinshapes = mpin->getGeometry();
odb::Rect pinbox = mpin->getBBox();
Pin_RPA newPin;
newPin.mpin = mpin;
newPin.x_min = pinbox.xMin();
for ( odb::dbBox *pinshape: pinshapes) {
odb::dbTechLayer* pinLayer = pinshape->getTechLayer();
//string layerName = pinLayer->getName();
odb::dbTechLayerType lType = pinLayer->getType();
//int nx = 0, ny = 0;
if ( lType == odb::dbTechLayerType::Value::ROUTING) {
odb::dbTrackGrid *tmpGrid = block_->findTrackGrid(pinLayer);
//nx = tmpGrid->getNumGridPatternsX();
//std::map<odb::dbTechLayerType,vector<pair<int,int>>> APsOFLayers;
vector<int> xgrid, ygrid;
//vector<pair<int,int>> APs;
tmpGrid->getGridX(xgrid);
tmpGrid->getGridY(ygrid);
//check if the shape is vertical or horizontal
if((pinshape->xMax() - pinshape->xMax()) < (pinshape->yMax() - pinshape->yMax()))
{
for(int y: ygrid)
{
int x = (pinshape->xMax() - pinshape->xMax())/2;
AccessP ap;
ap.x = x;
ap.y = y;
newPin.xAPs.push_back(ap);
newPin.yAPs.push_back(ap);
}
}
else
{
for(int x: xgrid)
{
int y = (pinshape->yMax() - pinshape->yMax())/2;
AccessP ap;
ap.x = x;
ap.y = y;
newPin.xAPs.push_back(ap);
newPin.yAPs.push_back(ap);
}
}
//ny = tmpGrid->getNumGridPatternsY();
//odb::dbTechLayerDir tmpDirection = pinLayer->getDirection();
//nx = xgrid.size();
//ny = ygrid.size();
}
//logger_->report("Layer Name: {:s} X:{:d} Y:{:d}",layerName, nx, ny);
}
//After adding all the APS from each shape, sort them
sort(newPin.xAPs.begin(), newPin.xAPs.end(), &comparator4);
sort(newPin.yAPs.begin(), newPin.yAPs.end(), &comparator5);
cell.pins.push_back(newPin);
}
}
//after adding all the pins
sort(cell.pins.begin(), cell.pins.end(), &comparator6);
}
}

void
Opendp::detailedPlacement(int max_displacement_x,
int max_displacement_y)
Expand All @@ -398,19 +266,6 @@ Opendp::detailedPlacement(int max_displacement_x,
reportImportWarnings();
hpwl_before_ = hpwl();
detailedPlacement();
GenerateAP();
for(Cell_RPA cell: cell_rpas_)
{
logger_->report("Cell name : {:s}", cell.db_inst_->getName());
for(Pin_RPA pin: cell.pins)
{
logger_->report("Pin name : {:s}, PA count : {:u}", pin.mpin->getMTerm()->getName(), pin.xAPs.size());
for(AccessP ap: pin.xAPs)
{
logger_->report("Access point x : {:u}, y : {:u}", ap.x, ap.y);
}
}
}
// Save displacement stats before updating instance DB locations.
findDisplacementStats();
updateDbInstLocations();
Expand Down
6 changes: 4 additions & 2 deletions src/dpl/src/Place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include "Graphics.h"
#include "utl/Logger.h"
#include "ord/OpenRoad.hh"

//#define ODP_DEBUG

Expand All @@ -59,6 +60,7 @@ using std::sort;
using std::string;
using std::vector;

using ord::closestPtInRect;
using utl::DPL;

static bool
Expand Down Expand Up @@ -711,8 +713,8 @@ Opendp::diamondSearch(const Cell *cell,
divCeil(group->boundary.yMin(), row_height_),
group->boundary.xMax() / site_width_,
group->boundary.yMax() / row_height_);
Point min = grid_boundary.closestPtInside(Point(x_min, y_min));
Point max = grid_boundary.closestPtInside(Point(x_max, y_max));
Point min = closestPtInRect(grid_boundary, x_min, y_min);
Point max = closestPtInRect(grid_boundary, x_max, y_max);
x_min = min .getX();
y_min = min .getY();
x_max = max.getX();
Expand Down
17 changes: 2 additions & 15 deletions src/dpl/src/dbToOpendp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <limits>

#include "utl/Logger.h"
#include "ord/OpenRoad.hh"

namespace dpl {

Expand Down Expand Up @@ -69,7 +70,7 @@ void
Opendp::importDb()
{
block_ = db_->getChip()->getBlock();
block_->getCoreArea(core_);
core_ = ord::getCore(block_);

importClear();
examineRows();
Expand Down Expand Up @@ -183,7 +184,6 @@ Opendp::makeCells()
{
auto db_insts = block_->getInsts();
cells_.reserve(db_insts.size());
cell_rpas_.reserve(db_insts.size());
for (auto db_inst : db_insts) {
dbMaster *master = db_inst->getMaster();
if (master->isCoreAutoPlaceable()) {
Expand All @@ -192,11 +192,6 @@ Opendp::makeCells()
cell.db_inst_ = db_inst;
db_inst_map_[db_inst] = &cell;

//FOR OUR RPA
cell_rpas_.push_back(Cell_RPA());
Cell_RPA &cell1 = cell_rpas_.back();
cell1.db_inst_ = db_inst;

Rect bbox = getBbox(db_inst);
cell.width_ = bbox.dx();
cell.height_ = bbox.dy();
Expand All @@ -205,14 +200,6 @@ Opendp::makeCells()
cell.orient_ = db_inst->getOrient();
cell.is_placed_ = isFixed(&cell);

//FOR OUR RPA
cell1.width_ = bbox.dx();
cell1.height_ = bbox.dy();
cell1.x_ = bbox.xMin();
cell1.y_ = bbox.yMin();
cell1.orient_ = db_inst->getOrient();
cell1.is_placed_ = isFixed(&cell);

Macro &macro = db_master_map_[master];
if (macro.is_multi_row_)
have_multi_row_cells_ = true;
Expand Down