From 42f48b6dc0042d56a896514fe2421486ffdc359e Mon Sep 17 00:00:00 2001 From: gatecat Date: Thu, 29 Jul 2021 13:04:59 +0100 Subject: [PATCH 1/2] router2: Improve debugability of pip conflicts Signed-off-by: gatecat --- common/router2.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/router2.cc b/common/router2.cc index 2994038c..667d906e 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -329,7 +329,11 @@ struct Router2 if (b.first == 1) { b.second = pip; } else { - NPNR_ASSERT(b.second == pip); + if (b.second != pip) + log_error("internal inconsistency: attempting to bind pip %s to net %s, but wire %s is already driven " + "by pip %s\n", + ctx->nameOfPip(pip), ctx->nameOf(net), ctx->nameOfWire(flat_wires.at(wire).w), + ctx->nameOfPip(b.second)); } } From b5a31d2e4e1d9097db543faf4374f5f0c10e6855 Mon Sep 17 00:00:00 2001 From: gatecat Date: Fri, 30 Jul 2021 09:14:46 +0100 Subject: [PATCH 2/2] router2: Mark dest as visited during backwards routing Signed-off-by: gatecat --- common/router2.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/router2.cc b/common/router2.cc index 667d906e..9264903d 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -579,6 +579,7 @@ struct Router2 int backwards_limit = ctx->getBelGlobalBuf(net->driver.cell->bel) ? cfg.global_backwards_max_iter : cfg.backwards_max_iter; t.backwards_queue.push(wire_to_idx.at(dst_wire)); + set_visited(t, wire_to_idx.at(dst_wire), PipId(), WireScore()); while (!t.backwards_queue.empty() && backwards_iter < backwards_limit) { int cursor = t.backwards_queue.front(); t.backwards_queue.pop(); @@ -645,6 +646,9 @@ struct Router2 bind_pip_internal(net, i, src_wire_idx, PipId()); while (was_visited(cursor_fwd)) { auto &v = flat_wires.at(cursor_fwd).visit; + if (v.pip == PipId()) { + break; + } cursor_fwd = wire_to_idx.at(ctx->getPipDstWire(v.pip)); bind_pip_internal(net, i, cursor_fwd, v.pip); if (ctx->debug) {