From 1df8a8b44091246acc8929cc803578c6d705eee1 Mon Sep 17 00:00:00 2001 From: David Shah Date: Wed, 20 Jun 2018 20:25:48 +0200 Subject: [PATCH] place_sa: Reduce effect of rounding errors Signed-off-by: David Shah --- common/place_sa.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/place_sa.cc b/common/place_sa.cc index 7325c557..4a2fc86e 100644 --- a/common/place_sa.cc +++ b/common/place_sa.cc @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -213,6 +212,15 @@ class SAPlacer temp *= 0.8; } } + + // Recalculate total wirelength entirely to avoid rounding errors + // accumulating over time + curr_wirelength = 0; + for (auto net : ctx->nets) { + float wl = get_wirelength(net.second); + wirelengths[net.first] = wl; + curr_wirelength += wl; + } } // Final post-pacement validitiy check for (auto bel : ctx->getBels()) {