diff --git a/src/dpl/include/dpl/Opendp.h b/src/dpl/include/dpl/Opendp.h index c60c35664..d5fa2d636 100644 --- a/src/dpl/include/dpl/Opendp.h +++ b/src/dpl/include/dpl/Opendp.h @@ -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 xAPs; - vector 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 pins; -}; - struct Group { Group(); @@ -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, @@ -513,7 +460,6 @@ class Opendp MasterPaddingMap master_padding_map_; vector cells_; - vector cell_rpas_; vector groups_; map db_master_map_; diff --git a/src/dpl/src/Opendp.cpp b/src/dpl/src/Opendp.cpp index 03bc67564..66c05b19a 100644 --- a/src/dpl/src/Opendp.cpp +++ b/src/dpl/src/Opendp.cpp @@ -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), @@ -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 { @@ -256,7 +200,7 @@ void Opendp::initBlock() { block_ = db_->getChip()->getBlock(); - block_->getCoreArea(core_); + core_ = ord::getCore(block_); } void @@ -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 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>> APsOFLayers; - vector xgrid, ygrid; - //vector> 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) @@ -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(); diff --git a/src/dpl/src/Place.cpp b/src/dpl/src/Place.cpp index b227ce966..b1c43a773 100644 --- a/src/dpl/src/Place.cpp +++ b/src/dpl/src/Place.cpp @@ -46,6 +46,7 @@ #include "Graphics.h" #include "utl/Logger.h" +#include "ord/OpenRoad.hh" //#define ODP_DEBUG @@ -59,6 +60,7 @@ using std::sort; using std::string; using std::vector; +using ord::closestPtInRect; using utl::DPL; static bool @@ -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(); diff --git a/src/dpl/src/dbToOpendp.cpp b/src/dpl/src/dbToOpendp.cpp index 34dcd2401..959aef5e6 100644 --- a/src/dpl/src/dbToOpendp.cpp +++ b/src/dpl/src/dbToOpendp.cpp @@ -39,6 +39,7 @@ #include #include "utl/Logger.h" +#include "ord/OpenRoad.hh" namespace dpl { @@ -69,7 +70,7 @@ void Opendp::importDb() { block_ = db_->getChip()->getBlock(); - block_->getCoreArea(core_); + core_ = ord::getCore(block_); importClear(); examineRows(); @@ -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()) { @@ -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(); @@ -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 ¯o = db_master_map_[master]; if (macro.is_multi_row_) have_multi_row_cells_ = true;