place_common: Fixing accidental chain breakage

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-08-03 17:07:26 +02:00
parent dc4ab55b27
commit 03c2d22fff

View File

@ -155,6 +155,8 @@ bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality)
} else { } else {
all_placed = true; all_placed = true;
} }
if (ctx->verbose)
log_info(" placed single cell '%s' at '%s'\n", cell->name.c_str(ctx), ctx->getBelName(best_bel).c_str(ctx));
ctx->bindBel(best_bel, cell->name, STRENGTH_WEAK); ctx->bindBel(best_bel, cell->name, STRENGTH_WEAK);
cell = ripup_target; cell = ripup_target;
@ -166,7 +168,7 @@ class ConstraintLegaliseWorker
{ {
private: private:
Context *ctx; Context *ctx;
std::vector<CellInfo *> rippedCells; std::set<IdString> rippedCells;
std::unordered_map<IdString, Loc> oldLocations; std::unordered_map<IdString, Loc> oldLocations;
class IncreasingDiameterSearch class IncreasingDiameterSearch
{ {
@ -380,10 +382,11 @@ class ConstraintLegaliseWorker
ctx->getBelName(confl_cell->bel).c_str(ctx)); ctx->getBelName(confl_cell->bel).c_str(ctx));
NPNR_ASSERT(confl_cell->belStrength < STRENGTH_STRONG); NPNR_ASSERT(confl_cell->belStrength < STRENGTH_STRONG);
ctx->unbindBel(target); ctx->unbindBel(target);
rippedCells.push_back(confl_cell); rippedCells.insert(conflicting);
} }
} }
ctx->bindBel(target, cp.first, STRENGTH_LOCKED); ctx->bindBel(target, cp.first, STRENGTH_LOCKED);
rippedCells.erase(cp.first);
} }
NPNR_ASSERT(constraints_satisfied(cell)); NPNR_ASSERT(constraints_satisfied(cell));
return true; return true;
@ -438,10 +441,10 @@ class ConstraintLegaliseWorker
} }
} }
for (auto rippedCell : rippedCells) { for (auto rippedCell : rippedCells) {
bool res = place_single_cell(ctx, rippedCell, true); bool res = place_single_cell(ctx, ctx->cells.at(rippedCell).get(), true);
if (!res) { if (!res) {
log_error("failed to place cell '%s' after relative constraint legalisation\n", log_error("failed to place cell '%s' after relative constraint legalisation\n",
rippedCell->name.c_str(ctx)); rippedCell.c_str(ctx));
return false; return false;
} }
} }