Fixing relative constraint implementation

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-08-03 15:40:01 +02:00
parent 60757a2dd7
commit 8c518cb838
2 changed files with 11 additions and 1 deletions

View File

@ -306,10 +306,18 @@ class ConstraintLegaliseWorker
currentLoc = ctx->getBelLocation(cell->bel); currentLoc = ctx->getBelLocation(cell->bel);
if (cell->constr_x == cell->UNCONSTR) if (cell->constr_x == cell->UNCONSTR)
xRootSearch = IncreasingDiameterSearch(currentLoc.x, 0, ctx->getGridDimX() - 1); xRootSearch = IncreasingDiameterSearch(currentLoc.x, 0, ctx->getGridDimX() - 1);
else
xRootSearch = IncreasingDiameterSearch(cell->constr_x);
if (cell->constr_y == cell->UNCONSTR) if (cell->constr_y == cell->UNCONSTR)
yRootSearch = IncreasingDiameterSearch(currentLoc.y, 0, ctx->getGridDimY() - 1); yRootSearch = IncreasingDiameterSearch(currentLoc.y, 0, ctx->getGridDimY() - 1);
else
yRootSearch = IncreasingDiameterSearch(cell->constr_y);
if (cell->constr_z == cell->UNCONSTR) if (cell->constr_z == cell->UNCONSTR)
zRootSearch = IncreasingDiameterSearch(currentLoc.z, 0, ctx->getTileDimZ(currentLoc.x, currentLoc.y)); zRootSearch = IncreasingDiameterSearch(currentLoc.z, 0, ctx->getTileDimZ(currentLoc.x, currentLoc.y));
else
zRootSearch = IncreasingDiameterSearch(cell->constr_z);
while (!xRootSearch.done()) { while (!xRootSearch.done()) {
Loc rootLoc; Loc rootLoc;
rootLoc.x = xRootSearch.get(); rootLoc.x = xRootSearch.get();
@ -352,6 +360,7 @@ class ConstraintLegaliseWorker
} }
ctx->bindBel(target, cp.first, STRENGTH_LOCKED); ctx->bindBel(target, cp.first, STRENGTH_LOCKED);
} }
NPNR_ASSERT(constraints_satisfied(cell));
return true; return true;
} }
} }

View File

@ -260,7 +260,8 @@ class ChainConstrainer
log_info("Placing carry chain starting at '%s'\n", chain.cells.front()->name.c_str(ctx)); log_info("Placing carry chain starting at '%s'\n", chain.cells.front()->name.c_str(ctx));
// Place carry chain // Place carry chain
chain.cells.at(0)->constr_abs_z = 0; chain.cells.at(0)->constr_abs_z = true;
chain.cells.at(0)->constr_z = 0;
for (int i = 1; i < int(chain.cells.size()); i++) { for (int i = 1; i < int(chain.cells.size()); i++) {
chain.cells.at(i)->constr_x = 0; chain.cells.at(i)->constr_x = 0;
chain.cells.at(i)->constr_y = (i / 8); chain.cells.at(i)->constr_y = (i / 8);