aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/placer1.cc3
-rw-r--r--common/timing.cc37
-rw-r--r--ecp5/arch.cc5
-rw-r--r--ecp5/arch.h2
-rw-r--r--ecp5/main.cc3
-rw-r--r--generic/arch.cc5
-rw-r--r--generic/arch.h2
7 files changed, 29 insertions, 28 deletions
diff --git a/common/placer1.cc b/common/placer1.cc
index d38cdd4b..12bf470f 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -239,8 +239,7 @@ class SAPlacer
diameter *= post_legalise_dia_scale;
ctx->shuffle(autoplaced);
assign_budget(ctx);
- }
- else {
+ } else {
update_budget(ctx);
}
diff --git a/common/timing.cc b/common/timing.cc
index 784952f8..1da7efba 100644
--- a/common/timing.cc
+++ b/common/timing.cc
@@ -26,12 +26,14 @@
NEXTPNR_NAMESPACE_BEGIN
-typedef std::unordered_map<const PortInfo*, delay_t> UpdateMap;
+typedef std::unordered_map<const PortInfo *, delay_t> UpdateMap;
-static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, UpdateMap &updates, delay_t &min_slack);
+static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, UpdateMap &updates,
+ delay_t &min_slack);
// Follow a path, returning budget to annotate
-static delay_t follow_user_port(Context *ctx, PortRef &user, int path_length, delay_t slack, UpdateMap &updates, delay_t &min_slack)
+static delay_t follow_user_port(Context *ctx, PortRef &user, int path_length, delay_t slack, UpdateMap &updates,
+ delay_t &min_slack)
{
delay_t value;
if (ctx->getPortClock(user.cell, user.port) != IdString()) {
@@ -66,12 +68,15 @@ static delay_t follow_user_port(Context *ctx, PortRef &user, int path_length, de
return value;
}
-static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, UpdateMap &updates, delay_t &min_slack)
+static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, UpdateMap &updates,
+ delay_t &min_slack)
{
delay_t net_budget = slack / (path_length + 1);
for (unsigned i = 0; i < net->users.size(); ++i) {
auto &usr = net->users[i];
- net_budget = std::min(net_budget, follow_user_port(ctx, usr, path_length + 1, slack - ctx->getNetinfoRouteDelay(net, i), updates, min_slack));
+ net_budget =
+ std::min(net_budget, follow_user_port(ctx, usr, path_length + 1,
+ slack - ctx->getNetinfoRouteDelay(net, i), updates, min_slack));
}
return net_budget;
}
@@ -81,7 +86,7 @@ static UpdateMap compute_min_slack(Context *ctx, delay_t &min_slack)
UpdateMap updates;
delay_t default_slack = delay_t(1.0e12 / ctx->target_freq);
- // Go through all clocked drivers and distribute the available path
+ // Go through all clocked drivers and distribute the available path
// slack evenly into the budget of every sink on the path ---
// record this value into the UpdateMap
for (auto &cell : ctx->cells) {
@@ -119,21 +124,23 @@ void assign_budget(Context *ctx)
delay_t min_slack = default_slack;
auto updates = compute_min_slack(ctx, min_slack);
- // If user has not specified a frequency, adjust the target frequency
+ // If user has not specified a frequency, adjust the target frequency
// to be equivalent to the critical path
if (!ctx->user_freq) {
ctx->target_freq = 1e12 / (default_slack - min_slack);
if (ctx->verbose)
- log_info("minimum slack for this assign = %d, target Fmax for next update = %f\n", min_slack, ctx->target_freq/1e6);
+ log_info("minimum slack for this assign = %d, target Fmax for next update = %f\n", min_slack,
+ ctx->target_freq / 1e6);
}
// Update the budgets
for (auto &net : ctx->nets) {
for (size_t i = 0; i < net.second->users.size(); ++i) {
- auto& user = net.second->users[i];
+ auto &user = net.second->users[i];
auto pi = &user.cell->ports.at(user.port);
auto it = updates.find(pi);
- if (it == updates.end()) continue;
+ if (it == updates.end())
+ continue;
auto budget = ctx->getNetinfoRouteDelay(net.second.get(), i) + it->second;
user.budget = ctx->getBudgetOverride(net.second->driver, budget);
@@ -160,21 +167,23 @@ void update_budget(Context *ctx)
delay_t min_slack = default_slack;
auto updates = compute_min_slack(ctx, min_slack);
- // If user has not specified a frequency, adjust the target frequency
+ // If user has not specified a frequency, adjust the target frequency
// to be +5% higher than the current critical path
if (!ctx->user_freq) {
ctx->target_freq = 1.05 * (1e12 / (default_slack - min_slack));
if (ctx->verbose)
- log_info("minimum slack for this update = %d, target Fmax for next update = %f\n", min_slack, ctx->target_freq/1e6);
+ log_info("minimum slack for this update = %d, target Fmax for next update = %f\n", min_slack,
+ ctx->target_freq / 1e6);
}
// Update the budgets
for (auto &net : ctx->nets) {
for (size_t i = 0; i < net.second->users.size(); ++i) {
- auto& user = net.second->users[i];
+ auto &user = net.second->users[i];
auto pi = &user.cell->ports.at(user.port);
auto it = updates.find(pi);
- if (it == updates.end()) continue;
+ if (it == updates.end())
+ continue;
auto budget = ctx->getNetinfoRouteDelay(net.second.get(), i) + it->second;
user.budget = ctx->getBudgetOverride(net.second->driver, budget);
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index b518323e..79f65562 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -413,10 +413,7 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
return 200 * (abs(src.location.x - dst.location.x) + abs(src.location.y - dst.location.y));
}
-delay_t Arch::getBudgetOverride(const PortRef& pr, delay_t v) const
-{
- return v;
-}
+delay_t Arch::getBudgetOverride(const PortRef &pr, delay_t v) const { return v; }
// -----------------------------------------------------------------------
diff --git a/ecp5/arch.h b/ecp5/arch.h
index 22016fae..1927e55a 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -776,7 +776,7 @@ struct Arch : BaseCtx
delay_t getRipupDelayPenalty() const { return 200; }
float getDelayNS(delay_t v) const { return v * 0.001; }
uint32_t getDelayChecksum(delay_t v) const { return v; }
- delay_t getBudgetOverride(const PortRef& pr, delay_t v) const;
+ delay_t getBudgetOverride(const PortRef &pr, delay_t v) const;
// -------------------------------------------------
diff --git a/ecp5/main.cc b/ecp5/main.cc
index 170f9c11..9f683a7b 100644
--- a/ecp5/main.cc
+++ b/ecp5/main.cc
@@ -170,8 +170,7 @@ int main(int argc, char *argv[])
if (vm.count("freq")) {
ctx->target_freq = vm["freq"].as<double>() * 1e6;
ctx->user_freq = true;
- }
- else {
+ } else {
log_warning("Target frequency not specified. Will optimise for max frequency.\n");
}
assign_budget(ctx.get());
diff --git a/generic/arch.cc b/generic/arch.cc
index a12b7380..d1ca482c 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -396,10 +396,7 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
return (dx + dy) * grid_distance_to_delay;
}
-delay_t Arch::getBudgetOverride(const PortRef& pr, delay_t v) const
-{
- return v;
-}
+delay_t Arch::getBudgetOverride(const PortRef &pr, delay_t v) const { return v; }
// ---------------------------------------------------------------
diff --git a/generic/arch.h b/generic/arch.h
index 43f43842..08a7a247 100644
--- a/generic/arch.h
+++ b/generic/arch.h
@@ -196,7 +196,7 @@ struct Arch : BaseCtx
delay_t getRipupDelayPenalty() const { return 1.0; }
float getDelayNS(delay_t v) const { return v; }
uint32_t getDelayChecksum(delay_t v) const { return 0; }
- delay_t getBudgetOverride(const PortRef& pr, delay_t v) const;
+ delay_t getBudgetOverride(const PortRef &pr, delay_t v) const;
bool pack() { return true; }
bool place();