aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorEddie Hung <e.hung@imperial.ac.uk>2018-07-21 18:04:54 -0700
committerEddie Hung <e.hung@imperial.ac.uk>2018-07-21 18:04:54 -0700
commite92698f32e3d6ff1ac8cfccc46c966114acb8433 (patch)
tree16075989f7b97b99205b17f57ca3f5c47a3c9d0e /common
parent5aa4cf2efbf34b89fba39495e66048a09c1d258c (diff)
downloadnextpnr-e92698f32e3d6ff1ac8cfccc46c966114acb8433.tar.gz
nextpnr-e92698f32e3d6ff1ac8cfccc46c966114acb8433.tar.bz2
nextpnr-e92698f32e3d6ff1ac8cfccc46c966114acb8433.zip
Fix delay function used for update_budget()
Diffstat (limited to 'common')
-rw-r--r--common/router1.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/common/router1.cc b/common/router1.cc
index 767e10fd..d6fcc611 100644
--- a/common/router1.cc
+++ b/common/router1.cc
@@ -736,16 +736,29 @@ bool router1(Context *ctx)
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 = ctx->getWireDelay(dst).maxDelay();
- WireId last_wire = dst;
- for (auto pip : ctx->getPipsDownhill(dst)) {
- total_delay += ctx->getPipDelay(pip).maxDelay();
- WireId next_wire = ctx->getPipDstWire(pip);
- total_delay += ctx->getWireDelay(next_wire).maxDelay();
+ 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());
}
- NPNR_ASSERT(last_wire != WireId());
- if (last_wire != src)
- total_delay += ctx->estimateDelay(src, last_wire);
+ if (last != src)
+ total_delay += ctx->estimateDelay(src, last);
+ else
+ total_delay += ctx->getWireDelay(last).maxDelay();
return total_delay;
};
update_budget(ctx, actual_delay);