Skip to content

Commit 92faeb7

Browse files
committed
pad: address clang-tidy comments
Signed-off-by: Peter Gadfort <[email protected]>
1 parent 94085b4 commit 92faeb7

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

src/pad/src/PadPlacer.cpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <iterator>
1010
#include <limits>
1111
#include <map>
12+
#include <memory>
1213
#include <optional>
1314
#include <set>
1415
#include <tuple>
@@ -157,7 +158,7 @@ int PadPlacer::convertRowIndexToPos(int index) const
157158
start = origin.y();
158159
}
159160

160-
return start + index * row_->getSpacing();
161+
return start + (index * row_->getSpacing());
161162
}
162163

163164
int PadPlacer::placeInstance(int index,
@@ -1019,9 +1020,8 @@ int PlacerPadPlacer::getNearestLegalPosition(odb::dbInst* inst,
10191020
}
10201021
if ((target - start) < (end - target)) {
10211022
return start;
1022-
} else {
1023-
return end;
10241023
}
1024+
return end;
10251025
}
10261026
return target;
10271027
}
@@ -1308,10 +1308,10 @@ bool PlacerPadPlacer::padSpreading(
13081308
total_move += std::abs(move_by);
13091309

13101310
const int move_to = convertRowIndexToPos(snapToRowSite(
1311-
curr_pos + move_by - positions[curr]->width / 2))
1312-
+ positions[curr]->width / 2;
1311+
curr_pos + move_by - (positions[curr]->width / 2)))
1312+
+ (positions[curr]->width / 2);
13131313
positions[curr]->setLocation(std::max(prev_pos, std::min(next_pos, move_to))
1314-
- positions[curr]->width / 2);
1314+
- (positions[curr]->width / 2));
13151315
debugPrint(getLogger(),
13161316
utl::PAD,
13171317
"Place",
@@ -1366,17 +1366,15 @@ std::map<odb::dbInst*, int> PlacerPadPlacer::padSpreading(
13661366

13671367
for (int k = 0; k < kMaxIterations; k++) {
13681368
// Update coeff schedule
1369-
const float kRepel1
1370-
= kRepelStart
1371-
+ (kRepelEnd - kRepelStart) * k / static_cast<float>(kMaxIterations);
1372-
const float kSpring1
1373-
= k > kSpringIterEnd
1374-
? 0
1375-
: (k > kSpringIterInfluence
1376-
? kSpringStart
1377-
* (kSpringItrRange - (k - kSpringIterInfluence))
1378-
/ static_cast<float>(kSpringItrRange)
1379-
: kSpringStart);
1369+
const float kRepel1 = kRepelStart
1370+
+ ((kRepelEnd - kRepelStart) * k
1371+
/ static_cast<float>(kMaxIterations));
1372+
const float kString2
1373+
= k > kSpringIterInfluence
1374+
? kSpringStart * (kSpringItrRange - (k - kSpringIterInfluence))
1375+
/ static_cast<float>(kSpringItrRange)
1376+
: kSpringStart;
1377+
const float kSpring1 = k > kSpringIterEnd ? 0 : kString2;
13801378

13811379
if (padSpreading(
13821380
positions, initial_positions, k, kSpring1, kRepel1, kDamper)) {
@@ -1434,8 +1432,6 @@ int PlacerPadPlacer::getNumberOfRoutes() const
14341432
{
14351433
int count = 0;
14361434
for (odb::dbInst* inst : getInsts()) {
1437-
std::vector<int64_t> lengths;
1438-
const odb::Point inst_center = inst->getBBox()->getBox().center();
14391435
if (iterm_connections_.find(inst) != iterm_connections_.end()) {
14401436
count += 1;
14411437
}

src/pad/src/PadPlacer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
#include <cstdint>
77
#include <map>
8+
#include <memory>
89
#include <optional>
910
#include <set>
11+
#include <string>
1012
#include <tuple>
1113
#include <utility>
1214
#include <vector>

0 commit comments

Comments
 (0)