aboutsummaryrefslogtreecommitdiffstats
path: root/common/placer1.cc
diff options
context:
space:
mode:
Diffstat (limited to 'common/placer1.cc')
-rw-r--r--common/placer1.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/common/placer1.cc b/common/placer1.cc
index 9b5352e0..baddf4eb 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -193,7 +193,8 @@ class SAPlacer
last_wirelen_cost = curr_wirelen_cost;
last_timing_cost = curr_timing_cost;
- double avg_metric = curr_metric(), min_metric = curr_metric();
+ wirelen_t avg_wirelen = curr_wirelen_cost;
+ wirelen_t min_wirelen = curr_wirelen_cost;
int n_no_progress = 0;
temp = 10000;
@@ -220,8 +221,8 @@ class SAPlacer
}
}
- if (curr_metric() < min_metric) {
- min_metric = curr_metric();
+ if (curr_wirelen_cost < min_wirelen) {
+ min_wirelen = curr_wirelen_cost;
improved = true;
}
@@ -243,9 +244,9 @@ class SAPlacer
int M = std::max(max_x, max_y) + 1;
double upper = 0.6, lower = 0.4;
-
- if (curr_metric() < 0.95 * avg_metric && curr_metric > 0) {
- avg_metric = 0.8 * avg_metric + 0.2 * curr_metric();
+
+ if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) {
+ avg_wirelen = 0.8 * avg_wirelen + 0.2 * curr_wirelen_cost;
} else {
if (Raccept >= 0.8) {
temp *= 0.7;
@@ -295,6 +296,8 @@ class SAPlacer
// accumulating over time
curr_wirelen_cost = total_wirelen_cost();
curr_timing_cost = total_timing_cost();
+ last_wirelen_cost = curr_wirelen_cost;
+ last_timing_cost = curr_timing_cost;
// Let the UI show visualization updates.
ctx->yield();
}
@@ -401,17 +404,18 @@ class SAPlacer
ctx->unbindBel(newBel);
}
- add_move_cell(moveChange, cell, oldBel);
+ ctx->bindBel(newBel, cell, STRENGTH_WEAK);
if (other_cell != nullptr) {
- add_move_cell(moveChange, other_cell, newBel);
+ ctx->bindBel(oldBel, other_cell, STRENGTH_WEAK);
}
- ctx->bindBel(newBel, cell, STRENGTH_WEAK);
+ add_move_cell(moveChange, cell, oldBel);
if (other_cell != nullptr) {
- ctx->bindBel(oldBel, other_cell, STRENGTH_WEAK);
+ add_move_cell(moveChange, other_cell, newBel);
}
+
if (!ctx->isBelLocationValid(newBel) || ((other_cell != nullptr && !ctx->isBelLocationValid(oldBel)))) {
ctx->unbindBel(newBel);
if (other_cell != nullptr)
@@ -430,7 +434,7 @@ class SAPlacer
delta += (cfg.constraintWeight / temp) * (new_dist - old_dist);
n_move++;
// SA acceptance criterea
- if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
+ if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x0fffffff)) <= std::exp(-delta / temp))) {
n_accept++;
} else {
if (other_cell != nullptr)