From ecb264d002cb244578df07cef66acf87719478b9 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 3 Aug 2018 22:39:25 -0700 Subject: Refactor timing.cc into Timing class --- common/placer1.cc | 2 +- common/router1.cc | 2 +- common/timing.cc | 205 ++++++++++++++++++++++++++++-------------------------- common/timing.h | 6 +- 4 files changed, 113 insertions(+), 102 deletions(-) diff --git a/common/placer1.cc b/common/placer1.cc index fc679b50..4c34fcda 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -272,7 +272,7 @@ class SAPlacer } } } - timing_analysis(ctx, true /* print_fmax */); + timing_analysis(ctx); ctx->unlock(); return true; } diff --git a/common/router1.cc b/common/router1.cc index 6e352866..5f51b370 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -933,7 +933,7 @@ bool router1(Context *ctx, const Router1Cfg &cfg) #ifndef NDEBUG ctx->check(); #endif - timing_analysis(ctx, true /* print_fmax */, true /* print_path */); + timing_analysis(ctx, true /* print_path */); ctx->unlock(); return true; } catch (log_execution_error_exception) { diff --git a/common/timing.cc b/common/timing.cc index 9777ab7d..79a5dbb3 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -26,100 +26,114 @@ NEXTPNR_NAMESPACE_BEGIN -typedef std::list PortRefList; +typedef std::vector PortRefVector; -static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, bool update, delay_t &min_slack, - PortRefList *current_path, PortRefList *crit_path); - -// Follow a path, returning budget to annotate -static delay_t follow_user_port(Context *ctx, PortRef &user, int path_length, delay_t slack, bool update, - delay_t &min_slack, PortRefList *current_path, PortRefList *crit_path) +struct Timing { - delay_t value; - if (ctx->getPortClock(user.cell, user.port) != IdString()) { - // At the end of a timing path (arguably, should check setup time - // here too) - value = slack / path_length; - if (slack < min_slack) { - min_slack = slack; + Context *ctx; + bool update; + delay_t min_slack; + PortRefVector current_path; + PortRefVector *crit_path; + + Timing(Context *ctx, bool update, PortRefVector *crit_path = nullptr): ctx(ctx), update(update), min_slack(1.0e12 / ctx->target_freq), crit_path(crit_path) {} + + delay_t follow_net(NetInfo *net, int path_length, delay_t slack) + { + delay_t net_budget = slack / (path_length + 1); + for (auto &usr : net->users) { + if (crit_path) + current_path.push_back(&usr); + // If budget override is less than existing budget, then do not increment path length + int pl = path_length + 1; + auto budget = ctx->getBudgetOverride(net, usr, net_budget); + if (budget < net_budget) { + net_budget = budget; + pl = std::max(1, path_length); + } + auto delay = ctx->getNetinfoRouteDelay(net, usr); + net_budget = std::min( + net_budget, follow_user_port(usr, pl, slack - delay)); + if (update) + usr.budget = std::min(usr.budget, delay + net_budget); if (crit_path) - *crit_path = *current_path; + current_path.pop_back(); } - } else { - // Default to the path ending here, if no further paths found - value = slack / path_length; - // Follow outputs of the user - for (auto port : user.cell->ports) { - if (port.second.type == PORT_OUT) { - DelayInfo comb_delay; - // Look up delay through this path - bool is_path = ctx->getCellDelay(user.cell, user.port, port.first, comb_delay); - if (is_path) { - NetInfo *net = port.second.net; - if (net) { - delay_t path_budget = follow_net(ctx, net, path_length, slack - comb_delay.maxDelay(), update, - min_slack, current_path, crit_path); - value = std::min(value, path_budget); + return net_budget; + } + + // Follow a path, returning budget to annotate + delay_t follow_user_port(PortRef &user, int path_length, delay_t slack) + { + delay_t value; + if (ctx->getPortClock(user.cell, user.port) != IdString()) { + // At the end of a timing path (arguably, should check setup time + // here too) + value = slack / path_length; + if (slack < min_slack) { + min_slack = slack; + if (crit_path) + *crit_path = current_path; + } + } else { + // Default to the path ending here, if no further paths found + value = slack / path_length; + // Follow outputs of the user + for (auto port : user.cell->ports) { + if (port.second.type == PORT_OUT) { + DelayInfo comb_delay; + // Look up delay through this path + bool is_path = ctx->getCellDelay(user.cell, user.port, port.first, comb_delay); + if (is_path) { + NetInfo *net = port.second.net; + if (net) { + delay_t path_budget = follow_net(net, path_length, slack - comb_delay.maxDelay()); + value = std::min(value, path_budget); + } } } } } + return value; } - return value; -} -static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, bool update, delay_t &min_slack, - PortRefList *current_path, PortRefList *crit_path) -{ - delay_t net_budget = slack / (path_length + 1); - for (auto &usr : net->users) { - if (crit_path) - current_path->push_back(&usr); - // If budget override is less than existing budget, then do not increment path length - int pl = path_length + 1; - auto budget = ctx->getBudgetOverride(net, usr, net_budget); - if (budget < net_budget) { - net_budget = budget; - pl = std::max(1, path_length); + delay_t walk_paths() + { + delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); + + // Go through all clocked drivers and distribute the available path + // slack evenly into the budget of every sink on the path + for (auto &cell : ctx->cells) { + for (auto port : cell.second->ports) { + if (port.second.type == PORT_OUT) { + IdString clock_domain = ctx->getPortClock(cell.second.get(), port.first); + if (clock_domain != IdString()) { + delay_t slack = default_slack; // TODO: clock constraints + DelayInfo clkToQ; + if (ctx->getCellDelay(cell.second.get(), clock_domain, port.first, clkToQ)) + slack -= clkToQ.maxDelay(); + if (port.second.net) + follow_net(port.second.net, 0, slack); + } + } + } } - auto delay = ctx->getNetinfoRouteDelay(net, usr); - net_budget = std::min( - net_budget, follow_user_port(ctx, usr, pl, slack - delay, update, min_slack, current_path, crit_path)); - if (update) - usr.budget = std::min(usr.budget, delay + net_budget); - if (crit_path) - current_path->pop_back(); + return min_slack; } - return net_budget; -} -static delay_t walk_paths(Context *ctx, bool update, PortRefList *crit_path) -{ - delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); - delay_t min_slack = default_slack; - - PortRefList current_path; - - // Go through all clocked drivers and distribute the available path - // slack evenly into the budget of every sink on the path - for (auto &cell : ctx->cells) { - for (auto port : cell.second->ports) { - if (port.second.type == PORT_OUT) { - IdString clock_domain = ctx->getPortClock(cell.second.get(), port.first); - if (clock_domain != IdString()) { - delay_t slack = default_slack; // TODO: clock constraints - DelayInfo clkToQ; - if (ctx->getCellDelay(cell.second.get(), clock_domain, port.first, clkToQ)) - slack -= clkToQ.maxDelay(); - if (port.second.net) - follow_net(ctx, port.second.net, 0, slack, update, min_slack, ¤t_path, crit_path); - } + void assign_budget() + { + // Clear delays to a very high value first + delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); + for (auto &net : ctx->nets) { + for (auto &usr : net.second->users) { + usr.budget = default_slack; } } - } - return min_slack; -} + walk_paths(); + } +}; void assign_budget(Context *ctx, bool quiet) { @@ -128,15 +142,9 @@ void assign_budget(Context *ctx, bool quiet) 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) { - for (auto &usr : net.second->users) { - usr.budget = default_slack; - } - } + Timing timing(ctx, true /* update */); + timing.assign_budget(); - delay_t min_slack = walk_paths(ctx, true, nullptr); if (!quiet || ctx->verbose) { for (auto &net : ctx->nets) { @@ -160,21 +168,24 @@ void assign_budget(Context *ctx, bool quiet) // dynamically adjust the target frequency to be the currently // achieved maximum if (!ctx->user_freq && ctx->slack_redist_iter > 0) { - ctx->target_freq = 1e12 / (default_slack - 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); + delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); + ctx->target_freq = 1e12 / (default_slack - timing.min_slack); + if (ctx->verbose) + log_info("minimum slack for this assign = %d, target Fmax for next update = %.2f MHz\n", timing.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) +void timing_analysis(Context *ctx, bool print_path) { - delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); - PortRefList crit_path; - delay_t min_slack = walk_paths(ctx, false, &crit_path); + PortRefVector crit_path; + + Timing timing(ctx, false /* update */, &crit_path); + auto min_slack = timing.walk_paths(); + if (print_path) { if (crit_path.empty()) { log_info("Design contains no timing paths\n"); @@ -211,9 +222,9 @@ delay_t timing_analysis(Context *ctx, bool print_fmax, bool print_path) log_break(); } } - if (print_fmax) - log_info("estimated Fmax = %.2f MHz\n", 1e6 / (default_slack - min_slack)); - return min_slack; + + delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); + log_info("estimated Fmax = %.2f MHz\n", 1e6 / (default_slack - min_slack)); } NEXTPNR_NAMESPACE_END diff --git a/common/timing.h b/common/timing.h index d0159d5c..7073b899 100644 --- a/common/timing.h +++ b/common/timing.h @@ -27,9 +27,9 @@ NEXTPNR_NAMESPACE_BEGIN // Evenly redistribute the total path slack amongst all sinks on each path 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 -delay_t timing_analysis(Context *ctx, bool print_fmax = false, bool print_path = false); +// Perform timing analysis and print out the fmax, and optionally the +// critical path +void timing_analysis(Context *ctx, bool print_path = false); NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 85a436198cd38aca3b380dcedcc62a07ae58fba3 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 3 Aug 2018 22:39:55 -0700 Subject: Remove space --- common/timing.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/common/timing.cc b/common/timing.cc index 79a5dbb3..3b3c5da7 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -145,7 +145,6 @@ void assign_budget(Context *ctx, bool quiet) Timing timing(ctx, true /* update */); timing.assign_budget(); - if (!quiet || ctx->verbose) { for (auto &net : ctx->nets) { for (auto &user : net.second->users) { -- cgit v1.2.3 From be481cb1302414d00b25a84146fe532740013389 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 3 Aug 2018 23:39:42 -0700 Subject: Add crude histogram feature, printed after placement and routing --- common/router1.cc | 2 +- common/timing.cc | 34 +++++++++++++++++++++++++++++++--- common/timing.h | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/common/router1.cc b/common/router1.cc index 5f51b370..dd338b35 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -933,7 +933,7 @@ bool router1(Context *ctx, const Router1Cfg &cfg) #ifndef NDEBUG ctx->check(); #endif - timing_analysis(ctx, true /* print_path */); + timing_analysis(ctx, true /* slack_histogram */, true /* print_path */); ctx->unlock(); return true; } catch (log_execution_error_exception) { diff --git a/common/timing.cc b/common/timing.cc index 3b3c5da7..85683b75 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -27,6 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN typedef std::vector PortRefVector; +typedef std::map DelayFrequency; struct Timing { @@ -35,8 +36,10 @@ struct Timing delay_t min_slack; PortRefVector current_path; PortRefVector *crit_path; + DelayFrequency *slack_histogram; - Timing(Context *ctx, bool update, PortRefVector *crit_path = nullptr): ctx(ctx), update(update), min_slack(1.0e12 / ctx->target_freq), crit_path(crit_path) {} + 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), slack_histogram(slack_histogram) {} delay_t follow_net(NetInfo *net, int path_length, delay_t slack) { @@ -75,6 +78,8 @@ struct Timing if (crit_path) *crit_path = current_path; } + if (slack_histogram) + (*slack_histogram)[slack]++; } else { // Default to the path ending here, if no further paths found value = slack / path_length; @@ -178,11 +183,12 @@ void assign_budget(Context *ctx, bool quiet) log_info("Checksum: 0x%08x\n", ctx->checksum()); } -void timing_analysis(Context *ctx, bool print_path) +void timing_analysis(Context *ctx, bool print_histogram, bool print_path) { PortRefVector crit_path; + DelayFrequency slack_histogram; - Timing timing(ctx, false /* update */, &crit_path); + Timing timing(ctx, false /* update */, print_path ? &crit_path : nullptr, print_histogram ? &slack_histogram : nullptr); auto min_slack = timing.walk_paths(); if (print_path) { @@ -224,6 +230,28 @@ void timing_analysis(Context *ctx, bool print_path) delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); log_info("estimated Fmax = %.2f MHz\n", 1e6 / (default_slack - min_slack)); + + if (print_histogram) { + constexpr unsigned num_bins = 20; + unsigned bar_width = 60; + auto min_slack = slack_histogram.begin()->first; + auto max_slack = slack_histogram.rbegin()->first; + auto bin_size = (max_slack - min_slack) / num_bins; + std::vector bins(num_bins+1); + unsigned max_freq = 0; + for (const auto& i : slack_histogram) { + auto& bin = bins[(i.first-min_slack) / bin_size]; + bin += i.second; + max_freq = std::max(max_freq, bin); + } + bar_width = std::min(bar_width, max_freq); + + log_break(); + log_info("Slack histogram:\n"); + log_info(" legend: * represents %d endpoint(s)\n", max_freq / bar_width); + for (unsigned i = 0; i < bins.size(); ++i) + log_info("%6d < ps < %6d |%s\n", min_slack + bin_size*i, min_slack + bin_size*(i+1), std::string(bins[i] * bar_width / max_freq, '*').c_str()); + } } NEXTPNR_NAMESPACE_END diff --git a/common/timing.h b/common/timing.h index 7073b899..cfb71ae0 100644 --- a/common/timing.h +++ b/common/timing.h @@ -29,7 +29,7 @@ void assign_budget(Context *ctx, bool quiet = false); // Perform timing analysis and print out the fmax, and optionally the // critical path -void timing_analysis(Context *ctx, bool print_path = false); +void timing_analysis(Context *ctx, bool slack_histogram = true, bool print_path = false); NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 45304d049f1c939ca3ac9782a1108f17e784a1cd Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 3 Aug 2018 23:42:25 -0700 Subject: clangformat --- common/timing.cc | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index 85683b75..0178a4a9 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -26,7 +26,7 @@ NEXTPNR_NAMESPACE_BEGIN -typedef std::vector PortRefVector; +typedef std::vector PortRefVector; typedef std::map DelayFrequency; struct Timing @@ -38,8 +38,11 @@ struct Timing 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), slack_histogram(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), + slack_histogram(slack_histogram) + { + } delay_t follow_net(NetInfo *net, int path_length, delay_t slack) { @@ -47,7 +50,8 @@ struct Timing for (auto &usr : net->users) { if (crit_path) current_path.push_back(&usr); - // If budget override is less than existing budget, then do not increment path length + // If budget override is less than existing budget, then do not increment + // path length int pl = path_length + 1; auto budget = ctx->getBudgetOverride(net, usr, net_budget); if (budget < net_budget) { @@ -55,8 +59,7 @@ struct Timing pl = std::max(1, path_length); } auto delay = ctx->getNetinfoRouteDelay(net, usr); - net_budget = std::min( - net_budget, follow_user_port(usr, pl, slack - delay)); + net_budget = std::min(net_budget, follow_user_port(usr, pl, slack - delay)); if (update) usr.budget = std::min(usr.budget, delay + net_budget); if (crit_path) @@ -105,7 +108,7 @@ struct Timing delay_t walk_paths() { delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); - + // Go through all clocked drivers and distribute the available path // slack evenly into the budget of every sink on the path for (auto &cell : ctx->cells) { @@ -175,8 +178,9 @@ void assign_budget(Context *ctx, bool quiet) delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); ctx->target_freq = 1e12 / (default_slack - timing.min_slack); if (ctx->verbose) - log_info("minimum slack for this assign = %d, target Fmax for next update = %.2f MHz\n", timing.min_slack, - ctx->target_freq / 1e6); + log_info("minimum slack for this assign = %d, target Fmax for next " + "update = %.2f MHz\n", + timing.min_slack, ctx->target_freq / 1e6); } if (!quiet) @@ -188,7 +192,8 @@ 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, print_histogram ? &slack_histogram : nullptr); + Timing timing(ctx, false /* update */, print_path ? &crit_path : nullptr, + print_histogram ? &slack_histogram : nullptr); auto min_slack = timing.walk_paths(); if (print_path) { @@ -237,10 +242,10 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_path) auto min_slack = slack_histogram.begin()->first; auto max_slack = slack_histogram.rbegin()->first; auto bin_size = (max_slack - min_slack) / num_bins; - std::vector bins(num_bins+1); + std::vector bins(num_bins + 1); unsigned max_freq = 0; - for (const auto& i : slack_histogram) { - auto& bin = bins[(i.first-min_slack) / bin_size]; + for (const auto &i : slack_histogram) { + auto &bin = bins[(i.first - min_slack) / bin_size]; bin += i.second; max_freq = std::max(max_freq, bin); } @@ -250,7 +255,8 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_path) log_info("Slack histogram:\n"); log_info(" legend: * represents %d endpoint(s)\n", max_freq / bar_width); for (unsigned i = 0; i < bins.size(); ++i) - log_info("%6d < ps < %6d |%s\n", min_slack + bin_size*i, min_slack + bin_size*(i+1), std::string(bins[i] * bar_width / max_freq, '*').c_str()); + log_info("%6d < ps < %6d |%s\n", min_slack + bin_size * i, min_slack + bin_size * (i + 1), + std::string(bins[i] * bar_width / max_freq, '*').c_str()); } } -- cgit v1.2.3 From b07f0eebc894dce9220ab57808ff2e7103827fea Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 4 Aug 2018 18:47:42 -0700 Subject: Be cognisant that delay_t could be a non-integer type (if so, truncate to integer) --- common/timing.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index c046c76f..2e3c6c7d 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -27,7 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN typedef std::vector PortRefVector; -typedef std::map DelayFrequency; +typedef std::map DelayFrequency; struct Timing { @@ -239,9 +239,9 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_path) if (print_histogram) { constexpr unsigned num_bins = 20; unsigned bar_width = 60; - auto min_slack = slack_histogram.begin()->first; - auto max_slack = slack_histogram.rbegin()->first; - auto bin_size = (max_slack - min_slack) / num_bins; + int min_slack = slack_histogram.begin()->first; + int max_slack = slack_histogram.rbegin()->first; + int bin_size = (max_slack - min_slack) / num_bins; std::vector bins(num_bins + 1); unsigned max_freq = 0; for (const auto &i : slack_histogram) { -- cgit v1.2.3 From 76a7d67f74d6d97f556859dd6677af8fc4cb920a Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 4 Aug 2018 18:54:23 -0700 Subject: Revert "Be cognisant that delay_t could be a non-integer type (if so, truncate to integer)" This reverts commit b07f0eebc894dce9220ab57808ff2e7103827fea. --- common/timing.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index 2e3c6c7d..c046c76f 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -27,7 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN typedef std::vector PortRefVector; -typedef std::map DelayFrequency; +typedef std::map DelayFrequency; struct Timing { @@ -239,9 +239,9 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_path) if (print_histogram) { constexpr unsigned num_bins = 20; unsigned bar_width = 60; - int min_slack = slack_histogram.begin()->first; - int max_slack = slack_histogram.rbegin()->first; - int bin_size = (max_slack - min_slack) / num_bins; + auto min_slack = slack_histogram.begin()->first; + auto max_slack = slack_histogram.rbegin()->first; + auto bin_size = (max_slack - min_slack) / num_bins; std::vector bins(num_bins + 1); unsigned max_freq = 0; for (const auto &i : slack_histogram) { -- cgit v1.2.3 From 8974ef332737bcf2f37cdd59b2c9767fa187fdf3 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 4 Aug 2018 18:55:03 -0700 Subject: Slack histogram to use ps granularity via int(Arch::getDelayNS() * 1000) --- common/timing.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index c046c76f..f6c5f001 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -27,7 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN typedef std::vector PortRefVector; -typedef std::map DelayFrequency; +typedef std::map DelayFrequency; struct Timing { @@ -81,8 +81,10 @@ struct Timing if (crit_path) *crit_path = current_path; } - if (slack_histogram) - (*slack_histogram)[slack]++; + if (slack_histogram) { + int slack_ps = ctx->getDelayNS(slack) * 1000; + (*slack_histogram)[slack_ps]++; + } } else { // Default to the path ending here, if no further paths found value = slack / path_length; -- cgit v1.2.3