From e497575c8eb2eeef520e1e3b8b90f5d5ce811dd8 Mon Sep 17 00:00:00 2001 From: David Shah Date: Sat, 16 Jun 2018 18:45:32 +0200 Subject: place: Fix placer validity checks Signed-off-by: David Shah --- common/place_sa.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'common/place_sa.cc') 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; -- cgit v1.2.3