Reworking packer and placer to use new generic rel legaliser
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
e5dea28dbd
commit
7e9209878c
@ -189,9 +189,15 @@ class ConstraintLegaliseWorker
|
|||||||
diameter = 1;
|
diameter = 1;
|
||||||
} else if (sign == -1) {
|
} else if (sign == -1) {
|
||||||
sign = 1;
|
sign = 1;
|
||||||
|
if ((start + sign * diameter) > max)
|
||||||
|
sign = -1;
|
||||||
++diameter;
|
++diameter;
|
||||||
} else {
|
} else {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
|
if ((start + sign * diameter) > max) {
|
||||||
|
sign = 1;
|
||||||
|
++diameter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ class SAPlacer
|
|||||||
// Once cooled below legalise threshold, run legalisation and start requiring
|
// Once cooled below legalise threshold, run legalisation and start requiring
|
||||||
// legal moves only
|
// legal moves only
|
||||||
if (temp < legalise_temp && !require_legal) {
|
if (temp < legalise_temp && !require_legal) {
|
||||||
// legalise_design(ctx);
|
legalise_relative_constraints(ctx);
|
||||||
// FIXME
|
// FIXME
|
||||||
require_legal = true;
|
require_legal = true;
|
||||||
autoplaced.clear();
|
autoplaced.clear();
|
||||||
@ -294,7 +294,7 @@ class SAPlacer
|
|||||||
}
|
}
|
||||||
BelType targetType = ctx->belTypeFromId(cell->type);
|
BelType targetType = ctx->belTypeFromId(cell->type);
|
||||||
for (auto bel : ctx->getBels()) {
|
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)) {
|
if (ctx->checkBelAvail(bel)) {
|
||||||
uint64_t score = ctx->rng64();
|
uint64_t score = ctx->rng64();
|
||||||
if (score <= best_score) {
|
if (score <= best_score) {
|
||||||
@ -364,14 +364,13 @@ class SAPlacer
|
|||||||
if (other != IdString()) {
|
if (other != IdString()) {
|
||||||
ctx->bindBel(oldBel, other_cell->name, STRENGTH_WEAK);
|
ctx->bindBel(oldBel, other_cell->name, STRENGTH_WEAK);
|
||||||
}
|
}
|
||||||
if (require_legal) {
|
|
||||||
if (!ctx->isBelLocationValid(newBel) || ((other != IdString() && !ctx->isBelLocationValid(oldBel)))) {
|
if (!ctx->isBelLocationValid(newBel) || ((other != IdString() && !ctx->isBelLocationValid(oldBel)))) {
|
||||||
ctx->unbindBel(newBel);
|
ctx->unbindBel(newBel);
|
||||||
if (other != IdString())
|
if (other != IdString())
|
||||||
ctx->unbindBel(oldBel);
|
ctx->unbindBel(oldBel);
|
||||||
goto swap_fail;
|
goto swap_fail;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
new_metric = curr_metric;
|
new_metric = curr_metric;
|
||||||
|
|
||||||
|
@ -277,6 +277,6 @@ class ChainConstrainer
|
|||||||
void constrain_chains() { process_carries(); }
|
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
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "chains.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -893,6 +894,8 @@ bool Arch::pack()
|
|||||||
pack_ram(ctx);
|
pack_ram(ctx);
|
||||||
pack_special(ctx);
|
pack_special(ctx);
|
||||||
ctx->assignArchInfo();
|
ctx->assignArchInfo();
|
||||||
|
constrain_chains(ctx);
|
||||||
|
ctx->assignArchInfo();
|
||||||
log_info("Checksum: 0x%08x\n", ctx->checksum());
|
log_info("Checksum: 0x%08x\n", ctx->checksum());
|
||||||
return true;
|
return true;
|
||||||
} catch (log_execution_error_exception) {
|
} catch (log_execution_error_exception) {
|
||||||
|
Loading…
Reference in New Issue
Block a user