diff options
author | David Shah <davey1576@gmail.com> | 2018-06-20 20:25:48 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-20 20:25:48 +0200 |
commit | 1df8a8b44091246acc8929cc803578c6d705eee1 (patch) | |
tree | 34237628f66997fab153f83e229715f9d3c66a26 | |
parent | 93ed8ca40519cc07b4719ea97a32f51d1a5631cb (diff) | |
download | nextpnr-1df8a8b44091246acc8929cc803578c6d705eee1.tar.gz nextpnr-1df8a8b44091246acc8929cc803578c6d705eee1.tar.bz2 nextpnr-1df8a8b44091246acc8929cc803578c6d705eee1.zip |
place_sa: Reduce effect of rounding errors
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | common/place_sa.cc | 10 |
1 files changed, 9 insertions, 1 deletions
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 <map> #include <ostream> #include <queue> -#include <random> #include <set> #include <stdarg.h> #include <stdio.h> @@ -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()) { |