aboutsummaryrefslogtreecommitdiffstats
path: root/common/context.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-12-19 18:46:10 +0000
committerGitHub <noreply@github.com>2021-12-19 18:46:10 +0000
commit62a3e093856063180526b7189d5e711a98036fa0 (patch)
treed03ba5688367cb476a06b19d04ca78d0352afce3 /common/context.cc
parent56d550733346000584b9490fac0953fe07124035 (diff)
parentddb084e9a8a0cba10536951236cde824526e8071 (diff)
downloadnextpnr-62a3e093856063180526b7189d5e711a98036fa0.tar.gz
nextpnr-62a3e093856063180526b7189d5e711a98036fa0.tar.bz2
nextpnr-62a3e093856063180526b7189d5e711a98036fa0.zip
Merge pull request #883 from YosysHQ/gatecat/new-predictdelay
archapi: Use arbitrary rather than actual placement in predictDelay [breaking change]
Diffstat (limited to 'common/context.cc')
-rw-r--r--common/context.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/common/context.cc b/common/context.cc
index 6bba5cbe..faddf825 100644
--- a/common/context.cc
+++ b/common/context.cc
@@ -90,6 +90,25 @@ WireId Context::getNetinfoSinkWire(const NetInfo *net_info, const PortRef &sink,
return WireId();
}
+delay_t Context::predictArcDelay(const NetInfo *net_info, const PortRef &sink) const
+{
+ if (net_info->driver.cell == nullptr || net_info->driver.cell->bel == BelId() || sink.cell->bel == BelId())
+ return 0;
+ IdString driver_pin, sink_pin;
+ // Pick the first pin for a prediction; assume all will be similar enouhg
+ for (auto pin : getBelPinsForCellPin(net_info->driver.cell, net_info->driver.port)) {
+ driver_pin = pin;
+ break;
+ }
+ for (auto pin : getBelPinsForCellPin(sink.cell, sink.port)) {
+ sink_pin = pin;
+ break;
+ }
+ if (driver_pin == IdString() || sink_pin == IdString())
+ return 0;
+ return predictDelay(net_info->driver.cell->bel, driver_pin, sink.cell->bel, sink_pin);
+}
+
delay_t Context::getNetinfoRouteDelay(const NetInfo *net_info, const PortRef &user_info) const
{
#ifdef ARCH_ECP5
@@ -98,7 +117,7 @@ delay_t Context::getNetinfoRouteDelay(const NetInfo *net_info, const PortRef &us
#endif
if (net_info->wires.empty())
- return predictDelay(net_info, user_info);
+ return predictArcDelay(net_info, user_info);
WireId src_wire = getNetinfoSourceWire(net_info);
if (src_wire == WireId())
@@ -128,7 +147,7 @@ delay_t Context::getNetinfoRouteDelay(const NetInfo *net_info, const PortRef &us
if (cursor == src_wire)
max_delay = std::max(max_delay, delay + getWireDelay(src_wire).maxDelay()); // routed
else
- max_delay = std::max(max_delay, predictDelay(net_info, user_info)); // unrouted
+ max_delay = std::max(max_delay, predictArcDelay(net_info, user_info)); // unrouted
}
return max_delay;
}