Skip to content

Commit 3e7abf8

Browse files
committed
Merge branch 'master' into gui-edge-types
2 parents 6ef96fb + d84b4df commit 3e7abf8

Some content is hidden

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

64 files changed

+1073
-644
lines changed

src/dpl/include/dpl/OptMirror.h

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

1717
namespace dpl {
1818

19-
using odb::dbNet;
20-
2119
using utl::Logger;
2220

2321
class NetBox
2422
{
2523
public:
2624
NetBox() = default;
27-
NetBox(dbNet* net, const odb::Rect& box, bool ignore);
25+
NetBox(odb::dbNet* net, const odb::Rect& box, bool ignore);
2826
int64_t hpwl();
2927
void saveBox();
3028
void restoreBox();
3129
bool isIgnore() const { return ignore_; }
32-
dbNet* getNet() const { return net_; }
30+
odb::dbNet* getNet() const { return net_; }
3331
const odb::Rect& getBox() const { return box_; }
3432

3533
void setBox(const odb::Rect& box) { box_ = box; }
3634

3735
private:
38-
dbNet* net_ = nullptr;
36+
odb::dbNet* net_ = nullptr;
3937
odb::Rect box_;
4038
odb::Rect box_saved_;
4139
bool ignore_ = false;
4240
};
4341

44-
using NetBoxMap = std::unordered_map<dbNet*, NetBox>;
42+
using NetBoxMap = std::unordered_map<odb::dbNet*, NetBox>;
4543
using NetBoxes = std::vector<NetBox*>;
4644

4745
class OptimizeMirroring

src/dpl/src/Opendp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ void Opendp::setFixedGridCells()
271271
if (cell->getType() == Node::CELL && cell->isFixed()) {
272272
grid_->visitCellPixels(*cell, true, [&](Pixel* pixel, bool padded) {
273273
if (padded) {
274-
pixel->padding_reserved_by.insert(cell.get());
274+
pixel->padding_reserved_by = cell.get();
275275
} else {
276276
setGridCell(*cell, pixel);
277277
}

src/dpl/src/OptMirror.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using odb::dbOrientType;
2626

2727
static dbOrientType orientMirrorY(const dbOrientType& orient);
2828

29-
NetBox::NetBox(dbNet* net, const odb::Rect& box, bool ignore)
29+
NetBox::NetBox(odb::dbNet* net, const odb::Rect& box, bool ignore)
3030
: net_(net), box_(box), ignore_(ignore)
3131
{
3232
}
@@ -97,7 +97,7 @@ void OptimizeMirroring::findNetBoxes()
9797
{
9898
net_box_map_.clear();
9999
auto nets = block_->getNets();
100-
for (dbNet* net : nets) {
100+
for (odb::dbNet* net : nets) {
101101
bool ignore = net->getSigType().isSupply()
102102
|| net->isSpecial()
103103
// Reducing HPWL on large nets (like clocks) is irrelevant
@@ -122,7 +122,7 @@ std::vector<odb::dbInst*> OptimizeMirroring::findMirrorCandidates(
122122
// Find inst terms on the boundary of the net boxes.
123123
for (NetBox* net_box : net_boxes) {
124124
if (!net_box->isIgnore()) {
125-
dbNet* net = net_box->getNet();
125+
odb::dbNet* net = net_box->getNet();
126126
const odb::Rect& box = net_box->getBox();
127127
for (dbITerm* iterm : net->getITerms()) {
128128
odb::dbInst* inst = iterm->getInst();
@@ -205,7 +205,7 @@ int64_t OptimizeMirroring::hpwl(odb::dbInst* inst)
205205
{
206206
int64_t inst_hpwl = 0;
207207
for (dbITerm* iterm : inst->getITerms()) {
208-
dbNet* net = iterm->getNet();
208+
odb::dbNet* net = iterm->getNet();
209209
if (net) {
210210
NetBox& net_box = net_box_map_[net];
211211
if (!net_box.isIgnore()) {
@@ -219,7 +219,7 @@ int64_t OptimizeMirroring::hpwl(odb::dbInst* inst)
219219
void OptimizeMirroring::updateNetBoxes(odb::dbInst* inst)
220220
{
221221
for (dbITerm* iterm : inst->getITerms()) {
222-
dbNet* net = iterm->getNet();
222+
odb::dbNet* net = iterm->getNet();
223223
if (net) {
224224
NetBox& net_box = net_box_map_[net];
225225
if (!net_box.isIgnore()) {
@@ -232,7 +232,7 @@ void OptimizeMirroring::updateNetBoxes(odb::dbInst* inst)
232232
void OptimizeMirroring::saveNetBoxes(odb::dbInst* inst)
233233
{
234234
for (dbITerm* iterm : inst->getITerms()) {
235-
dbNet* net = iterm->getNet();
235+
odb::dbNet* net = iterm->getNet();
236236
if (net) {
237237
net_box_map_[net].saveBox();
238238
}
@@ -242,7 +242,7 @@ void OptimizeMirroring::saveNetBoxes(odb::dbInst* inst)
242242
void OptimizeMirroring::restoreNetBoxes(odb::dbInst* inst)
243243
{
244244
for (dbITerm* iterm : inst->getITerms()) {
245-
dbNet* net = iterm->getNet();
245+
odb::dbNet* net = iterm->getNet();
246246
if (net) {
247247
net_box_map_[net].restoreBox();
248248
}

src/dpl/src/Place.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,23 @@ bool Opendp::swapCells(Node* cell1, Node* cell2)
641641
+ distChange(cell2, cell1->getLeft(), cell1->getBottom());
642642

643643
if (dist_change < 0) {
644+
Journal journal(grid_.get(), nullptr);
645+
MoveCellAction action1(cell1,
646+
cell1->getLeft(),
647+
cell1->getBottom(),
648+
cell2->getLeft(),
649+
cell2->getBottom(),
650+
cell1->isPlaced());
651+
journal.addAction(action1);
652+
653+
MoveCellAction action2(cell2,
654+
cell2->getLeft(),
655+
cell2->getBottom(),
656+
cell1->getLeft(),
657+
cell1->getBottom(),
658+
cell2->isPlaced());
659+
journal.addAction(action2);
660+
644661
const GridX grid_x1 = grid_->gridX(cell2);
645662
const GridY grid_y1 = grid_->gridSnapDownY(cell2);
646663
const GridX grid_x2 = grid_->gridX(cell1);
@@ -650,7 +667,11 @@ bool Opendp::swapCells(Node* cell1, Node* cell2)
650667
unplaceCell(cell2);
651668
placeCell(cell1, grid_x1, grid_y1);
652669
placeCell(cell2, grid_x2, grid_y2);
653-
return true;
670+
// Check if placement is valid
671+
if (drc_engine_->checkDRC(cell1) && drc_engine_->checkDRC(cell2)) {
672+
return true;
673+
}
674+
journal.undo();
654675
}
655676
}
656677
return false;

src/dpl/src/PlacementDRC.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,8 @@ bool PlacementDRC::checkPadding(const Node* cell,
312312
if (hasPaddingConflict(cell, pixel->cell)) {
313313
return false;
314314
}
315-
for (auto padding_cell : pixel->padding_reserved_by) {
316-
if (hasPaddingConflict(cell, padding_cell)) {
317-
return false;
318-
}
315+
if (hasPaddingConflict(cell, pixel->padding_reserved_by)) {
316+
return false;
319317
}
320318
}
321319
}

src/dpl/src/infrastructure/Grid.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,8 @@ void Grid::erasePixel(Node* cell)
437437
}
438438

439439
// Clear padding reservations made by this cell
440-
if (pixel->padding_reserved_by.find(cell)
441-
!= pixel->padding_reserved_by.end()) {
442-
pixel->padding_reserved_by.erase(cell);
440+
if (pixel->padding_reserved_by == cell) {
441+
pixel->padding_reserved_by = nullptr;
443442
}
444443
}
445444
}
@@ -491,7 +490,7 @@ void Grid::paintCellPadding(Node* cell,
491490
if (pixel == nullptr) {
492491
continue;
493492
}
494-
pixel->padding_reserved_by.insert(cell);
493+
pixel->padding_reserved_by = cell;
495494
}
496495
}
497496

@@ -502,7 +501,7 @@ void Grid::paintCellPadding(Node* cell,
502501
if (pixel == nullptr) {
503502
continue;
504503
}
505-
pixel->padding_reserved_by.insert(cell);
504+
pixel->padding_reserved_by = cell;
506505
}
507506
}
508507
}

src/dpl/src/infrastructure/Grid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ struct Pixel
4545
bool is_valid = false; // false for dummy cells
4646
bool is_hopeless = false; // too far from sites for diamond search
4747
uint8_t blocked_layers = 0;
48-
// Cells that reserved this pixel for padding
49-
std::unordered_set<Node*> padding_reserved_by;
48+
// Cell that reserved this pixel for padding
49+
Node* padding_reserved_by = nullptr;
5050
};
5151

5252
// Return value for grid searches.

src/est/include/est/EstimateParasitics.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ namespace est {
4444
using utl::Logger;
4545

4646
using odb::dbDatabase;
47-
using odb::dbNet;
4847
using odb::dbTechLayer;
4948

5049
using stt::SteinerTreeBuilder;
@@ -187,7 +186,7 @@ class EstimateParasitics : public dbStaState
187186
Parasitics* parasitics);
188187
bool haveEstimatedParasitics() const;
189188
void parasiticsInvalid(const Net* net);
190-
void parasiticsInvalid(const dbNet* net);
189+
void parasiticsInvalid(const odb::dbNet* net);
191190
void eraseParasitics(const Net* net);
192191
bool parasiticsValid() const;
193192

src/est/src/EstimateParasitics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ bool EstimateParasitics::isPad(const Instance* inst) const
10411041

10421042
void EstimateParasitics::parasiticsInvalid(const Net* net)
10431043
{
1044-
dbNet* db_net = db_network_->flatNet(net);
1044+
odb::dbNet* db_net = db_network_->flatNet(net);
10451045
if (haveEstimatedParasitics()) {
10461046
debugPrint(logger_,
10471047
EST,
@@ -1053,7 +1053,7 @@ void EstimateParasitics::parasiticsInvalid(const Net* net)
10531053
}
10541054
}
10551055

1056-
void EstimateParasitics::parasiticsInvalid(const dbNet* net)
1056+
void EstimateParasitics::parasiticsInvalid(const odb::dbNet* net)
10571057
{
10581058
parasiticsInvalid(db_network_->dbToSta(net));
10591059
}

src/est/src/OdbCallBack.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void OdbCallBack::inDbInstCreate(odb::dbInst* inst)
6363
}
6464
}
6565

66-
void OdbCallBack::inDbNetCreate(dbNet* net)
66+
void OdbCallBack::inDbNetCreate(odb::dbNet* net)
6767
{
6868
debugPrint(estimate_parasitics_->getLogger(),
6969
utl::EST,
@@ -74,7 +74,7 @@ void OdbCallBack::inDbNetCreate(dbNet* net)
7474
estimate_parasitics_->parasiticsInvalid(net);
7575
}
7676

77-
void OdbCallBack::inDbNetDestroy(dbNet* net)
77+
void OdbCallBack::inDbNetDestroy(odb::dbNet* net)
7878
{
7979
debugPrint(estimate_parasitics_->getLogger(),
8080
utl::EST,
@@ -96,13 +96,13 @@ void OdbCallBack::inDbITermPostConnect(dbITerm* iterm)
9696
1,
9797
"inDbITermPostConnect iterm {}",
9898
iterm->getName());
99-
dbNet* db_net = iterm->getNet();
99+
odb::dbNet* db_net = iterm->getNet();
100100
if (db_net) {
101101
estimate_parasitics_->parasiticsInvalid(db_net);
102102
}
103103
}
104104

105-
void OdbCallBack::inDbITermPostDisconnect(dbITerm* iterm, dbNet* net)
105+
void OdbCallBack::inDbITermPostDisconnect(dbITerm* iterm, odb::dbNet* net)
106106
{
107107
debugPrint(estimate_parasitics_->getLogger(),
108108
utl::EST,

0 commit comments

Comments
 (0)