Skip to content

Commit ab5c772

Browse files
committed
Merge remote-tracking branch 'origin/master' into dpl-bzl-fixes
Signed-off-by: Matt Liberty <[email protected]>
2 parents e62d9d9 + 9a0e3df commit ab5c772

File tree

236 files changed

+74095
-758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+74095
-758
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Checks: >
88
-clang-analyzer-cplusplus.NewDeleteLeaks,
99
-clang-analyzer-optin.performance.Padding,
1010
readability-*,
11-
-readability-identifier-naming
11+
-readability-identifier-naming,
1212
-readability-braces-around-statements,
1313
-readability-convert-member-functions-to-static,
1414
-readability-function-cognitive-complexity,

src/dpl/include/dpl/Opendp.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ namespace dpl {
2929

3030
using utl::Logger;
3131

32-
using odb::dbBlock;
3332
using odb::dbDatabase;
34-
using odb::dbInst;
3533
using odb::dbMaster;
3634
using odb::dbMasterType;
3735
using odb::dbTechLayer;
38-
using odb::Point;
3936

4037
class Node;
4138
class Group;
@@ -93,8 +90,8 @@ class Opendp
9390
Opendp(const Opendp&) = delete;
9491
Opendp& operator=(const Opendp&) = delete;
9592

96-
void legalCellPos(dbInst* db_inst); // call from rsz
97-
void initMacrosAndGrid(); // call from rsz
93+
void legalCellPos(odb::dbInst* db_inst); // call from rsz
94+
void initMacrosAndGrid(); // call from rsz
9895

9996
// legalize/report
10097
// max_displacment is in sites. use zero for defaults.
@@ -105,15 +102,15 @@ class Opendp
105102

106103
void setPaddingGlobal(int left, int right);
107104
void setPadding(dbMaster* master, int left, int right);
108-
void setPadding(dbInst* inst, int left, int right);
105+
void setPadding(odb::dbInst* inst, int left, int right);
109106
void setDebug(std::unique_ptr<dpl::DplObserver>& observer);
110107

111108
// Global padding.
112109
int padGlobalLeft() const;
113110
int padGlobalRight() const;
114111
// Find instance/master/global padding value for an instance.
115-
int padLeft(dbInst* inst) const;
116-
int padRight(dbInst* inst) const;
112+
int padLeft(odb::dbInst* inst) const;
113+
int padRight(odb::dbInst* inst) const;
117114

118115
void checkPlacement(bool verbose, const std::string& report_file_name = "");
119116
void fillerPlacement(const dbMasterSeq& filler_masters,
@@ -127,10 +124,11 @@ class Opendp
127124
void insertDecapCells(double target, IRDropByPoint& psm_ir_drops);
128125

129126
// Get the instance adjacent to the left or right of a given instance
130-
dbInst* getAdjacentInstance(dbInst* inst, bool left) const;
127+
odb::dbInst* getAdjacentInstance(odb::dbInst* inst, bool left) const;
131128

132129
// Find a cluster of instances that are touching each other
133-
std::vector<dbInst*> getAdjacentInstancesCluster(dbInst* inst) const;
130+
std::vector<odb::dbInst*> getAdjacentInstancesCluster(
131+
odb::dbInst* inst) const;
134132
Padding* getPadding() { return padding_.get(); }
135133
void improvePlacement(int seed,
136134
int max_displacement_x,
@@ -160,14 +158,14 @@ class Opendp
160158
friend class Graphics;
161159
void findDisplacementStats();
162160
DbuPt pointOffMacro(const Node& cell);
163-
void convertDbToCell(dbInst* db_inst, Node& cell);
161+
void convertDbToCell(odb::dbInst* db_inst, Node& cell);
164162
// Return error count.
165163
void saveViolations(const std::vector<Node*>& failures,
166164
odb::dbMarkerCategory* category,
167165
const std::string& violation_type = "") const;
168166
void importDb();
169167
void importClear();
170-
odb::Rect getBbox(dbInst* inst);
168+
odb::Rect getBbox(odb::dbInst* inst);
171169
void createNetwork();
172170
void createArchitecture();
173171
void setUpPlacementGroups();
@@ -312,7 +310,7 @@ class Opendp
312310

313311
Logger* logger_ = nullptr;
314312
dbDatabase* db_ = nullptr;
315-
dbBlock* block_ = nullptr;
313+
odb::dbBlock* block_ = nullptr;
316314
odb::Rect core_;
317315

318316
std::unique_ptr<Architecture> arch_; // Information about rows, etc.

src/dpl/include/dpl/OptMirror.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class Logger;
1616

1717
namespace dpl {
1818

19-
using odb::dbInst;
2019
using odb::dbNet;
2120

2221
using utl::Logger;
@@ -53,15 +52,15 @@ class OptimizeMirroring
5352
void run();
5453

5554
private:
56-
int mirrorCandidates(std::vector<dbInst*>& mirror_candidates);
55+
int mirrorCandidates(std::vector<odb::dbInst*>& mirror_candidates);
5756
void findNetBoxes();
58-
std::vector<dbInst*> findMirrorCandidates(NetBoxes& net_boxes);
57+
std::vector<odb::dbInst*> findMirrorCandidates(NetBoxes& net_boxes);
5958

60-
void updateNetBoxes(dbInst* inst);
61-
void saveNetBoxes(dbInst* inst);
62-
void restoreNetBoxes(dbInst* inst);
59+
void updateNetBoxes(odb::dbInst* inst);
60+
void saveNetBoxes(odb::dbInst* inst);
61+
void restoreNetBoxes(odb::dbInst* inst);
6362

64-
int64_t hpwl(dbInst* inst); // Sum of ITerm hpwl's.
63+
int64_t hpwl(odb::dbInst* inst); // Sum of ITerm hpwl's.
6564

6665
Logger* logger_ = nullptr;
6766
odb::dbDatabase* db_ = nullptr;

src/dpl/src/DecapPlacement.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ void Opendp::insertDecapInPos(dbMaster* master,
205205
{
206206
// insert decap inst
207207
std::string inst_name = "DECAP_" + to_string(decap_count_);
208-
dbInst* inst = dbInst::create(block_,
209-
master,
210-
inst_name.c_str(),
211-
/* physical_only */ true);
208+
odb::dbInst* inst = odb::dbInst::create(block_,
209+
master,
210+
inst_name.c_str(),
211+
/* 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/FillerPlacement.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ void Opendp::placeRowFillers(GridY row,
216216
for (dbMaster* master : fillers) {
217217
std::string inst_name
218218
= prefix + to_string(row.v) + "_" + to_string(k.v);
219-
dbInst* inst = dbInst::create(block_,
220-
master,
221-
inst_name.c_str(),
222-
/* physical_only */ true);
219+
odb::dbInst* inst = odb::dbInst::create(block_,
220+
master,
221+
inst_name.c_str(),
222+
/* physical_only */ true);
223223
DbuX x{core_.xMin() + gridToDbu(k, site_width)};
224224
DbuY y{core_.yMin() + grid_->gridYToDbu(row)};
225225
inst->setOrient(orient);
@@ -292,15 +292,15 @@ dbMasterSeq& Opendp::gapFillers(
292292
void Opendp::removeFillers()
293293
{
294294
block_ = db_->getChip()->getBlock();
295-
for (dbInst* db_inst : block_->getInsts()) {
295+
for (odb::dbInst* db_inst : block_->getInsts()) {
296296
if (isFiller(db_inst)) {
297297
odb::dbInst::destroy(db_inst);
298298
}
299299
}
300300
}
301301

302302
/* static */
303-
bool Opendp::isFiller(dbInst* db_inst)
303+
bool Opendp::isFiller(odb::dbInst* db_inst)
304304
{
305305
dbMaster* db_master = db_inst->getMaster();
306306
return db_master->getType() == odb::dbMasterType::CORE_SPACER

src/dpl/src/Opendp.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "boost/geometry/geometry.hpp"
1818
#include "dpl/OptMirror.h"
1919
#include "graphics/DplObserver.h"
20+
#include "infrastructure/Coordinates.h"
2021
#include "infrastructure/Grid.h"
2122
#include "infrastructure/Objects.h"
2223
#include "infrastructure/Padding.h"
@@ -32,6 +33,7 @@ using std::string;
3233

3334
using utl::DPL;
3435

36+
using odb::dbInst;
3537
using odb::Rect;
3638

3739
////////////////////////////////////////////////////////////////
@@ -61,7 +63,7 @@ void Opendp::setPaddingGlobal(const int left, const int right)
6163
padding_->setPaddingGlobal(GridX{left}, GridX{right});
6264
}
6365

64-
void Opendp::setPadding(dbInst* inst, const int left, const int right)
66+
void Opendp::setPadding(odb::dbInst* inst, const int left, const int right)
6567
{
6668
padding_->setPadding(inst, GridX{left}, GridX{right});
6769
}
@@ -138,7 +140,7 @@ void Opendp::updateDbInstLocations()
138140
{
139141
for (auto& cell : network_->getNodes()) {
140142
if (!cell->isFixed() && cell->isStdCell()) {
141-
dbInst* db_inst_ = cell->getDbInst();
143+
odb::dbInst* db_inst_ = cell->getDbInst();
142144
// Only move the instance if necessary to avoid triggering callbacks.
143145
if (db_inst_->getOrient() != cell->getOrient()) {
144146
db_inst_->setOrient(cell->getOrient());
@@ -234,12 +236,12 @@ int Opendp::padGlobalRight() const
234236
return padding_->padGlobalRight().v;
235237
}
236238

237-
int Opendp::padLeft(dbInst* inst) const
239+
int Opendp::padLeft(odb::dbInst* inst) const
238240
{
239241
return padding_->padLeft(inst).v;
240242
}
241243

242-
int Opendp::padRight(dbInst* inst) const
244+
int Opendp::padRight(odb::dbInst* inst) const
243245
{
244246
return padding_->padRight(inst).v;
245247
}
@@ -353,7 +355,7 @@ void Opendp::groupInitPixels2()
353355
}
354356
}
355357

356-
dbInst* Opendp::getAdjacentInstance(dbInst* inst, bool left) const
358+
odb::dbInst* Opendp::getAdjacentInstance(odb::dbInst* inst, bool left) const
357359
{
358360
const Rect inst_rect = inst->getBBox()->getBox();
359361
DbuX x_dbu = left ? DbuX{inst_rect.xMin() - 1} : DbuX{inst_rect.xMax() + 1};
@@ -364,7 +366,7 @@ dbInst* Opendp::getAdjacentInstance(dbInst* inst, bool left) const
364366

365367
Pixel* pixel = grid_->gridPixel(x, y);
366368

367-
dbInst* adjacent_inst = nullptr;
369+
odb::dbInst* adjacent_inst = nullptr;
368370

369371
// do not return macros, endcaps and tapcells
370372
if (pixel != nullptr && pixel->cell && pixel->cell->getDbInst()->isCore()) {
@@ -378,9 +380,9 @@ std::vector<dbInst*> Opendp::getAdjacentInstancesCluster(dbInst* inst) const
378380
{
379381
const bool left = true;
380382
const bool right = false;
381-
std::vector<dbInst*> adj_inst_cluster;
383+
std::vector<odb::dbInst*> adj_inst_cluster;
382384

383-
dbInst* left_inst = getAdjacentInstance(inst, left);
385+
odb::dbInst* left_inst = getAdjacentInstance(inst, left);
384386
while (left_inst != nullptr) {
385387
adj_inst_cluster.push_back(left_inst);
386388
// the right instance can be ignored, since it was added in the line above
@@ -390,7 +392,7 @@ std::vector<dbInst*> Opendp::getAdjacentInstancesCluster(dbInst* inst) const
390392
std::reverse(adj_inst_cluster.begin(), adj_inst_cluster.end());
391393
adj_inst_cluster.push_back(inst);
392394

393-
dbInst* right_inst = getAdjacentInstance(inst, right);
395+
odb::dbInst* right_inst = getAdjacentInstance(inst, right);
394396
while (right_inst != nullptr) {
395397
adj_inst_cluster.push_back(right_inst);
396398
// the left instance can be ignored, since it was added in the line above

src/dpl/src/OptMirror.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ void OptimizeMirroring::run()
6969
return net_box1->hpwl() > net_box2->hpwl();
7070
});
7171

72-
std::vector<dbInst*> mirror_candidates = findMirrorCandidates(sorted_boxes);
72+
std::vector<odb::dbInst*> mirror_candidates
73+
= findMirrorCandidates(sorted_boxes);
7374
odb::WireLengthEvaluator eval(block_);
7475
int64_t hpwl_before = eval.hpwl();
7576
int mirror_count = mirrorCandidates(mirror_candidates);
@@ -113,23 +114,23 @@ void OptimizeMirroring::findNetBoxes()
113114
}
114115
}
115116

116-
std::vector<dbInst*> OptimizeMirroring::findMirrorCandidates(
117+
std::vector<odb::dbInst*> OptimizeMirroring::findMirrorCandidates(
117118
NetBoxes& net_boxes)
118119
{
119-
std::vector<dbInst*> mirror_candidates;
120-
unordered_set<dbInst*> existing;
120+
std::vector<odb::dbInst*> mirror_candidates;
121+
unordered_set<odb::dbInst*> existing;
121122
// Find inst terms on the boundary of the net boxes.
122123
for (NetBox* net_box : net_boxes) {
123124
if (!net_box->isIgnore()) {
124125
dbNet* net = net_box->getNet();
125126
const odb::Rect& box = net_box->getBox();
126127
for (dbITerm* iterm : net->getITerms()) {
127-
dbInst* inst = iterm->getInst();
128+
odb::dbInst* inst = iterm->getInst();
128129
int x, y;
129130
if (inst->isCore() && !inst->isFixed() && iterm->getAvgXY(&x, &y)
130131
&& (x == box.xMin() || x == box.xMax() || y == box.yMin()
131132
|| y == box.yMax())) {
132-
dbInst* inst = iterm->getInst();
133+
odb::dbInst* inst = iterm->getInst();
133134
if (existing.find(inst) == existing.end()) {
134135
mirror_candidates.push_back(inst);
135136
existing.insert(inst);
@@ -147,10 +148,11 @@ std::vector<dbInst*> OptimizeMirroring::findMirrorCandidates(
147148
return mirror_candidates;
148149
}
149150

150-
int OptimizeMirroring::mirrorCandidates(std::vector<dbInst*>& mirror_candidates)
151+
int OptimizeMirroring::mirrorCandidates(
152+
std::vector<odb::dbInst*>& mirror_candidates)
151153
{
152154
int mirror_count = 0;
153-
for (dbInst* inst : mirror_candidates) {
155+
for (odb::dbInst* inst : mirror_candidates) {
154156
// Use hpwl of all nets connected to the instance terms
155157
// before/after to determine incremental change to total hpwl.
156158
int64_t hpwl_before = hpwl(inst);
@@ -199,7 +201,7 @@ static dbOrientType orientMirrorY(const dbOrientType& orient)
199201
return dbOrientType::R0;
200202
}
201203

202-
int64_t OptimizeMirroring::hpwl(dbInst* inst)
204+
int64_t OptimizeMirroring::hpwl(odb::dbInst* inst)
203205
{
204206
int64_t inst_hpwl = 0;
205207
for (dbITerm* iterm : inst->getITerms()) {
@@ -214,7 +216,7 @@ int64_t OptimizeMirroring::hpwl(dbInst* inst)
214216
return inst_hpwl;
215217
}
216218

217-
void OptimizeMirroring::updateNetBoxes(dbInst* inst)
219+
void OptimizeMirroring::updateNetBoxes(odb::dbInst* inst)
218220
{
219221
for (dbITerm* iterm : inst->getITerms()) {
220222
dbNet* net = iterm->getNet();
@@ -227,7 +229,7 @@ void OptimizeMirroring::updateNetBoxes(dbInst* inst)
227229
}
228230
}
229231

230-
void OptimizeMirroring::saveNetBoxes(dbInst* inst)
232+
void OptimizeMirroring::saveNetBoxes(odb::dbInst* inst)
231233
{
232234
for (dbITerm* iterm : inst->getITerms()) {
233235
dbNet* net = iterm->getNet();
@@ -237,7 +239,7 @@ void OptimizeMirroring::saveNetBoxes(dbInst* inst)
237239
}
238240
}
239241

240-
void OptimizeMirroring::restoreNetBoxes(dbInst* inst)
242+
void OptimizeMirroring::restoreNetBoxes(odb::dbInst* inst)
241243
{
242244
for (dbITerm* iterm : inst->getITerms()) {
243245
dbNet* net = iterm->getNet();

src/dpl/src/Place.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "boost/random/uniform_int_distribution.hpp"
2323
#include "dpl/Opendp.h"
2424
#include "graphics/DplObserver.h"
25+
#include "infrastructure/Coordinates.h"
2526
#include "infrastructure/Grid.h"
2627
#include "infrastructure/Objects.h"
2728
#include "infrastructure/Padding.h"
@@ -1055,7 +1056,7 @@ void Opendp::initMacrosAndGrid()
10551056
setFixedGridCells();
10561057
}
10571058

1058-
void Opendp::convertDbToCell(dbInst* db_inst, Node& cell)
1059+
void Opendp::convertDbToCell(odb::dbInst* db_inst, Node& cell)
10591060
{
10601061
cell.setType(Node::CELL);
10611062
cell.setDbInst(db_inst);
@@ -1105,7 +1106,7 @@ DbuPt Opendp::pointOffMacro(const Node& cell)
11051106
return init;
11061107
}
11071108

1108-
void Opendp::legalCellPos(dbInst* db_inst)
1109+
void Opendp::legalCellPos(odb::dbInst* db_inst)
11091110
{
11101111
Node cell;
11111112
convertDbToCell(db_inst, cell);

0 commit comments

Comments
 (0)