aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-09-23 14:10:46 +0100
committerGitHub <noreply@github.com>2021-09-23 14:10:46 +0100
commitd9a71083e1a081f89e1aa4c357bc3b828eea6709 (patch)
tree016d96c6315fd4d3e1a4f9495ce8e17d041be488
parent24f13ec9425590ddcb01dc8981f988a492c12e1a (diff)
parent8c97cbe3415b2292263752a0ea5c64ce73d39e51 (diff)
downloadnextpnr-d9a71083e1a081f89e1aa4c357bc3b828eea6709.tar.gz
nextpnr-d9a71083e1a081f89e1aa4c357bc3b828eea6709.tar.bz2
nextpnr-d9a71083e1a081f89e1aa4c357bc3b828eea6709.zip
Merge pull request #825 from antmicro/chain_swap_fix
Fix chain swap
-rw-r--r--common/placer1.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/common/placer1.cc b/common/placer1.cc
index 5e9c0f6d..3501e446 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -619,7 +619,6 @@ class SAPlacer
{
std::vector<std::pair<CellInfo *, Loc>> cell_rel;
dict<IdString, BelId> moved_cells;
- std::vector<std::pair<CellInfo *, BelId>> dest_bels;
double delta = 0;
int orig_share_cost = total_net_share;
moveChange.reset(this);
@@ -629,7 +628,11 @@ class SAPlacer
std::queue<std::pair<ClusterId, BelId>> displaced_clusters;
displaced_clusters.emplace(cell->cluster, newBase);
while (!displaced_clusters.empty()) {
+ std::vector<std::pair<CellInfo *, BelId>> dest_bels;
auto cursor = displaced_clusters.front();
+#if CHAIN_DEBUG
+ log_info("%d Cluster %s\n", __LINE__, cursor.first.c_str(ctx));
+#endif
displaced_clusters.pop();
if (!ctx->getClusterPlacement(cursor.first, cursor.second, dest_bels))
goto swap_fail;
@@ -727,13 +730,23 @@ class SAPlacer
commit_cost_changes(moveChange);
return true;
swap_fail:
+#if CHAIN_DEBUG
+ log_info("Swap failed\n");
+#endif
for (auto cell_pair : moved_cells) {
CellInfo *cell = ctx->cells.at(cell_pair.first).get();
- if (cell->bel != BelId())
+ if (cell->bel != BelId()){
+#if CHAIN_DEBUG
+ log_info("%d unbind %s\n", __LINE__, ctx->nameOfBel(cell->bel));
+#endif
ctx->unbindBel(cell->bel);
+ }
}
for (auto cell_pair : moved_cells) {
CellInfo *cell = ctx->cells.at(cell_pair.first).get();
+#if CHAIN_DEBUG
+ log_info("%d bind %s %s\n", __LINE__, ctx->nameOfBel(cell_pair.second), cell->name.c_str(ctx));
+#endif
ctx->bindBel(cell_pair.second, cell, STRENGTH_WEAK);
}
return false;