aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-08-12 10:42:26 +0100
committerDavid Shah <dave@ds0.me>2020-08-12 10:42:26 +0100
commit3611b7120cc3444bdd7f95fe26bdb4be7e572bd3 (patch)
tree5b73582c08820a87ac2d89f3ba3f8bf38159eee2
parentfbe486df459909065d6852a7495a212dfd2accef (diff)
downloadnextpnr-3611b7120cc3444bdd7f95fe26bdb4be7e572bd3.tar.gz
nextpnr-3611b7120cc3444bdd7f95fe26bdb4be7e572bd3.tar.bz2
nextpnr-3611b7120cc3444bdd7f95fe26bdb4be7e572bd3.zip
timing: Fix counting of fanin in out-of-context mode
Signed-off-by: David Shah <dave@ds0.me>
-rw-r--r--common/timing.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/common/timing.cc b/common/timing.cc
index 40cbb36e..8322df6d 100644
--- a/common/timing.cc
+++ b/common/timing.cc
@@ -132,6 +132,18 @@ struct Timing
std::vector<IdString> input_ports;
std::vector<const PortInfo *> output_ports;
+
+ std::unordered_set<IdString> ooc_port_nets;
+
+ // In out-of-context mode, top-level inputs look floating but aren't
+ if (bool_or_default(ctx->settings, ctx->id("arch.ooc"))) {
+ for (auto &p : ctx->ports) {
+ if (p.second.type != PORT_IN || p.second.net == nullptr)
+ continue;
+ ooc_port_nets.insert(p.second.net->name);
+ }
+ }
+
for (auto &cell : ctx->cells) {
input_ports.clear();
output_ports.clear();
@@ -177,7 +189,8 @@ struct Timing
// the current output port, increment fanin counter
for (auto i : input_ports) {
DelayInfo comb_delay;
- if (cell.second->ports[i].net->driver.cell == nullptr)
+ NetInfo *i_net = cell.second->ports[i].net;
+ if (i_net->driver.cell == nullptr && !ooc_port_nets.count(i_net->name))
continue;
bool is_path = ctx->getCellDelay(cell.second.get(), i, o->name, comb_delay);
if (is_path)
@@ -232,7 +245,9 @@ struct Timing
// Decrement the fanin count, and only add to topological order if all its fanins have already
// been visited
auto it = port_fanin.find(&port.second);
- NPNR_ASSERT(it != port_fanin.end());
+ if (it == port_fanin.end())
+ log_error("Timing counted negative fanin count for port %s.%s (net %s), please report this error.\n",
+ ctx->nameOf(usr.cell), ctx->nameOf(port.first), ctx->nameOf(port.second.net));
if (--it->second == 0) {
topological_order.emplace_back(port.second.net);
queue.emplace_back(port.second.net);