From 720e81586502f527cba7b9052b6bfed719c0b165 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Tue, 31 Jul 2018 19:07:39 -0700 Subject: Add --slack_redist_iter for ice40 --- common/nextpnr.h | 1 + common/placer1.cc | 2 +- common/router1.cc | 4 ++-- common/timing.cc | 9 +++++---- ice40/main.cc | 6 +++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common/nextpnr.h b/common/nextpnr.h index 38a313fd..b163300a 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -476,6 +476,7 @@ struct Context : Arch, DeterministicRNG bool timing_driven = true; float target_freq = 12e6; bool user_freq = false; + int slack_redist_iter = 0; Context(ArchArgs args) : Arch(args) {} diff --git a/common/placer1.cc b/common/placer1.cc index f2777a08..278bf466 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -237,7 +237,7 @@ class SAPlacer diameter *= post_legalise_dia_scale; ctx->shuffle(autoplaced); assign_budget(ctx); - } else { + } else if (iter % ctx->slack_redist_iter == 0) { assign_budget(ctx, true /* quiet */); } diff --git a/common/router1.cc b/common/router1.cc index 0bd257fd..5fffbc6d 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -615,8 +615,8 @@ bool router1(Context *ctx) if (ctx->verbose || iterCnt == 1) log_info("routing queue contains %d jobs.\n", int(jobQueue.size())); - - assign_budget(ctx, true /* quiet */); + else if (iterCnt % ctx->slack_redist_iter == 0) + assign_budget(ctx, true /* quiet */); bool printNets = ctx->verbose && (jobQueue.size() < 10); diff --git a/common/timing.cc b/common/timing.cc index 1d69861b..1b3fd040 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -157,11 +157,12 @@ void assign_budget(Context *ctx, bool quiet) } } - // If user has not specified a frequency, dynamically adjust the target - // frequency to be the current maximum - if (!ctx->user_freq) { + // For slack redistribution, if user has not specified a frequency + // dynamically adjust the target frequency to be the currently + // achieved maximum + if (!ctx->user_freq && ctx->slack_redist_iter > 0) { ctx->target_freq = 1e12 / (default_slack - min_slack); - if (ctx->verbose) + /*if (ctx->verbose)*/ log_info("minimum slack for this assign = %d, target Fmax for next update = %.2f MHz\n", min_slack, ctx->target_freq / 1e6); } diff --git a/ice40/main.cc b/ice40/main.cc index 5c9678db..ab672ddc 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -105,6 +105,7 @@ int main(int argc, char *argv[]) options.add_options()("asc", po::value(), "asc bitstream file to write"); options.add_options()("read", po::value(), "asc bitstream file to read"); options.add_options()("seed", po::value(), "seed value for random number generator"); + options.add_options()("slack_redist_iter", po::value(), "number of iterations between slack redistribution"); options.add_options()("version,V", "show version"); options.add_options()("tmfuzz", "run path delay estimate fuzzer"); options.add_options()("test", "check architecture database integrity"); @@ -302,6 +303,10 @@ int main(int argc, char *argv[]) ctx->rngseed(vm["seed"].as()); } + if (vm.count("slack_redist_iter")) { + ctx->slack_redist_iter = vm["slack_redist_iter"].as(); + } + if (vm.count("svg")) { std::cout << "\n"; @@ -411,7 +416,6 @@ int main(int argc, char *argv[]) if (!ctx->pack() && !ctx->force) log_error("Packing design failed.\n"); - //assign_budget(ctx.get()); ctx->check(); print_utilisation(ctx.get()); if (!vm.count("pack-only")) { -- cgit v1.2.3