place_sa: Reduce effect of rounding errors

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-06-20 20:25:48 +02:00
parent 93ed8ca405
commit 1df8a8b440

View File

@ -30,7 +30,6 @@
#include <map> #include <map>
#include <ostream> #include <ostream>
#include <queue> #include <queue>
#include <random>
#include <set> #include <set>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -213,6 +212,15 @@ class SAPlacer
temp *= 0.8; 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 // Final post-pacement validitiy check
for (auto bel : ctx->getBels()) { for (auto bel : ctx->getBels()) {