Adding constraint satisfaction checks for debugging

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-08-03 16:59:45 +02:00
parent fd2174149c
commit dc4ab55b27
3 changed files with 18 additions and 9 deletions

View File

@ -281,7 +281,7 @@ struct CellInfo : ArchCellInfo
std::unordered_map<IdString, IdString> pins;
// placement constraints
CellInfo *constr_parent;
CellInfo *constr_parent = nullptr;
std::vector<CellInfo *> constr_children;
const int UNCONSTR = INT_MIN;
int constr_x = UNCONSTR; // this.x - parent.x

View File

@ -438,13 +438,17 @@ class ConstraintLegaliseWorker
}
}
for (auto rippedCell : rippedCells) {
bool res = place_single_cell(ctx, rippedCell, STRENGTH_WEAK);
bool res = place_single_cell(ctx, rippedCell, true);
if (!res) {
log_error("failed to place cell '%s' after relative constraint legalisation\n",
rippedCell->name.c_str(ctx));
return false;
}
}
for (auto cell : sorted(ctx->cells))
if (get_constraints_distance(ctx, cell.second) != 0)
log_error("constraint satisfaction check failed for cell '%s' at Bel '%s'\n", cell.first.c_str(ctx),
ctx->getBelName(cell.second->bel).c_str(ctx));
return true;
}
};

View File

@ -40,6 +40,7 @@
#include "place_common.h"
#include "timing.h"
#include "util.h"
NEXTPNR_NAMESPACE_BEGIN
class SAPlacer
@ -272,6 +273,10 @@ class SAPlacer
}
}
}
for (auto cell : sorted(ctx->cells))
if (get_constraints_distance(ctx, cell.second) != 0)
log_error("constraint satisfaction check failed for cell '%s' at Bel '%s'\n", cell.first.c_str(ctx),
ctx->getBelName(cell.second->bel).c_str(ctx));
timing_analysis(ctx, true /* print_fmax */);
ctx->unlock();
return true;