archapi: Add getDelayFromNS to improve timing algorithm portability

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2018-11-04 14:03:33 +00:00
parent e633aa09cc
commit 07e265868b
3 changed files with 13 additions and 3 deletions

View File

@ -117,7 +117,7 @@ struct Timing
delay_t walk_paths() delay_t walk_paths()
{ {
const auto clk_period = delay_t(1.0e12 / ctx->target_freq); const auto clk_period = ctx->getDelayFromNS(1.0e9 / ctx->target_freq).maxDelay();
// First, compute the topographical order of nets to walk through the circuit, assuming it is a _acyclic_ graph // 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 // TODO(eddieh): Handle the case where it is cyclic, e.g. combinatorial loops
@ -344,7 +344,7 @@ struct Timing
if (!crit_nets.count(clockPair) || crit_nets.at(clockPair).first < endpoint_arrival) { if (!crit_nets.count(clockPair) || crit_nets.at(clockPair).first < endpoint_arrival) {
crit_nets[clockPair] = std::make_pair(endpoint_arrival, net); crit_nets[clockPair] = std::make_pair(endpoint_arrival, net);
(*crit_path)[clockPair].path_delay = endpoint_arrival; (*crit_path)[clockPair].path_delay = endpoint_arrival;
(*crit_path)[clockPair].path_period = clk_period; (*crit_path)[clockPair].path_period = period;
(*crit_path)[clockPair].ports.clear(); (*crit_path)[clockPair].ports.clear();
(*crit_path)[clockPair].ports.push_back(&usr); (*crit_path)[clockPair].ports.push_back(&usr);
} }
@ -591,7 +591,7 @@ void timing_analysis(Context *ctx, bool print_histogram, bool print_fmax, bool p
DelayInfo comb_delay; DelayInfo comb_delay;
if (last_port == driver.port) { if (last_port == driver.port) {
// Case where we start with a STARTPOINT etc // Case where we start with a STARTPOINT etc
comb_delay.delay = 0; comb_delay = ctx->getDelayFromNS(0);
} else { } else {
ctx->getCellDelay(sink_cell, last_port, driver.port, comb_delay); ctx->getCellDelay(sink_cell, last_port, driver.port, comb_delay);
} }

View File

@ -398,6 +398,10 @@ actual penalty used is a multiple of this value (i.e. a weighted version of this
Convert an `delay_t` to an actual real-world delay in nanoseconds. Convert an `delay_t` to an actual real-world delay in nanoseconds.
### DelayInfo getDelayFromNS(float v) const
Convert a real-world delay in nanoseconds to a DelayInfo with equal min/max rising/falling values.
### uint32\_t getDelayChecksum(delay\_t v) const ### uint32\_t getDelayChecksum(delay\_t v) const
Convert a `delay_t` to an integer for checksum calculations. Convert a `delay_t` to an integer for checksum calculations.

View File

@ -775,6 +775,12 @@ struct Arch : BaseCtx
delay_t getDelayEpsilon() const { return 20; } delay_t getDelayEpsilon() const { return 20; }
delay_t getRipupDelayPenalty() const { return 200; } delay_t getRipupDelayPenalty() const { return 200; }
float getDelayNS(delay_t v) const { return v * 0.001; } float getDelayNS(delay_t v) const { return v * 0.001; }
DelayInfo getDelayFromNS(float ns) const
{
DelayInfo del;
del.delay = delay_t(ns * 1000);
return del;
}
uint32_t getDelayChecksum(delay_t v) const { return v; } uint32_t getDelayChecksum(delay_t v) const { return v; }
bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const; bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const;