aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/place_common.cc30
-rw-r--r--common/placer1.cc2
2 files changed, 31 insertions, 1 deletions
diff --git a/common/place_common.cc b/common/place_common.cc
index c41f0b4e..dff989bf 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -425,6 +425,34 @@ class ConstraintLegaliseWorker
print_chain(child, depth + 1);
}
+ void print_stats(const char *point)
+ {
+ float distance_sum = 0;
+ float max_distance = 0;
+ int moved_cells = 0;
+ int unplaced_cells = 0;
+ for (auto orig : oldLocations) {
+ if (ctx->cells.at(orig.first)->bel == BelId()) {
+ unplaced_cells++;
+ continue;
+ }
+ Loc newLoc = ctx->getBelLocation(ctx->cells.at(orig.first)->bel);
+ if (newLoc != orig.second) {
+ float distance = std::sqrt(std::pow(newLoc.x - orig.second.x, 2) + pow(newLoc.y - orig.second.y, 2));
+ moved_cells++;
+ distance_sum += distance;
+ if (distance > max_distance)
+ max_distance = distance;
+ }
+ }
+ log_info(" moved %d cells, %d unplaced (after %s)\n", moved_cells, unplaced_cells, point);
+ if (moved_cells > 0) {
+ log_info(" average distance %f\n", (distance_sum / moved_cells));
+ log_info(" maximum distance %f\n", max_distance);
+ }
+ }
+
+
bool legalise_constraints()
{
log_info("Legalising relative constraints...\n");
@@ -440,6 +468,7 @@ class ConstraintLegaliseWorker
return false;
}
}
+ print_stats("after legalising chains");
for (auto rippedCell : rippedCells) {
bool res = place_single_cell(ctx, ctx->cells.at(rippedCell).get(), true);
if (!res) {
@@ -448,6 +477,7 @@ class ConstraintLegaliseWorker
return false;
}
}
+ print_stats("after replacing ripped up cells");
for (auto cell : sorted(ctx->cells))
if (get_constraints_distance(ctx, cell.second) != 0)
log_error("constraint satisfaction check failed for cell '%s' at Bel '%s'\n", cell.first.c_str(ctx),
diff --git a/common/placer1.cc b/common/placer1.cc
index 673e304f..6da8608a 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -395,7 +395,7 @@ private:
if (other != IdString())
new_dist += get_constraints_distance(ctx, other_cell);
delta = new_metric - curr_metric;
- delta += (1 / temp) * (new_dist - old_dist);
+ delta += (10 / temp) * (new_dist - old_dist);
n_move++;
// SA acceptance criterea
if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {