Merge update_budget into assign_budget; update as we go along
This commit is contained in:
parent
0eaa92bd6a
commit
de6d0d20d7
@ -237,7 +237,7 @@ class SAPlacer
|
|||||||
ctx->shuffle(autoplaced);
|
ctx->shuffle(autoplaced);
|
||||||
assign_budget(ctx);
|
assign_budget(ctx);
|
||||||
} else {
|
} else {
|
||||||
update_budget(ctx);
|
assign_budget(ctx, true /* quiet */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recalculate total metric entirely to avoid rounding errors
|
// Recalculate total metric entirely to avoid rounding errors
|
||||||
|
@ -616,7 +616,7 @@ bool router1(Context *ctx)
|
|||||||
if (ctx->verbose || iterCnt == 1)
|
if (ctx->verbose || iterCnt == 1)
|
||||||
log_info("routing queue contains %d jobs.\n", int(jobQueue.size()));
|
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);
|
bool printNets = ctx->verbose && (jobQueue.size() < 10);
|
||||||
|
|
||||||
|
@ -83,11 +83,12 @@ static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t s
|
|||||||
net_budget = budget;
|
net_budget = budget;
|
||||||
pl = std::max(1, path_length);
|
pl = std::max(1, path_length);
|
||||||
}
|
}
|
||||||
|
auto delay = ctx->getNetinfoRouteDelay(net, i);
|
||||||
net_budget = std::min(net_budget,
|
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));
|
update, min_slack, current_path, crit_path));
|
||||||
if (update)
|
if (update)
|
||||||
usr.budget = std::min(usr.budget, net_budget);
|
usr.budget = std::min(usr.budget, delay + net_budget);
|
||||||
if (crit_path)
|
if (crit_path)
|
||||||
current_path->pop_back();
|
current_path->pop_back();
|
||||||
}
|
}
|
||||||
@ -123,10 +124,13 @@ static delay_t walk_paths(Context *ctx, bool update, PortRefList *crit_path)
|
|||||||
return min_slack;
|
return min_slack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void assign_budget(Context *ctx)
|
void assign_budget(Context *ctx, bool quiet)
|
||||||
{
|
{
|
||||||
log_break();
|
if (!quiet) {
|
||||||
log_info("Annotating ports with timing budgets\n");
|
log_break();
|
||||||
|
log_info("Annotating ports with timing budgets\n");
|
||||||
|
}
|
||||||
|
|
||||||
// Clear delays to a very high value first
|
// Clear delays to a very high value first
|
||||||
delay_t default_slack = delay_t(1.0e12 / ctx->target_freq);
|
delay_t default_slack = delay_t(1.0e12 / ctx->target_freq);
|
||||||
for (auto &net : ctx->nets) {
|
for (auto &net : ctx->nets) {
|
||||||
@ -137,42 +141,7 @@ void assign_budget(Context *ctx)
|
|||||||
|
|
||||||
delay_t min_slack = walk_paths(ctx, true, nullptr);
|
delay_t min_slack = walk_paths(ctx, true, nullptr);
|
||||||
|
|
||||||
for (auto &net : ctx->nets) {
|
if (!quiet || ctx->verbose) {
|
||||||
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) {
|
|
||||||
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
|
||||||
@ -181,7 +150,7 @@ void update_budget(Context *ctx)
|
|||||||
"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),
|
||||||
ctx->getDelayNS(user.budget));
|
ctx->getDelayNS(user.budget));
|
||||||
else
|
else if (ctx->verbose)
|
||||||
log_info("port %s.%s, connected to net '%s', has "
|
log_info("port %s.%s, connected to net '%s', has "
|
||||||
"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),
|
||||||
@ -193,7 +162,6 @@ void update_budget(Context *ctx)
|
|||||||
// If user has not specified a frequency, adjust the target frequency dynamically
|
// If user has not specified a frequency, adjust the target frequency dynamically
|
||||||
// TODO(eddieh): Tune these factors
|
// TODO(eddieh): Tune these factors
|
||||||
if (!ctx->user_freq) {
|
if (!ctx->user_freq) {
|
||||||
delay_t default_slack = delay_t(1.0e12 / ctx->target_freq);
|
|
||||||
if (min_slack < 0)
|
if (min_slack < 0)
|
||||||
ctx->target_freq = 1e12 / (default_slack - 0.95 * min_slack);
|
ctx->target_freq = 1e12 / (default_slack - 0.95 * min_slack);
|
||||||
else
|
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,
|
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)
|
||||||
|
log_info("Checksum: 0x%08x\n", ctx->checksum());
|
||||||
}
|
}
|
||||||
|
|
||||||
delay_t timing_analysis(Context *ctx, bool print_fmax, bool print_path)
|
delay_t timing_analysis(Context *ctx, bool print_fmax, bool print_path)
|
||||||
|
@ -24,11 +24,8 @@
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
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
|
// 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,
|
// Perform timing analysis and return the minimum path slack,
|
||||||
// optionally, print out the fmax and critical path
|
// optionally, print out the fmax and critical path
|
||||||
|
Loading…
Reference in New Issue
Block a user