Merge pull request #30 from eddiehung/slack_redist_freq

Slack redistribution to auto-tune frequency only if --freq 0 set
This commit is contained in:
Eddie Hung 2018-08-03 23:51:21 -07:00 committed by GitHub
commit f5a1b93f0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 19 deletions

View File

@ -472,7 +472,7 @@ struct Context : Arch, DeterministicRNG
bool force = false; bool force = false;
bool timing_driven = true; bool timing_driven = true;
float target_freq = 12e6; float target_freq = 12e6;
bool user_freq = false; bool auto_freq = false;
int slack_redist_iter = 0; int slack_redist_iter = 0;
Context(ArchArgs args) : Arch(args) {} Context(ArchArgs args) : Arch(args) {}

View File

@ -125,7 +125,7 @@ void assign_budget(Context *ctx, bool quiet)
{ {
if (!quiet) { if (!quiet) {
log_break(); log_break();
log_info("Annotating ports with timing budgets\n"); log_info("Annotating ports with timing budgets for target frequency %.2f MHz\n", ctx->target_freq/1e6);
} }
// Clear delays to a very high value first // Clear delays to a very high value first
@ -142,7 +142,7 @@ void assign_budget(Context *ctx, bool quiet)
for (auto &net : ctx->nets) { for (auto &net : ctx->nets) {
for (auto &user : net.second->users) { for (auto &user : net.second->users) {
// Post-update check // Post-update check
if (ctx->user_freq && user.budget < 0) if (!ctx->auto_freq && user.budget < 0)
log_warning("port %s.%s, connected to net '%s', has negative " log_warning("port %s.%s, connected to net '%s', has negative "
"timing budget of %fns\n", "timing budget of %fns\n",
user.cell->name.c_str(ctx), user.port.c_str(ctx), net.first.c_str(ctx), user.cell->name.c_str(ctx), user.port.c_str(ctx), net.first.c_str(ctx),
@ -159,11 +159,11 @@ void assign_budget(Context *ctx, bool quiet)
// For slack redistribution, if user has not specified a frequency // For slack redistribution, if user has not specified a frequency
// dynamically adjust the target frequency to be the currently // dynamically adjust the target frequency to be the currently
// achieved maximum // achieved maximum
if (!ctx->user_freq && ctx->slack_redist_iter > 0) { if (ctx->auto_freq && ctx->slack_redist_iter > 0) {
ctx->target_freq = 1e12 / (default_slack - min_slack); 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, log_info("minimum slack for this assign = %d, target Fmax for next update = %.2f MHz\n", min_slack,
ctx->target_freq / 1e6); ctx->target_freq / 1e6);
} }
if (!quiet) if (!quiet)

View File

@ -162,12 +162,8 @@ int main(int argc, char *argv[])
if (!ctx->pack() && !ctx->force) if (!ctx->pack() && !ctx->force)
log_error("Packing design failed.\n"); log_error("Packing design failed.\n");
if (vm.count("freq")) { if (vm.count("freq"))
ctx->target_freq = vm["freq"].as<double>() * 1e6; ctx->target_freq = vm["freq"].as<double>() * 1e6;
ctx->user_freq = true;
} else {
log_warning("Target frequency not specified. Will optimise for max frequency.\n");
}
assign_budget(ctx.get()); assign_budget(ctx.get());
ctx->check(); ctx->check();
print_utilisation(ctx.get()); print_utilisation(ctx.get());

View File

@ -319,6 +319,13 @@ int main(int argc, char *argv[])
if (vm.count("slack_redist_iter")) { if (vm.count("slack_redist_iter")) {
ctx->slack_redist_iter = vm["slack_redist_iter"].as<int>(); ctx->slack_redist_iter = vm["slack_redist_iter"].as<int>();
if (vm.count("freq") && vm["freq"].as<double>() == 0) {
ctx->auto_freq = true;
#ifndef NO_GUI
if (!vm.count("gui"))
#endif
log_warning("Target frequency not specified. Will optimise for max frequency.\n");
}
} }
if (vm.count("cstrweight")) { if (vm.count("cstrweight")) {
@ -385,13 +392,9 @@ int main(int argc, char *argv[])
} }
if (vm.count("freq")) { if (vm.count("freq")) {
ctx->target_freq = vm["freq"].as<double>() * 1e6; auto freq = vm["freq"].as<double>();
ctx->user_freq = true; if (freq > 0)
} else { ctx->target_freq = freq * 1e6;
#ifndef NO_GUI
if (!vm.count("gui"))
#endif
log_warning("Target frequency not specified. Will optimise for max frequency.\n");
} }
ctx->timing_driven = true; ctx->timing_driven = true;