aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-02-26 20:06:02 +0000
committerGitHub <noreply@github.com>2021-02-26 20:06:02 +0000
commit6689bfe923791e7c1c2dd46134f8420f11abee29 (patch)
tree3e443c407ff6ba96cb45e8e56ecbb9ea9a093ff6
parent396af7470b3e6728f88dcc690cac3886ea9101e2 (diff)
parentc65ba121e00a17c344f154e0335d1c2358a1393d (diff)
downloadnextpnr-6689bfe923791e7c1c2dd46134f8420f11abee29.tar.gz
nextpnr-6689bfe923791e7c1c2dd46134f8420f11abee29.tar.bz2
nextpnr-6689bfe923791e7c1c2dd46134f8420f11abee29.zip
Merge pull request #603 from litghost/fix_trival_bad_swap
Prevent trival misplacements in placer1.
-rw-r--r--common/placer1.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/placer1.cc b/common/placer1.cc
index 837010fe..619bfbc8 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -518,6 +518,13 @@ class SAPlacer
old_dist += get_constraints_distance(ctx, other_cell);
double delta = 0;
+ if (!ctx->isValidBelForCellType(cell->type, newBel)) {
+ return false;
+ }
+ if (other_cell != nullptr && !ctx->isValidBelForCellType(other_cell->type, oldBel)) {
+ return false;
+ }
+
int net_delta_score = 0;
if (cfg.netShareWeight > 0)
net_delta_score += update_nets_by_tile(cell, ctx->getBelLocation(cell->bel), ctx->getBelLocation(newBel));
@@ -655,6 +662,11 @@ class SAPlacer
if (bound != nullptr && !cells.count(bound->name) &&
(bound->belStrength >= STRENGTH_STRONG || bound->isConstrained(false)))
return false;
+
+ if (bound != nullptr)
+ if (!ctx->isValidBelForCellType(bound->type, cr.first->bel))
+ return false;
+
dest_bels.emplace_back(std::make_pair(cr.first, targetBel));
}
#if 0