diff options
author | Eddie Hung <eddieh@ece.ubc.ca> | 2018-07-28 14:10:48 -0700 |
---|---|---|
committer | Eddie Hung <eddieh@ece.ubc.ca> | 2018-07-28 14:10:48 -0700 |
commit | de6d0d20d7d8e4d79fe1f96bc44945326c230fc4 (patch) | |
tree | 6217bbd667d6186ffa9dc89c5dda2aaeac357009 /common | |
parent | 0eaa92bd6a160696c2f221501d610c99d9231bef (diff) | |
download | nextpnr-de6d0d20d7d8e4d79fe1f96bc44945326c230fc4.tar.gz nextpnr-de6d0d20d7d8e4d79fe1f96bc44945326c230fc4.tar.bz2 nextpnr-de6d0d20d7d8e4d79fe1f96bc44945326c230fc4.zip |
Merge update_budget into assign_budget; update as we go along
Diffstat (limited to 'common')
-rw-r--r-- | common/placer1.cc | 2 | ||||
-rw-r--r-- | common/router1.cc | 2 | ||||
-rw-r--r-- | common/timing.cc | 57 | ||||
-rw-r--r-- | common/timing.h | 5 |
4 files changed, 17 insertions, 49 deletions
diff --git a/common/placer1.cc b/common/placer1.cc index d0771e5c..c677a22a 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -237,7 +237,7 @@ class SAPlacer ctx->shuffle(autoplaced); assign_budget(ctx); } else { - update_budget(ctx); + assign_budget(ctx, true /* quiet */); } // Recalculate total metric entirely to avoid rounding errors diff --git a/common/router1.cc b/common/router1.cc index d1551363..e18f27fb 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -616,7 +616,7 @@ bool router1(Context *ctx) if (ctx->verbose || iterCnt == 1) log_info("routing queue contains %d jobs.\n", int(jobQueue.size())); - update_budget(ctx); + assign_budget(ctx, true /* quiet */); bool printNets = ctx->verbose && (jobQueue.size() < 10); diff --git a/common/timing.cc b/common/timing.cc index 20cfd1b5..5a9d8c02 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -83,11 +83,12 @@ static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t s net_budget = budget; pl = std::max(1, path_length); } + auto delay = ctx->getNetinfoRouteDelay(net, i); net_budget = std::min(net_budget, - follow_user_port(ctx, usr, pl, slack - ctx->getNetinfoRouteDelay(net, i), + follow_user_port(ctx, usr, pl, slack - delay, update, min_slack, current_path, crit_path)); if (update) - usr.budget = std::min(usr.budget, net_budget); + usr.budget = std::min(usr.budget, delay + net_budget); if (crit_path) current_path->pop_back(); } @@ -123,10 +124,13 @@ static delay_t walk_paths(Context *ctx, bool update, PortRefList *crit_path) return min_slack; } -void assign_budget(Context *ctx) +void assign_budget(Context *ctx, bool quiet) { - log_break(); - log_info("Annotating ports with timing budgets\n"); + if (!quiet) { + 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 / ctx->target_freq); for (auto &net : ctx->nets) { @@ -137,42 +141,7 @@ void assign_budget(Context *ctx) delay_t min_slack = walk_paths(ctx, true, nullptr); - for (auto &net : ctx->nets) { - for (auto &user : net.second->users) { - // Post-update check - if (ctx->user_freq && user.budget < 0) - log_warning("port %s.%s, connected to net '%s', has negative " - "timing budget of %fns\n", - user.cell->name.c_str(ctx), user.port.c_str(ctx), net.first.c_str(ctx), - ctx->getDelayNS(user.budget)); - if (ctx->verbose) - log_info("port %s.%s, connected to net '%s', has " - "timing budget of %fns\n", - user.cell->name.c_str(ctx), user.port.c_str(ctx), net.first.c_str(ctx), - ctx->getDelayNS(user.budget)); - } - } - - // If user has not specified a frequency, adjust the target frequency dynamically - // TODO(eddieh): Tune these factors - if (!ctx->user_freq) { - if (min_slack < 0) - ctx->target_freq = 1e12 / (default_slack - 0.95 * min_slack); - else - ctx->target_freq = 1e12 / (default_slack - 1.2 * min_slack); - 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); - } - - log_info("Checksum: 0x%08x\n", ctx->checksum()); -} - -void update_budget(Context *ctx) -{ - delay_t min_slack = walk_paths(ctx, true, nullptr); - - if (ctx->verbose) { + if (!quiet || ctx->verbose) { for (auto &net : ctx->nets) { for (auto &user : net.second->users) { // Post-update check @@ -181,7 +150,7 @@ void update_budget(Context *ctx) "timing budget of %fns\n", user.cell->name.c_str(ctx), user.port.c_str(ctx), net.first.c_str(ctx), ctx->getDelayNS(user.budget)); - else + else if (ctx->verbose) log_info("port %s.%s, connected to net '%s', has " "timing budget of %fns\n", user.cell->name.c_str(ctx), user.port.c_str(ctx), net.first.c_str(ctx), @@ -193,7 +162,6 @@ void update_budget(Context *ctx) // If user has not specified a frequency, adjust the target frequency dynamically // TODO(eddieh): Tune these factors if (!ctx->user_freq) { - delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); if (min_slack < 0) ctx->target_freq = 1e12 / (default_slack - 0.95 * min_slack); else @@ -202,6 +170,9 @@ void update_budget(Context *ctx) log_info("minimum slack for this assign = %d, target Fmax for next update = %.2f MHz\n", min_slack, ctx->target_freq / 1e6); } + + if (!quiet) + log_info("Checksum: 0x%08x\n", ctx->checksum()); } delay_t timing_analysis(Context *ctx, bool print_fmax, bool print_path) diff --git a/common/timing.h b/common/timing.h index de4f7bbe..d0159d5c 100644 --- a/common/timing.h +++ b/common/timing.h @@ -24,11 +24,8 @@ NEXTPNR_NAMESPACE_BEGIN -// Assign "budget" values for all user ports in the design -void assign_budget(Context *ctx); - // Evenly redistribute the total path slack amongst all sinks on each path -void update_budget(Context *ctx); +void assign_budget(Context *ctx, bool quiet = false); // Perform timing analysis and return the minimum path slack, // optionally, print out the fmax and critical path |