aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-08-03 15:00:32 +0200
committerDavid Shah <davey1576@gmail.com>2018-08-03 15:00:32 +0200
commit7e9209878c81730e6374ff555ea2c52f8d20a0ee (patch)
tree4012e0f1ddd7f49d60b11dc8e310b7ca5b2f83b5
parente5dea28dbde8a5fbb31bccb347eb0047f6790ebf (diff)
downloadnextpnr-7e9209878c81730e6374ff555ea2c52f8d20a0ee.tar.gz
nextpnr-7e9209878c81730e6374ff555ea2c52f8d20a0ee.tar.bz2
nextpnr-7e9209878c81730e6374ff555ea2c52f8d20a0ee.zip
Reworking packer and placer to use new generic rel legaliser
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r--common/place_common.cc6
-rw-r--r--common/placer1.cc17
-rw-r--r--ice40/chains.cc2
-rw-r--r--ice40/pack.cc3
4 files changed, 18 insertions, 10 deletions
diff --git a/common/place_common.cc b/common/place_common.cc
index b02904ec..0b7a0352 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -189,9 +189,15 @@ class ConstraintLegaliseWorker
diameter = 1;
} else if (sign == -1) {
sign = 1;
+ if ((start + sign * diameter) > max)
+ sign = -1;
++diameter;
} else {
sign = -1;
+ if ((start + sign * diameter) > max) {
+ sign = 1;
+ ++diameter;
+ }
}
}
diff --git a/common/placer1.cc b/common/placer1.cc
index 3a25f42c..d3665eb6 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -224,7 +224,7 @@ class SAPlacer
// Once cooled below legalise threshold, run legalisation and start requiring
// legal moves only
if (temp < legalise_temp && !require_legal) {
- // legalise_design(ctx);
+ legalise_relative_constraints(ctx);
// FIXME
require_legal = true;
autoplaced.clear();
@@ -294,7 +294,7 @@ class SAPlacer
}
BelType targetType = ctx->belTypeFromId(cell->type);
for (auto bel : ctx->getBels()) {
- if (ctx->getBelType(bel) == targetType && (ctx->isValidBelForCell(cell, bel) || !require_legal)) {
+ if (ctx->getBelType(bel) == targetType && ctx->isValidBelForCell(cell, bel)) {
if (ctx->checkBelAvail(bel)) {
uint64_t score = ctx->rng64();
if (score <= best_score) {
@@ -364,15 +364,14 @@ class SAPlacer
if (other != IdString()) {
ctx->bindBel(oldBel, other_cell->name, STRENGTH_WEAK);
}
- if (require_legal) {
- if (!ctx->isBelLocationValid(newBel) || ((other != IdString() && !ctx->isBelLocationValid(oldBel)))) {
- ctx->unbindBel(newBel);
- if (other != IdString())
- ctx->unbindBel(oldBel);
- goto swap_fail;
- }
+ if (!ctx->isBelLocationValid(newBel) || ((other != IdString() && !ctx->isBelLocationValid(oldBel)))) {
+ ctx->unbindBel(newBel);
+ if (other != IdString())
+ ctx->unbindBel(oldBel);
+ goto swap_fail;
}
+
new_metric = curr_metric;
// Recalculate metrics for all nets touched by the peturbation
diff --git a/ice40/chains.cc b/ice40/chains.cc
index 5b834c07..b1ad1007 100644
--- a/ice40/chains.cc
+++ b/ice40/chains.cc
@@ -277,6 +277,6 @@ class ChainConstrainer
void constrain_chains() { process_carries(); }
};
-void constrain_chains(Context *ctx) { ChainConstrainer(ctx).constrain_chains(); }
+void constrain_chains(Context *ctx) { log_info("Constraining chains...\n"); ChainConstrainer(ctx).constrain_chains(); }
NEXTPNR_NAMESPACE_END
diff --git a/ice40/pack.cc b/ice40/pack.cc
index fc182e98..9700bc5d 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -26,6 +26,7 @@
#include "design_utils.h"
#include "log.h"
#include "util.h"
+#include "chains.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -893,6 +894,8 @@ bool Arch::pack()
pack_ram(ctx);
pack_special(ctx);
ctx->assignArchInfo();
+ constrain_chains(ctx);
+ ctx->assignArchInfo();
log_info("Checksum: 0x%08x\n", ctx->checksum());
return true;
} catch (log_execution_error_exception) {