diff options
author | David Shah <dave@ds0.me> | 2020-08-12 16:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-12 16:38:46 +0100 |
commit | b0dedf1a22f94cbd50c7f119280edd9633a810a4 (patch) | |
tree | 93ed6daa1c3f67709818612ccf950532c255a743 | |
parent | b299c649730a21f6fb12c86b4eb29da55046593d (diff) | |
parent | 3611b7120cc3444bdd7f95fe26bdb4be7e572bd3 (diff) | |
download | nextpnr-b0dedf1a22f94cbd50c7f119280edd9633a810a4.tar.gz nextpnr-b0dedf1a22f94cbd50c7f119280edd9633a810a4.tar.bz2 nextpnr-b0dedf1a22f94cbd50c7f119280edd9633a810a4.zip |
Merge pull request #488 from YosysHQ/dave/port_fanin_fix
timing: Fix counting of fanin in out-of-context mode
-rw-r--r-- | common/timing.cc | 19 |
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); |