From 55c9d43c7025392b098697e2085e537af07ae6e7 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 25 Mar 2021 17:12:13 -0700 Subject: interchange: Fix bug in site router where a bad solution isn't remove. This resulted in valid site routing solutions being missed. Underlying bug was an off-by-one error when unwinding a failed solution. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- fpga_interchange/site_router.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fpga_interchange/site_router.cc b/fpga_interchange/site_router.cc index 962acc4b..8870fa32 100644 --- a/fpga_interchange/site_router.cc +++ b/fpga_interchange/site_router.cc @@ -376,12 +376,16 @@ bool test_solution(SiteArch *ctx, SiteNetInfo *net, std::vector::const_ { bool valid = true; std::vector::const_iterator good_pip_end = pips_begin; - for (auto iter = pips_begin; iter != pips_end; ++iter) { - if (!ctx->bindPip(*iter, net)) { + std::vector::const_iterator iter = pips_begin; + SitePip pip; + while (iter != pips_end) { + pip = *iter; + if (!ctx->bindPip(pip, net)) { valid = false; break; } + ++iter; good_pip_end = iter; } @@ -391,7 +395,7 @@ bool test_solution(SiteArch *ctx, SiteNetInfo *net, std::vector::const_ ctx->unbindPip(*iter); } } else { - NPNR_ASSERT(net->driver == ctx->getPipSrcWire(*good_pip_end)); + NPNR_ASSERT(net->driver == ctx->getPipSrcWire(pip)); } return valid; -- cgit v1.2.3