diff options
author | David Shah <davey1576@gmail.com> | 2018-08-03 18:31:54 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-08-03 18:31:54 +0200 |
commit | b937e6defea82c12227b6e00cf19e370b237ea8b (patch) | |
tree | 7940016c021225ad7eb7c20d00dd69cb1513fe6c /common/placer1.cc | |
parent | 4a751d9aafa0de4f64960bf7e9f16400319259ef (diff) | |
download | nextpnr-b937e6defea82c12227b6e00cf19e370b237ea8b.tar.gz nextpnr-b937e6defea82c12227b6e00cf19e370b237ea8b.tar.bz2 nextpnr-b937e6defea82c12227b6e00cf19e370b237ea8b.zip |
Add constraint weight as a command line option
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common/placer1.cc')
-rw-r--r-- | common/placer1.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/common/placer1.cc b/common/placer1.cc index 6da8608a..37294dfd 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -46,7 +46,7 @@ NEXTPNR_NAMESPACE_BEGIN class SAPlacer { public: - SAPlacer(Context *ctx) : ctx(ctx) + SAPlacer(Context *ctx, Placer1Cfg cfg) : ctx(ctx), cfg(cfg) { int num_bel_types = 0; for (auto bel : ctx->getBels()) { @@ -395,7 +395,7 @@ private: if (other != IdString()) new_dist += get_constraints_distance(ctx, other_cell); delta = new_metric - curr_metric; - delta += (10 / temp) * (new_dist - old_dist); + delta += (cfg.constraintWeight / temp) * (new_dist - old_dist); n_move++; // SA acceptance criterea if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) { @@ -458,12 +458,13 @@ private: const float legalise_temp = 1; const float post_legalise_temp = 10; const float post_legalise_dia_scale = 1.5; + Placer1Cfg cfg; }; -bool placer1(Context *ctx) +bool placer1(Context *ctx, Placer1Cfg cfg) { try { - SAPlacer placer(ctx); + SAPlacer placer(ctx, cfg); placer.place(); log_info("Checksum: 0x%08x\n", ctx->checksum()); #ifndef NDEBUG |