diff options
author | David Shah <davey1576@gmail.com> | 2018-06-29 17:04:22 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-29 17:04:22 +0200 |
commit | 27e7bc3b4bb04b395db6456b71f31f98607a4298 (patch) | |
tree | 2e936cb9c61140719fa58120423e63007ea07e17 /common | |
parent | d908928b56917c02db4d8127b7c594b1225ba974 (diff) | |
download | nextpnr-27e7bc3b4bb04b395db6456b71f31f98607a4298.tar.gz nextpnr-27e7bc3b4bb04b395db6456b71f31f98607a4298.tar.bz2 nextpnr-27e7bc3b4bb04b395db6456b71f31f98607a4298.zip |
Improving the SA+legalisation flow
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/nextpnr.h | 2 | ||||
-rw-r--r-- | common/place_common.cc | 2 | ||||
-rw-r--r-- | common/place_common.h | 3 | ||||
-rw-r--r-- | common/place_sa.cc | 4 | ||||
-rw-r--r-- | common/timing.cc | 6 | ||||
-rw-r--r-- | common/timing.h | 2 |
6 files changed, 12 insertions, 7 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index 8d4714bf..b647d44c 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -230,7 +230,7 @@ struct Context : Arch bool debug = false; bool force = false; bool timing_driven = true; - + float target_freq = 12e6; Context(ArchArgs args) : Arch(args) {} // -------------------------------------------------------------- diff --git a/common/place_common.cc b/common/place_common.cc index 95faf67f..60735890 100644 --- a/common/place_common.cc +++ b/common/place_common.cc @@ -91,7 +91,7 @@ wirelen_t get_cell_wirelength(const Context *ctx, const CellInfo *cell) return wirelength; } -static wirelen_t get_cell_wirelength_at_bel(const Context *ctx, CellInfo *cell, BelId bel) +wirelen_t get_cell_wirelength_at_bel(const Context *ctx, CellInfo *cell, BelId bel) { BelId oldBel = cell->bel; cell->bel = bel; diff --git a/common/place_common.h b/common/place_common.h index f58da450..67956072 100644 --- a/common/place_common.h +++ b/common/place_common.h @@ -32,6 +32,9 @@ wirelen_t get_net_wirelength(const Context *ctx, const NetInfo *net, float &tns) // Return the wirelength of all nets connected to a cell wirelen_t get_cell_wirelength(const Context *ctx, const CellInfo *cell); +// Return the wirelength of all nets connected to a cell, when the cell is at a given bel +wirelen_t get_cell_wirelength_at_bel(const Context *ctx, CellInfo *cell, BelId bel); + // Place a single cell in the lowest wirelength Bel available, optionally requiring validity check bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality); diff --git a/common/place_sa.cc b/common/place_sa.cc index c0c1b180..b773bb68 100644 --- a/common/place_sa.cc +++ b/common/place_sa.cc @@ -207,7 +207,8 @@ class SAPlacer temp *= 0.8; } } - + // Once cooled below legalise threshold, run legalisation and start requiring + // legal moves only if (temp < legalise_temp && !require_legal) { legalise_design(ctx); require_legal = true; @@ -219,6 +220,7 @@ class SAPlacer temp = post_legalise_temp; diameter *= post_legalise_dia_scale; ctx->shuffle(autoplaced); + assign_budget(ctx); } // Recalculate total wirelength entirely to avoid rounding errors diff --git a/common/timing.cc b/common/timing.cc index 9b10068e..3a48935f 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -70,12 +70,12 @@ static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t s return net_budget; } -void assign_budget(Context *ctx, float default_clock) +void assign_budget(Context *ctx) { log_break(); log_info("Annotating ports with timing budgets\n"); // Clear delays to a very high value first - delay_t default_slack = delay_t(1.0e12 / default_clock); + delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); for (auto &net : ctx->nets) { for (auto &usr : net.second->users) { usr.budget = default_slack; @@ -87,7 +87,7 @@ void assign_budget(Context *ctx, float default_clock) if (port.second.type == PORT_OUT) { IdString clock_domain = ctx->getPortClock(cell.second.get(), port.first); if (clock_domain != IdString()) { - delay_t slack = delay_t(1.0e12 / default_clock); // TODO: clock constraints + delay_t slack = delay_t(1.0e12 / ctx->target_freq); // TODO: clock constraints if (port.second.net) follow_net(ctx, port.second.net, 0, slack); } diff --git a/common/timing.h b/common/timing.h index 03ae048d..025e4a76 100644 --- a/common/timing.h +++ b/common/timing.h @@ -25,7 +25,7 @@ NEXTPNR_NAMESPACE_BEGIN // Assign "budget" values for all user ports in the design -void assign_budget(Context *ctx, float default_clock = 12e6); +void assign_budget(Context *ctx); NEXTPNR_NAMESPACE_END |