diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-11-11 12:04:02 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-11-11 12:04:02 +0100 |
commit | dac553cab4b72a052f9738017d13ea40495f610c (patch) | |
tree | 19743fd803b4676d447381df3faa8d5fd583a4d2 /common | |
parent | d2bdb670c0be9e18722f79c170fc99d7f41768f1 (diff) | |
download | nextpnr-dac553cab4b72a052f9738017d13ea40495f610c.tar.gz nextpnr-dac553cab4b72a052f9738017d13ea40495f610c.tar.bz2 nextpnr-dac553cab4b72a052f9738017d13ea40495f610c.zip |
Add some additional checks to router1 to find issues in input netlist
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'common')
-rw-r--r-- | common/router1.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/router1.cc b/common/router1.cc index f51155e8..578e287b 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -294,6 +294,9 @@ remove_wire_arcs: void setup() { + std::unordered_map<WireId, NetInfo*> src_to_net; + std::unordered_map<WireId, arc_key> dst_to_arc; + for (auto &net_it : ctx->nets) { NetInfo *net_info = net_it.second.get(); @@ -307,6 +310,14 @@ remove_wire_arcs: log_error("No wire found for port %s on source cell %s.\n", net_info->driver.port.c_str(ctx), net_info->driver.cell->name.c_str(ctx)); + if (src_to_net.count(src_wire)) + log_error("Found two nets with same source wire %s: %s vs %s\n", ctx->getWireName(src_wire).c_str(ctx), + ctx->nameOf(net_info), ctx->nameOf(src_to_net.at(src_wire))); + + if (dst_to_arc.count(src_wire)) + log_error("Wire %s is used as source and sink in different nets: %s vs %s (%d)\n", ctx->getWireName(src_wire).c_str(ctx), + ctx->nameOf(net_info), ctx->nameOf(dst_to_arc.at(src_wire).net_info), dst_to_arc.at(src_wire).user_idx); + for (int user_idx = 0; user_idx < int(net_info->users.size()); user_idx++) { auto dst_wire = ctx->getNetinfoSinkWire(net_info, net_info->users[user_idx]); @@ -314,10 +325,20 @@ remove_wire_arcs: log_error("No wire found for port %s on destination cell %s.\n", net_info->users[user_idx].port.c_str(ctx), net_info->users[user_idx].cell->name.c_str(ctx)); + if (dst_to_arc.count(dst_wire)) + log_error("Found two arcs with same sink wire %s: %s (%d) vs %s (%d)\n", ctx->getWireName(dst_wire).c_str(ctx), + ctx->nameOf(net_info), user_idx, ctx->nameOf(dst_to_arc.at(dst_wire).net_info), dst_to_arc.at(dst_wire).user_idx); + + if (src_to_net.count(dst_wire)) + log_error("Wire %s is used as source and sink in different nets: %s vs %s (%d)\n", ctx->getWireName(dst_wire).c_str(ctx), + ctx->nameOf(src_to_net.at(dst_wire)), ctx->nameOf(net_info), user_idx); + arc_key arc; arc.net_info = net_info; arc.user_idx = user_idx; + dst_to_arc[dst_wire] = arc; + if (net_info->wires.count(src_wire) == 0) { arc_queue_insert(arc, src_wire, dst_wire); continue; @@ -341,6 +362,8 @@ remove_wire_arcs: } } + src_to_net[src_wire] = net_info; + std::vector<WireId> unbind_wires; for (auto &it : net_info->wires) |