diff options
author | David Shah <davey1576@gmail.com> | 2018-08-03 16:16:20 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-08-03 16:16:20 +0200 |
commit | 8081249b92a136dbab203cbc4c57a14a91a86323 (patch) | |
tree | acaa053495d8b25481315bc3b715a36b227ffbdf /common/place_common.cc | |
parent | 8c518cb8388df5b50b3c263d5a36d27851764fe4 (diff) | |
download | nextpnr-8081249b92a136dbab203cbc4c57a14a91a86323.tar.gz nextpnr-8081249b92a136dbab203cbc4c57a14a91a86323.tar.bz2 nextpnr-8081249b92a136dbab203cbc4c57a14a91a86323.zip |
place_common: Debugging bad relative constraint legalisation
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common/place_common.cc')
-rw-r--r-- | common/place_common.cc | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/common/place_common.cc b/common/place_common.cc index 1d4427ac..7160c642 100644 --- a/common/place_common.cc +++ b/common/place_common.cc @@ -194,7 +194,7 @@ class ConstraintLegaliseWorker ++diameter; } else { sign = -1; - if ((start + sign * diameter) > max) { + if ((start + sign * diameter) < min) { sign = 1; ++diameter; } @@ -257,6 +257,7 @@ class ConstraintLegaliseWorker cloc.x = xSearch.get(); cloc.y = ySearch.get(); cloc.z = zSearch.get(); + log_info(" checking '%s' at (%d, %d, %d)\n", child->name.c_str(ctx), cloc.x, cloc.y, cloc.z); zSearch.next(); if (zSearch.done()) { @@ -304,6 +305,8 @@ class ConstraintLegaliseWorker Loc currentLoc; if (cell->bel != BelId()) currentLoc = ctx->getBelLocation(cell->bel); + else + currentLoc = oldLocations[cell->name]; if (cell->constr_x == cell->UNCONSTR) xRootSearch = IncreasingDiameterSearch(currentLoc.x, 0, ctx->getGridDimX() - 1); else @@ -320,9 +323,12 @@ class ConstraintLegaliseWorker zRootSearch = IncreasingDiameterSearch(cell->constr_z); while (!xRootSearch.done()) { Loc rootLoc; + rootLoc.x = xRootSearch.get(); rootLoc.y = yRootSearch.get(); rootLoc.z = zRootSearch.get(); + if (ctx->verbose) + log_info(" trying (%d, %d, %d)\n", rootLoc.x, rootLoc.y, rootLoc.z); zRootSearch.next(); if (zRootSearch.done()) { zRootSearch.reset(); @@ -374,6 +380,28 @@ class ConstraintLegaliseWorker public: ConstraintLegaliseWorker(Context *ctx) : ctx(ctx) {}; + + void print_chain(CellInfo *cell, int depth = 0) { + for (int i = 0; i < depth; i++) + log(" "); + log("'%s' (", cell->name.c_str(ctx)); + if (cell->constr_x != cell->UNCONSTR) + log("%d, ", cell->constr_x); + else + log("*, "); + if (cell->constr_y != cell->UNCONSTR) + log("%d, ", cell->constr_y); + else + log("*, "); + if (cell->constr_z != cell->UNCONSTR) + log("%d", cell->constr_z); + else + log("*"); + log(")\n"); + for (auto child : cell->constr_children) + print_chain(child, depth+1); + } + bool legalise_constraints() { log_info("Legalising relative constraints...\n"); for (auto cell : sorted(ctx->cells)) { @@ -382,6 +410,8 @@ public: for (auto cell : sorted(ctx->cells)) { bool res = legalise_cell(cell.second); if (!res) { + if(ctx->verbose) + print_chain(cell.second); log_error("failed to place chain starting at cell '%s'\n", cell.first.c_str(ctx)); return false; } |