aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/place_sa.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/common/place_sa.cc b/common/place_sa.cc
index a6d3040f..9e3d3022 100644
--- a/common/place_sa.cc
+++ b/common/place_sa.cc
@@ -177,13 +177,16 @@ static bool try_swap_position(Design *design, CellInfo *cell, BelId newBel,
}
chip.bindBel(newBel, cell->name);
+
if (other != IdString()) {
- if (!isValidBelForCell(design, other_cell, oldBel)) {
- chip.unbindBel(newBel);
- goto swap_fail;
- } else {
- chip.bindBel(oldBel, other_cell->name);
- }
+ chip.bindBel(oldBel, other_cell->name);
+ }
+
+ if (!isBelLocationValid(design, newBel) || ((other != IdString() && !isBelLocationValid(design, oldBel)))) {
+ chip.unbindBel(newBel);
+ if (other != IdString())
+ chip.unbindBel(oldBel);
+ goto swap_fail;
}
cell->bel = newBel;