aboutsummaryrefslogtreecommitdiffstats
path: root/common/timing.cc
diff options
context:
space:
mode:
authorEddie Hung <e.hung@imperial.ac.uk>2018-07-24 22:39:51 -0700
committerEddie Hung <e.hung@imperial.ac.uk>2018-07-24 22:39:51 -0700
commita69745060ef416f1e91545be110034a18ae012bd (patch)
treea30a09d475446bea5492bf47d1c5e2818a9cafe5 /common/timing.cc
parent9382938661613b84e3ad3155e414aaae2fa87da2 (diff)
downloadnextpnr-a69745060ef416f1e91545be110034a18ae012bd.tar.gz
nextpnr-a69745060ef416f1e91545be110034a18ae012bd.tar.bz2
nextpnr-a69745060ef416f1e91545be110034a18ae012bd.zip
Also subtract net delay from slack
Diffstat (limited to 'common/timing.cc')
-rw-r--r--common/timing.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/common/timing.cc b/common/timing.cc
index 814b0426..0a895c0b 100644
--- a/common/timing.cc
+++ b/common/timing.cc
@@ -68,8 +68,9 @@ static delay_t follow_user_port(Context *ctx, PortRef &user, int path_length, de
static delay_t follow_net(Context *ctx, NetInfo *net, int path_length, delay_t slack, UpdateMap &updates)
{
delay_t net_budget = slack / (path_length + 1);
- for (auto &usr : net->users) {
- net_budget = std::min(net_budget, follow_user_port(ctx, usr, path_length + 1, slack, updates));
+ for (unsigned i = 0; i < net->users.size(); ++i) {
+ auto &usr = net->users[i];
+ net_budget = std::min(net_budget, follow_user_port(ctx, usr, path_length + 1, slack - ctx->getNetinfoRouteDelay(net, i), updates));
}
return net_budget;
}
@@ -141,8 +142,12 @@ void update_budget(Context *ctx)
if (port.second.type == PORT_OUT) {
IdString clock_domain = ctx->getPortClock(cell.second.get(), port.first);
if (clock_domain != IdString()) {
+ delay_t slack = delay_t(1.0e12 / ctx->target_freq); // TODO: clock constraints
+ delay_t clkToQ;
+ if (ctx->getCellDelay(cell.second.get(), clock_domain, port.first, clkToQ))
+ slack -= clkToQ;
if (port.second.net)
- follow_net(ctx, port.second.net, 0, delay_t(1.0e12 / ctx->target_freq), updates);
+ follow_net(ctx, port.second.net, 0, slack, updates);
}
}
}