Skip to content

Commit 43bdd40

Browse files
authored
Merge pull request #8614 from hzeller/feature-20251011-using-dborient
Don't pollute other namespace with `odb::dbOrientType`
2 parents 7b0ff44 + 0b1ae00 commit 43bdd40

File tree

21 files changed

+69
-55
lines changed

21 files changed

+69
-55
lines changed

src/dpl/src/DecapPlacement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void Opendp::insertDecapInPos(dbMaster* master,
211211
/* physical_only */ true);
212212
const GridX grid_x = grid_->gridX(pos_x - core_.xMin());
213213
const GridY grid_y = grid_->gridSnapDownY(pos_y - core_.yMin());
214-
const dbOrientType orient
214+
const odb::dbOrientType orient
215215
= grid_->getSiteOrientation(grid_x, grid_y, master->getSite()).value();
216216
inst->setOrient(orient);
217217
inst->setLocation(pos_x.v, pos_y.v);

src/dpl/src/PlacementDRC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ bool PlacementDRC::checkEdgeSpacing(const Node* cell) const
6969
bool PlacementDRC::checkEdgeSpacing(const Node* cell,
7070
const GridX x,
7171
const GridY y,
72-
const dbOrientType& orient) const
72+
const odb::dbOrientType& orient) const
7373
{
7474
if (!hasCellEdgeSpacingTable()) {
7575
return true;
@@ -184,7 +184,7 @@ bool PlacementDRC::checkDRC(const Node* cell) const
184184
bool PlacementDRC::checkDRC(const Node* cell,
185185
const GridX x,
186186
const GridY y,
187-
const dbOrientType& orient) const
187+
const odb::dbOrientType& orient) const
188188
{
189189
return checkEdgeSpacing(cell, x, y, orient) && checkPadding(cell, x, y)
190190
&& checkBlockedLayers(cell, x, y) && checkOneSiteGap(cell, x, y);

src/dpl/src/infrastructure/Grid.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ void Grid::initGrid(dbDatabase* db,
228228
markBlocked(block);
229229
}
230230

231-
std::pair<dbSite*, dbOrientType> Grid::getShortestSite(GridX grid_x,
232-
GridY grid_y)
231+
std::pair<dbSite*, odb::dbOrientType> Grid::getShortestSite(GridX grid_x,
232+
GridY grid_y)
233233
{
234234
dbSite* selected_site = nullptr;
235-
dbOrientType selected_orient;
235+
odb::dbOrientType selected_orient;
236236
DbuY min_height{std::numeric_limits<int>::max()};
237237

238238
const RowSitesMap& sites_map = row_sites_[grid_y.v];
@@ -252,9 +252,9 @@ std::pair<dbSite*, dbOrientType> Grid::getShortestSite(GridX grid_x,
252252
return {selected_site, selected_orient};
253253
}
254254

255-
std::optional<dbOrientType> Grid::getSiteOrientation(GridX x,
256-
GridY y,
257-
dbSite* site) const
255+
std::optional<odb::dbOrientType> Grid::getSiteOrientation(GridX x,
256+
GridY y,
257+
dbSite* site) const
258258
{
259259
const RowSitesMap& sites_map = row_sites_[y.v];
260260
auto interval_it = sites_map.find(x.v);

src/dpl/src/infrastructure/Grid.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
namespace dpl {
2424

25-
using odb::dbOrientType;
2625
using odb::dbSite;
2726

2827
struct GridIntervalX
@@ -137,10 +136,11 @@ class Grid
137136
Pixel& pixel(GridY y, GridX x) { return pixels_[y.v][x.v]; }
138137
const Pixel& pixel(GridY y, GridX x) const { return pixels_[y.v][x.v]; }
139138

140-
std::optional<dbOrientType> getSiteOrientation(GridX x,
141-
GridY y,
142-
dbSite* site) const;
143-
std::pair<dbSite*, dbOrientType> getShortestSite(GridX grid_x, GridY grid_y);
139+
std::optional<odb::dbOrientType> getSiteOrientation(GridX x,
140+
GridY y,
141+
dbSite* site) const;
142+
std::pair<dbSite*, odb::dbOrientType> getShortestSite(GridX grid_x,
143+
GridY grid_y);
144144

145145
void resize(int size) { pixels_.resize(size); }
146146
void resize(GridY size) { pixels_.resize(size.v); }
@@ -158,7 +158,7 @@ class Grid
158158

159159
private:
160160
// Maps a site to the right orientation to use in a given row
161-
using SiteToOrientation = std::map<dbSite*, dbOrientType>;
161+
using SiteToOrientation = std::map<dbSite*, odb::dbOrientType>;
162162

163163
// Used to combine the SiteToOrientation for two intervals when merged
164164
template <typename MapType>

src/dpl/src/infrastructure/Objects.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ dbBTerm* Node::getBTerm() const
144144
}
145145
return static_cast<dbBTerm*>(db_owner_);
146146
}
147-
dbOrientType Node::getOrient() const
147+
odb::dbOrientType Node::getOrient() const
148148
{
149149
return orient_;
150150
}
@@ -298,7 +298,7 @@ void Node::setBottom(DbuY y)
298298
{
299299
bottom_ = y;
300300
}
301-
void Node::setOrient(const dbOrientType& in)
301+
void Node::setOrient(const odb::dbOrientType& in)
302302
{
303303
orient_ = in;
304304
}
@@ -362,8 +362,10 @@ void Node::addUsedLayer(int layer)
362362
{
363363
used_layers_ |= 1 << layer;
364364
}
365-
bool Node::adjustCurrOrient(const dbOrientType& newOri)
365+
bool Node::adjustCurrOrient(const odb::dbOrientType& newOri)
366366
{
367+
using odb::dbOrientType;
368+
367369
// Change the orientation of the cell, but leave the lower-left corner
368370
// alone. This means changing the locations of pins and possibly
369371
// changing the edge types as well as the height and width.

src/dpl/src/infrastructure/Objects.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ class dbBox;
1616
class dbBTerm;
1717
class dbInst;
1818
class dbMaster;
19-
class dbOrientType;
2019
class dbSite;
2120
} // namespace odb
2221
namespace dpl {
2322

2423
using odb::dbBTerm;
2524
using odb::dbInst;
2625
using odb::dbMaster;
27-
using odb::dbOrientType;
2826
using odb::dbSite;
2927

3028
class MasterEdge
@@ -92,7 +90,7 @@ class Node
9290
DbuX getCenterX() const;
9391
DbuY getCenterY() const;
9492
dbInst* getDbInst() const;
95-
dbOrientType getOrient() const;
93+
odb::dbOrientType getOrient() const;
9694
bool isFixed() const;
9795
bool isPlaced() const;
9896
bool isHold() const;
@@ -127,7 +125,7 @@ class Node
127125
void setBTerm(dbBTerm* term);
128126
void setLeft(DbuX x);
129127
void setBottom(DbuY y);
130-
void setOrient(const dbOrientType& in);
128+
void setOrient(const odb::dbOrientType& in);
131129
void setWidth(DbuX width);
132130
void setHeight(DbuY height);
133131
void setPlaced(bool in);
@@ -144,15 +142,15 @@ class Node
144142
void setGroupId(int id);
145143
void addUsedLayer(int layer);
146144

147-
bool adjustCurrOrient(const dbOrientType& newOrient);
145+
bool adjustCurrOrient(const odb::dbOrientType& newOrient);
148146

149147
protected:
150148
int id_{0};
151149
void* db_owner_{nullptr};
152150
// Current position; bottom corner.
153151
DbuX left_{0};
154152
DbuY bottom_{0};
155-
dbOrientType orient_;
153+
odb::dbOrientType orient_;
156154
// Original position.
157155
DbuX orig_left_{0};
158156
DbuY orig_bottom_{0};

src/dpl/src/infrastructure/network.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class Pin;
2626
class Grid;
2727
class Edge;
2828
class PlacementDRC;
29-
using odb::dbOrientType;
3029

3130
class Network
3231
{

src/dpl/src/optimization/detailed_orient.cxx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "detailed_manager.h"
1515
#include "infrastructure/architecture.h"
1616
#include "infrastructure/detailed_segment.h"
17+
#include "odb/dbTypes.h"
1718
#include "util/symmetry.h"
1819
#include "util/utility.h"
1920
#include "utl/Logger.h"
@@ -153,6 +154,8 @@ int DetailedOrient::orientCells(int& changed)
153154
////////////////////////////////////////////////////////////////////////////////
154155
bool DetailedOrient::orientMultiHeightCellForRow(Node* ndi, int row)
155156
{
157+
using odb::dbOrientType;
158+
156159
// Takes a multi height cell and fixes its orientation so
157160
// that it is correct/agrees with the power stripes.
158161
// Return true is orientation is okay, otherwise false to
@@ -211,8 +214,10 @@ bool DetailedOrient::orientSingleHeightCellForRow(Node* ndi, int row)
211214
return false;
212215
}
213216

214-
unsigned rowOri = arch_->getRow(row)->getOrient();
215-
unsigned cellOri = ndi->getOrient();
217+
const unsigned rowOri = arch_->getRow(row)->getOrient();
218+
const unsigned cellOri = ndi->getOrient();
219+
220+
using odb::dbOrientType;
216221

217222
if (rowOri == dbOrientType::R0 || rowOri == dbOrientType::MY) {
218223
if (cellOri == dbOrientType::R0 || cellOri == dbOrientType::MY) {
@@ -346,6 +351,7 @@ int DetailedOrient::flipCells()
346351
|| ndi->getRight() + leftPadding > rx) {
347352
continue;
348353
}
354+
using odb::dbOrientType;
349355
dbOrientType orig_orient = ndi->getOrient();
350356
dbOrientType flipped_orient;
351357
switch (orig_orient) {
@@ -402,8 +408,10 @@ unsigned DetailedOrient::orientFind(Node* ndi, int row)
402408
// orientation, but this might be a little smarter if cells have been flipped
403409
// around the Y-axis previously to improve WL...
404410

405-
unsigned rowOri = arch_->getRow(row)->getOrient();
406-
unsigned cellOri = ndi->getOrient();
411+
const unsigned rowOri = arch_->getRow(row)->getOrient();
412+
const unsigned cellOri = ndi->getOrient();
413+
414+
using odb::dbOrientType;
407415

408416
if (rowOri == dbOrientType::R0 || rowOri == dbOrientType::MY) {
409417
if (cellOri == dbOrientType::R0 || cellOri == dbOrientType::MY) {
@@ -435,6 +443,7 @@ bool DetailedOrient::isLegalSym(unsigned rowOri,
435443
unsigned siteSym,
436444
unsigned cellOri)
437445
{
446+
using odb::dbOrientType;
438447
// Messy...
439448
if (siteSym == Symmetry_Y) {
440449
if (rowOri == dbOrientType::R0) {

src/drt/src/db/drObj/drRef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ class drRef : public drPinFig
1414
{
1515
public:
1616
// getters
17-
virtual dbOrientType getOrient() const = 0;
17+
virtual odb::dbOrientType getOrient() const = 0;
1818
virtual odb::Point getOrigin() const = 0;
1919
virtual odb::dbTransform getTransform() const = 0;
2020
// setters
21-
virtual void setOrient(const dbOrientType& tmpOrient) = 0;
21+
virtual void setOrient(const odb::dbOrientType& tmpOrient) = 0;
2222
virtual void setOrigin(const odb::Point& tmpPoint) = 0;
2323
virtual void setTransform(const odb::dbTransform& xform) = 0;
2424

src/drt/src/db/drObj/drVia.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "db/tech/frViaDef.h"
1111
#include "dr/FlexMazeTypes.h"
1212
#include "frBaseTypes.h"
13+
#include "odb/dbTypes.h"
1314
#include "odb/geom.h"
1415

1516
namespace drt {
@@ -71,8 +72,8 @@ class drVia : public drRef
7172
* setTransform
7273
*/
7374

74-
dbOrientType getOrient() const override { return dbOrientType(); }
75-
void setOrient(const dbOrientType& tmpOrient) override { ; }
75+
odb::dbOrientType getOrient() const override { return odb::dbOrientType(); }
76+
void setOrient(const odb::dbOrientType& tmpOrient) override { ; }
7677
odb::Point getOrigin() const override { return origin_; }
7778
void setOrigin(const odb::Point& tmpPoint) override { origin_ = tmpPoint; }
7879
odb::dbTransform getTransform() const override

0 commit comments

Comments
 (0)