diff options
-rw-r--r-- | common/timing.cc | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/common/timing.cc b/common/timing.cc index fae9ca53..47091c27 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -60,14 +60,11 @@ struct Timing { const auto clk_period = delay_t(1.0e12 / ctx->target_freq); - // First, compute the topographical order of nets to walk through - // the circuit, assuming it is a _acyclic_ graph - // TODO(eddieh): Handle the case where it is cyclic, e.g. combinatorial - // loops + // First, compute the topographical order of nets to walk through the circuit, assuming it is a _acyclic_ graph + // TODO(eddieh): Handle the case where it is cyclic, e.g. combinatorial loops std::vector<NetInfo *> topographical_order; std::unordered_map<const NetInfo *, TimingData> net_data; - // In lieu of deleting edges from the graph, simply count - // the number of fanins to each output port + // In lieu of deleting edges from the graph, simply count the number of fanins to each output port std::unordered_map<const PortInfo *, unsigned> port_fanin; std::vector<IdString> input_ports; @@ -87,8 +84,7 @@ struct Timing for (auto o : output_ports) { IdString clockPort; TimingPortClass portClass = ctx->getPortTimingClass(cell.second.get(), o->name, clockPort); - // If output port is influenced by a clock (e.g. FF output) - // then add it to the ordering as a timing start-point + // If output port is influenced by a clock (e.g. FF output) then add it to the ordering as a timing start-point if (portClass == TMG_REGISTER_OUTPUT) { DelayInfo clkToQ; ctx->getCellDelay(cell.second.get(), clockPort, o->name, clkToQ); @@ -100,9 +96,7 @@ struct Timing topographical_order.emplace_back(o->net); net_data.emplace(o->net, TimingData{}); } - // Otherwise, for all driven input ports on this cell, - // if a timing arc exists between the input and - // the current output port, increment fanin counter + // Otherwise, for all driven input ports on this cell, if a timing arc exists between the input and the current output port, increment fanin counter for (auto i : input_ports) { DelayInfo comb_delay; bool is_path = ctx->getCellDelay(cell.second.get(), i, o->name, comb_delay); @@ -127,9 +121,7 @@ struct Timing std::deque<NetInfo *> queue(topographical_order.begin(), topographical_order.end()); - // Now walk the design, from the start points identified previously, - // building - // up a topographical order + // Now walk the design, from the start points identified previously, building up a topographical order while (!queue.empty()) { const auto net = queue.front(); queue.pop_front(); @@ -153,8 +145,7 @@ struct Timing bool is_path = ctx->getCellDelay(usr.cell, usr.port, port.first, comb_delay); if (!is_path) continue; - // Decrement the fanin count, and only add to topographical - // order if all its fanins have already been visited + // Decrement the fanin count, and only add to topographical order if all its fanins have already been visited auto it = port_fanin.find(&port.second); NPNR_ASSERT(it != port_fanin.end()); if (--it->second == 0) { @@ -166,12 +157,10 @@ struct Timing } } - // Sanity check to ensure that all ports where fanins were recorded - // were indeed visited + // Sanity check to ensure that all ports where fanins were recorded were indeed visited NPNR_ASSERT(port_fanin.empty()); - // Go forwards topographically to find the maximum arrival time - // and max path length for each net + // Go forwards topographically to find the maximum arrival time and max path length for each net for (auto net : topographical_order) { auto &nd = net_data.at(net); const auto net_arrival = nd.max_arrival; @@ -197,9 +186,7 @@ struct Timing auto &data = net_data[port.second.net]; auto &arrival = data.max_arrival; arrival = std::max(arrival, usr_arrival + comb_delay.maxDelay()); - if (!budget_override) { // Do not increment path length if - // budget overriden - // since it doesn't require a share of the slack + if (!budget_override) { // Do not increment path length if budget overriden since it doesn't require a share of the slack auto &path_length = data.max_path_length; path_length = std::max(path_length, net_length_plus_one); } @@ -210,8 +197,7 @@ struct Timing const NetInfo *crit_net = nullptr; - // Now go backwards topographically to determine the minimum path slack, - // and to distribute all path slack evenly between all nets on the path + // Now go backwards topographically to determine the minimum path slack, and to distribute all path slack evenly between all nets on the path for (auto net : boost::adaptors::reverse(topographical_order)) { auto &nd = net_data.at(net); const delay_t net_length_plus_one = nd.max_path_length + 1; @@ -348,9 +334,7 @@ void assign_budget(Context *ctx, bool quiet) } } - // For slack redistribution, if user has not specified a frequency - // dynamically adjust the target frequency to be the currently - // achieved maximum + // For slack redistribution, if user has not specified a frequency dynamically adjust the target frequency to be the currently achieved maximum if (ctx->auto_freq && ctx->slack_redist_iter > 0) { delay_t default_slack = delay_t(1.0e12 / ctx->target_freq); ctx->target_freq = 1e12 / (default_slack - timing.min_slack); |