From f048deb33dcc1f334fbe54877bdeb4ce4a5ca35d Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 5 Aug 2018 22:55:58 -0700 Subject: [PATCH 1/4] Restore initial assign_budget() call after pack(), restrict call after initial_placement to slack_redist --- common/placer1.cc | 3 ++- ice40/main.cc | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/placer1.cc b/common/placer1.cc index 4ba0f3cf..1d00e77a 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -138,7 +138,8 @@ class SAPlacer if ((placed_cells - constr_placed_cells) % 500 != 0) log_info(" initial placement placed %d/%d cells\n", int(placed_cells - constr_placed_cells), int(autoplaced.size())); - assign_budget(ctx); + if (ctx->slack_redist_iter > 0) + assign_budget(ctx); ctx->yield(); log_info("Running simulated annealing placer.\n"); diff --git a/ice40/main.cc b/ice40/main.cc index 358bf3c5..78236af1 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -366,6 +366,7 @@ 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")) { From 9b414594d2aad06e8cd9a6b767d90dcaa2b90597 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 5 Aug 2018 23:00:15 -0700 Subject: [PATCH 2/4] Unless slack_redist is enabled, ignore net delays so that budget gets evenly divided between all nets on path --- common/timing.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/timing.cc b/common/timing.cc index d37a0f59..3fa67122 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -58,7 +58,7 @@ struct Timing net_budget = budget; pl = std::max(1, path_length); } - auto delay = ctx->getNetinfoRouteDelay(net, usr); + auto delay = ctx->slack_redist_iter > 0 ? ctx->getNetinfoRouteDelay(net, usr) : delay_t(); net_budget = std::min(net_budget, follow_user_port(usr, pl, slack - delay)); if (update) usr.budget = std::min(usr.budget, delay + net_budget); From fa773c3ce9fb909017c2766e3ddbe4afd611a80e Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 6 Aug 2018 07:18:06 -0700 Subject: [PATCH 3/4] Add net_delays bool to Timing class to control net delay consideration --- common/timing.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index 3fa67122..78ec4ea7 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -32,14 +32,15 @@ typedef std::map DelayFrequency; struct Timing { Context *ctx; + bool net_delays; bool update; delay_t min_slack; PortRefVector current_path; PortRefVector *crit_path; DelayFrequency *slack_histogram; - Timing(Context *ctx, bool update, PortRefVector *crit_path = nullptr, DelayFrequency *slack_histogram = nullptr) - : ctx(ctx), update(update), min_slack(1.0e12 / ctx->target_freq), crit_path(crit_path), + Timing(Context *ctx, bool net_delays, bool update, PortRefVector *crit_path = nullptr, DelayFrequency *slack_histogram = nullptr) + : ctx(ctx), net_delays(net_delays), update(update), min_slack(1.0e12 / ctx->target_freq), crit_path(crit_path), slack_histogram(slack_histogram) { } @@ -58,7 +59,7 @@ struct Timing net_budget = budget; pl = std::max(1, path_length); } - auto delay = ctx->slack_redist_iter > 0 ? ctx->getNetinfoRouteDelay(net, usr) : delay_t(); + auto delay = net_delays ? ctx->getNetinfoRouteDelay(net, usr) : delay_t(); net_budget = std::min(net_budget, follow_user_port(usr, pl, slack - delay)); if (update) usr.budget = std::min(usr.budget, delay + net_budget); @@ -152,7 +153,7 @@ void assign_budget(Context *ctx, bool quiet) log_info("Annotating ports with timing budgets for target frequency %.2f MHz\n", ctx->target_freq/1e6); } - Timing timing(ctx, true /* update */); + Timing timing(ctx, ctx->slack_redist_iter > 0 /* net_delays */, true /* update */); timing.assign_budget(); if (!quiet || ctx->verbose) { @@ -194,7 +195,7 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_path) PortRefVector crit_path; DelayFrequency slack_histogram; - Timing timing(ctx, false /* update */, print_path ? &crit_path : nullptr, + Timing timing(ctx, true /* net_delays */, false /* update */, print_path ? &crit_path : nullptr, print_histogram ? &slack_histogram : nullptr); auto min_slack = timing.walk_paths(); From 2fb934b107d63b43afcde0e724a91c33500fe95c Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 6 Aug 2018 07:19:32 -0700 Subject: [PATCH 4/4] clangformat --- common/timing.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index 78ec4ea7..ae5783cd 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -39,9 +39,10 @@ struct Timing PortRefVector *crit_path; DelayFrequency *slack_histogram; - Timing(Context *ctx, bool net_delays, bool update, PortRefVector *crit_path = nullptr, DelayFrequency *slack_histogram = nullptr) - : ctx(ctx), net_delays(net_delays), update(update), min_slack(1.0e12 / ctx->target_freq), crit_path(crit_path), - slack_histogram(slack_histogram) + Timing(Context *ctx, bool net_delays, bool update, PortRefVector *crit_path = nullptr, + DelayFrequency *slack_histogram = nullptr) + : ctx(ctx), net_delays(net_delays), update(update), min_slack(1.0e12 / ctx->target_freq), + crit_path(crit_path), slack_histogram(slack_histogram) { } @@ -150,7 +151,7 @@ void assign_budget(Context *ctx, bool quiet) { if (!quiet) { log_break(); - log_info("Annotating ports with timing budgets for target frequency %.2f MHz\n", ctx->target_freq/1e6); + log_info("Annotating ports with timing budgets for target frequency %.2f MHz\n", ctx->target_freq / 1e6); } Timing timing(ctx, ctx->slack_redist_iter > 0 /* net_delays */, true /* update */);