Skip to content

Commit a5f487c

Browse files
authored
Merge pull request #7144 from osamahammad21/dpl-dpo-remove-dead
DPO: remove dead code "router.h"
2 parents ae71638 + 3683c3d commit a5f487c

21 files changed

Lines changed: 17 additions & 484 deletions

src/dpo/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ target_sources(dpo
1919
src/architecture.cxx
2020
src/color.cxx
2121
src/network.cxx
22-
src/router.cxx
2322
src/utility.cxx
2423
src/legalize_shift.cxx
2524
src/detailed.cxx

src/dpo/include/dpo/Optdp.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class PlacementDRC;
2929

3030
namespace dpo {
3131

32-
class RoutingParams;
3332
class Architecture;
3433
class Network;
3534

@@ -82,8 +81,6 @@ class Optdp
8281
// My stuff.
8382
Architecture* arch_ = nullptr; // Information about rows, etc.
8483
Network* network_ = nullptr; // The netlist, cells, etc.
85-
RoutingParams* routeinfo_
86-
= nullptr; // Route info we might consider (future).
8784
Grid* grid_ = nullptr;
8885

8986
// placement DRC enging.

src/dpo/src/Optdp.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "dpl/PlacementDRC.h"
3232
#include "legalize_shift.h"
3333
#include "network.h"
34-
#include "router.h"
3534
#include "symmetry.h"
3635

3736
namespace dpo {
@@ -90,7 +89,7 @@ void Optdp::improvePlacement(const int seed,
9089
const bool disallow_one_site_gaps = !odb::hasOneSiteMaster(db_);
9190

9291
// A manager to track cells.
93-
dpo::DetailedMgr mgr(arch_, network_, routeinfo_, grid_, drc_engine_);
92+
dpo::DetailedMgr mgr(arch_, network_, grid_, drc_engine_);
9493
mgr.setLogger(logger_);
9594
// Various settings.
9695
mgr.setSeed(seed);
@@ -142,7 +141,6 @@ void Optdp::improvePlacement(const int seed,
142141
// Cleanup.
143142
delete network_;
144143
delete arch_;
145-
delete routeinfo_;
146144
delete drc_engine_;
147145

148146
const double dbu_micron = db_->getTech()->getDbUnitsPerMicron();
@@ -164,7 +162,6 @@ void Optdp::import()
164162

165163
network_ = new Network;
166164
arch_ = new Architecture;
167-
routeinfo_ = new RoutingParams;
168165
grid_ = new Grid;
169166

170167
// createLayerMap(); // Does nothing right now.

src/dpo/src/architecture.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "network.h"
1919
#include "odb/db.h"
2020
#include "odb/dbTransform.h"
21-
#include "router.h"
2221

2322
namespace dpo {
2423

src/dpo/src/detailed.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ bool Detailed::improve(DetailedMgr& mgr)
4343

4444
arch_ = mgr.getArchitecture();
4545
network_ = mgr.getNetwork();
46-
rt_ = mgr.getRoutingParams(); // Can be NULL.
4746

4847
// Parse the script string and run each command.
4948
boost::char_separator<char> separators(" \r\t\n", ";");
@@ -145,13 +144,13 @@ void Detailed::doDetailedCommand(std::vector<std::string>& args)
145144
logger->info(DPO, 303, "Running algorithm for {:s}.", command);
146145

147146
if (strcmp(args[0].c_str(), "mis") == 0) {
148-
DetailedMis mis(arch_, network_, rt_);
147+
DetailedMis mis(arch_, network_);
149148
mis.run(mgr_, args);
150149
} else if (strcmp(args[0].c_str(), "gs") == 0) {
151-
DetailedGlobalSwap gs(arch_, network_, rt_);
150+
DetailedGlobalSwap gs(arch_, network_);
152151
gs.run(mgr_, args);
153152
} else if (strcmp(args[0].c_str(), "vs") == 0) {
154-
DetailedVerticalSwap vs(arch_, network_, rt_);
153+
DetailedVerticalSwap vs(arch_, network_);
155154
vs.run(mgr_, args);
156155
} else if (strcmp(args[0].c_str(), "ro") == 0) {
157156
DetailedReorderer ro(arch_, network_);

src/dpo/src/detailed.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "architecture.h"
1313
#include "network.h"
14-
#include "router.h"
1514

1615
namespace dpo {
1716

@@ -44,7 +43,6 @@ class Detailed
4443

4544
Architecture* arch_ = nullptr;
4645
Network* network_ = nullptr;
47-
RoutingParams* rt_ = nullptr;
4846
};
4947

5048
} // namespace dpo

src/dpo/src/detailed_global.cxx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ using utl::DPO;
2222

2323
////////////////////////////////////////////////////////////////////////////////
2424
////////////////////////////////////////////////////////////////////////////////
25-
DetailedGlobalSwap::DetailedGlobalSwap(Architecture* arch,
26-
Network* network,
27-
RoutingParams* rt)
25+
DetailedGlobalSwap::DetailedGlobalSwap(Architecture* arch, Network* network)
2826
: DetailedGenerator("global swap"),
2927
mgr_(nullptr),
3028
arch_(arch),
3129
network_(network),
32-
rt_(rt),
3330
skipNetsLargerThanThis_(100),
3431
traversal_(0),
3532
attempts_(0),
@@ -40,8 +37,7 @@ DetailedGlobalSwap::DetailedGlobalSwap(Architecture* arch,
4037

4138
////////////////////////////////////////////////////////////////////////////////
4239
////////////////////////////////////////////////////////////////////////////////
43-
DetailedGlobalSwap::DetailedGlobalSwap()
44-
: DetailedGlobalSwap(nullptr, nullptr, nullptr)
40+
DetailedGlobalSwap::DetailedGlobalSwap() : DetailedGlobalSwap(nullptr, nullptr)
4541
{
4642
}
4743

@@ -70,7 +66,6 @@ void DetailedGlobalSwap::run(DetailedMgr* mgrPtr,
7066
mgr_ = mgrPtr;
7167
arch_ = mgr_->getArchitecture();
7268
network_ = mgr_->getNetwork();
73-
rt_ = mgr_->getRoutingParams();
7469

7570
int passes = 1;
7671
double tol = 0.01;
@@ -476,7 +471,6 @@ void DetailedGlobalSwap::init(DetailedMgr* mgr)
476471
mgr_ = mgr;
477472
arch_ = mgr->getArchitecture();
478473
network_ = mgr->getNetwork();
479-
rt_ = mgr->getRoutingParams();
480474

481475
traversal_ = 0;
482476
edgeMask_.resize(network_->getNumEdges());
@@ -493,7 +487,6 @@ bool DetailedGlobalSwap::generate(DetailedMgr* mgr,
493487
mgr_ = mgr;
494488
arch_ = mgr->getArchitecture();
495489
network_ = mgr->getNetwork();
496-
rt_ = mgr->getRoutingParams();
497490

498491
Node* ndi = candidates[mgr_->getRandom(candidates.size())];
499492

src/dpo/src/detailed_global.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ namespace dpo {
1515
class Architecture;
1616
class DetailedMgr;
1717
class Network;
18-
class RoutingParams;
1918
using dpl::Edge;
2019

2120
class DetailedGlobalSwap : public DetailedGenerator
2221
{
2322
public:
24-
DetailedGlobalSwap(Architecture* arch, Network* network, RoutingParams* rt);
23+
DetailedGlobalSwap(Architecture* arch, Network* network);
2524
DetailedGlobalSwap();
2625

2726
// Interfaces for scripting.
@@ -46,7 +45,6 @@ class DetailedGlobalSwap : public DetailedGenerator
4645
DetailedMgr* mgr_;
4746
Architecture* arch_;
4847
Network* network_;
49-
RoutingParams* rt_;
5048

5149
// Other.
5250
int skipNetsLargerThanThis_;

src/dpo/src/detailed_manager.cxx

Lines changed: 3 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "dpl/PlacementDRC.h"
2424
#include "journal.h"
2525
#include "odb/dbTransform.h"
26-
#include "router.h"
2726
#include "utility.h"
2827
#include "utl/Logger.h"
2928

@@ -33,14 +32,9 @@ namespace dpo {
3332

3433
DetailedMgr::DetailedMgr(Architecture* arch,
3534
Network* network,
36-
RoutingParams* rt,
3735
Grid* grid,
3836
PlacementDRC* drc_engine)
39-
: arch_(arch),
40-
network_(network),
41-
rt_(rt),
42-
grid_(grid),
43-
drc_engine_(drc_engine)
37+
: arch_(arch), network_(network), grid_(grid), drc_engine_(drc_engine)
4438
{
4539
singleRowHeight_ = arch_->getRow(0)->getHeight();
4640
numSingleHeightRows_ = arch_->getNumRows();
@@ -192,50 +186,6 @@ void DetailedMgr::findBlockages(const bool includeRouteBlockages)
192186
}
193187
}
194188

195-
if (includeRouteBlockages && rt_ != nullptr) {
196-
// Turn M1 and M2 routing blockages into placement blockages. The idea
197-
// here is to be quite conservative and prevent the possibility of pin
198-
// access problems. We *ONLY* consider routing obstacles to be placement
199-
// obstacles if they overlap with an *ENTIRE* site.
200-
201-
for (int layer = 0; layer <= 1 && layer < rt_->num_layers_; layer++) {
202-
const std::vector<Rectangle>& rects = rt_->layerBlockages_[layer];
203-
for (const auto& rect : rects) {
204-
const double xmin = rect.xmin();
205-
const double xmax = rect.xmax();
206-
const double ymin = rect.ymin();
207-
const double ymax = rect.ymax();
208-
209-
for (int r = 0; r < numSingleHeightRows_; r++) {
210-
const double lb = arch_->getMinY() + r * singleRowHeight_;
211-
const double ub = lb + singleRowHeight_;
212-
213-
if (ymax >= ub && ymin <= lb) {
214-
// Blockage overlaps with the entire row span in the Y-dir...
215-
// Sites are possibly completely covered!
216-
217-
const double originX = arch_->getRow(r)->getLeft();
218-
const double siteSpacing = arch_->getRow(r)->getSiteSpacing();
219-
220-
const int i0 = (int) std::floor((xmin - originX) / siteSpacing);
221-
int i1 = (int) std::floor((xmax - originX) / siteSpacing);
222-
if (originX + i1 * siteSpacing != xmax) {
223-
++i1;
224-
}
225-
226-
if (i1 > i0) {
227-
blockages_[r].emplace_back(originX + i0 * siteSpacing,
228-
originX + i1 * siteSpacing,
229-
0,
230-
0,
231-
BlockageType::Routing);
232-
}
233-
}
234-
}
235-
}
236-
}
237-
}
238-
239189
// Sort blockages and merge.
240190
for (int r = 0; r < numSingleHeightRows_; r++) {
241191
auto& blockages = blockages_[r];
@@ -1093,53 +1043,6 @@ double DetailedMgr::measureMaximumDisplacement(u_int64_t& maxX,
10931043
return maxL1;
10941044
}
10951045

1096-
////////////////////////////////////////////////////////////////////////////////
1097-
////////////////////////////////////////////////////////////////////////////////
1098-
void DetailedMgr::setupObstaclesForDrc()
1099-
{
1100-
// Setup rectangular obstacles for short and pin access checks. Do only as
1101-
// rectangles per row and per layer. I had used rtrees, but it wasn't working
1102-
// any better.
1103-
obstacles_.resize(arch_->getRows().size());
1104-
1105-
for (int row_id = 0; row_id < arch_->getRows().size(); row_id++) {
1106-
obstacles_[row_id].resize(rt_->num_layers_);
1107-
1108-
const double originX = arch_->getRow(row_id)->getLeft();
1109-
const double siteSpacing = arch_->getRow(row_id)->getSiteSpacing();
1110-
const int numSites = arch_->getRow(row_id)->getNumSites();
1111-
1112-
// Blockages relevant to this row...
1113-
for (int layer_id = 0; layer_id < rt_->num_layers_; layer_id++) {
1114-
obstacles_[row_id][layer_id].clear();
1115-
1116-
const std::vector<Rectangle>& rects = rt_->layerBlockages_[layer_id];
1117-
for (const auto& rect : rects) {
1118-
// Extract obstacles which interfere with this row only.
1119-
const double xmin = originX;
1120-
const double xmax = originX + numSites * siteSpacing;
1121-
const double ymin = arch_->getRow(row_id)->getBottom();
1122-
const double ymax = arch_->getRow(row_id)->getTop();
1123-
1124-
if (rect.xmax() <= xmin) {
1125-
continue;
1126-
}
1127-
if (rect.xmin() >= xmax) {
1128-
continue;
1129-
}
1130-
if (rect.ymax() <= ymin) {
1131-
continue;
1132-
}
1133-
if (rect.ymin() >= ymax) {
1134-
continue;
1135-
}
1136-
1137-
obstacles_[row_id][layer_id].push_back(rect);
1138-
}
1139-
}
1140-
}
1141-
}
1142-
11431046
////////////////////////////////////////////////////////////////////////////////
11441047
////////////////////////////////////////////////////////////////////////////////
11451048
void DetailedMgr::collectSingleHeightCells()
@@ -1652,76 +1555,12 @@ int DetailedMgr::checkRowAlignment()
16521555

16531556
////////////////////////////////////////////////////////////////////////////////
16541557
////////////////////////////////////////////////////////////////////////////////
1655-
double DetailedMgr::getCellSpacing(const Node* ndl,
1656-
const Node* ndr,
1657-
const bool checkPinsOnCells)
1558+
double DetailedMgr::getCellSpacing(const Node* ndl, const Node* ndr)
16581559
{
1659-
// Compute any required spacing between cells. This could be from an edge
1660-
// type rule, or due to adjacent pins on the cells. Checking pins on cells is
1661-
// more time consuming.
1662-
16631560
if (ndl == nullptr || ndr == nullptr) {
16641561
return 0.0;
16651562
}
1666-
const double spacing1 = arch_->getCellSpacing(ndl, ndl);
1667-
if (!checkPinsOnCells) {
1668-
return spacing1;
1669-
}
1670-
double spacing2 = 0.0;
1671-
{
1672-
const Pin* pinl = nullptr;
1673-
const Pin* pinr = nullptr;
1674-
1675-
// Right-most pin on the left cell.
1676-
for (const Pin* pin : ndl->getPins()) {
1677-
if (pinl == nullptr || pin->getOffsetX() > pinl->getOffsetX()) {
1678-
pinl = pin;
1679-
}
1680-
}
1681-
1682-
// Left-most pin on the right cell.
1683-
for (const Pin* pin : ndr->getPins()) {
1684-
if (pinr == nullptr || pin->getOffsetX() < pinr->getOffsetX()) {
1685-
pinr = pin;
1686-
}
1687-
}
1688-
// If pins on the same layer, do something.
1689-
if (pinl != nullptr && pinr != nullptr
1690-
&& pinl->getPinLayer() == pinr->getPinLayer()) {
1691-
// Determine the spacing requirements between these two pins. Then,
1692-
// translate this into a spacing requirement between the two cells. XXX:
1693-
// Since it is implicit that the cells are in the same row, we can
1694-
// determine the widest pin and the parallel run length without knowing
1695-
// the actual location of the cells... At least I think so...
1696-
1697-
const double xmin1 = pinl->getOffsetX().v - 0.5 * pinl->getPinWidth().v;
1698-
const double xmax1 = pinl->getOffsetX().v + 0.5 * pinl->getPinWidth().v;
1699-
const double ymin1 = pinl->getOffsetY().v - 0.5 * pinl->getPinHeight().v;
1700-
const double ymax1 = pinl->getOffsetY().v + 0.5 * pinl->getPinHeight().v;
1701-
1702-
const double xmin2 = pinr->getOffsetX().v - 0.5 * pinr->getPinWidth().v;
1703-
const double xmax2 = pinr->getOffsetX().v + 0.5 * pinr->getPinWidth().v;
1704-
const double ymin2 = pinr->getOffsetY().v - 0.5 * pinr->getPinHeight().v;
1705-
const double ymax2 = pinr->getOffsetY().v + 0.5 * pinr->getPinHeight().v;
1706-
1707-
const double ww = std::max(std::min(ymax1 - ymin1, xmax1 - xmin1),
1708-
std::min(ymax2 - ymin2, xmax2 - xmin2));
1709-
const double py
1710-
= std::max(0.0, std::min(ymax1, ymax2) - std::max(ymin1, ymin2));
1711-
1712-
spacing2 = rt_->get_spacing(pinl->getPinLayer(), ww, py);
1713-
const double gapl = (0.5 * ndl->getWidth().v) - xmax1;
1714-
const double gapr = xmin2 - (-0.5 * ndr->getWidth().v);
1715-
spacing2 = std::max(0.0, spacing2 - gapl - gapr);
1716-
1717-
if (spacing2 > spacing1) {
1718-
// The spacing requirement due to the routing layer is larger than the
1719-
// spacing requirement due to the edge constraint. Interesting.
1720-
;
1721-
}
1722-
}
1723-
}
1724-
return std::max(spacing1, spacing2);
1563+
return arch_->getCellSpacing(ndl, ndl);
17251564
}
17261565

17271566
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)