diff options
Diffstat (limited to 'common/router1.cc')
-rw-r--r-- | common/router1.cc | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/common/router1.cc b/common/router1.cc index fbf3c467..431770da 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -22,6 +22,7 @@ #include "log.h" #include "router1.h" +#include "timing.h" namespace { @@ -612,8 +613,38 @@ bool router1(Context *ctx) std::unordered_set<IdString> normalRouteNets, ripupQueue; - if (ctx->verbose || iterCnt == 1) - log_info("routing queue contains %d jobs.\n", int(jobQueue.size())); + if (iterCnt == 1) { + if (ctx->verbose) + log_info("routing queue contains %d jobs.\n", int(jobQueue.size())); + } else { + static auto actual_delay = [](Context *ctx, WireId src, WireId dst) { + delay_t total_delay = 0; + WireId last = dst; + auto net_name = ctx->getBoundWireNet(src); + if (net_name != IdString()) { + auto net = ctx->nets.at(net_name).get(); + while (last != src) { + total_delay += ctx->getWireDelay(last).maxDelay(); + auto pip = net->wires.at(last).pip; + NPNR_ASSERT(ctx->getBoundPipNet(pip) == net_name); + total_delay += ctx->getPipDelay(pip).maxDelay(); + last = ctx->getPipSrcWire(pip); + if (ctx->getBoundWireNet(last) != net_name) { + log_warning("Wire %s bound to %s not %s!\n", ctx->getWireName(last).c_str(ctx), ctx->getBoundWireNet(last).c_str(ctx), net_name.c_str(ctx)); + break; + } + NPNR_ASSERT(ctx->getBoundWireNet(last) == net_name); + } + NPNR_ASSERT(last != WireId()); + } + if (last != src) + total_delay += ctx->estimateDelay(src, last); + else + total_delay += ctx->getWireDelay(last).maxDelay(); + return total_delay; + }; + update_budget(ctx, actual_delay); + } bool printNets = ctx->verbose && (jobQueue.size() < 10); |