aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Rothman <537074+litghost@users.noreply.github.com>2021-03-25 17:12:13 -0700
committerKeith Rothman <537074+litghost@users.noreply.github.com>2021-03-25 17:56:14 -0700
commit55c9d43c7025392b098697e2085e537af07ae6e7 (patch)
treee380d048ef4d2adafffb8516af118eb5e4f2ecdb
parentc8dccd3e7bec95c635ebe435c8454ffe10edd6f3 (diff)
downloadnextpnr-55c9d43c7025392b098697e2085e537af07ae6e7.tar.gz
nextpnr-55c9d43c7025392b098697e2085e537af07ae6e7.tar.bz2
nextpnr-55c9d43c7025392b098697e2085e537af07ae6e7.zip
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>
-rw-r--r--fpga_interchange/site_router.cc10
1 files 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<SitePip>::const_
{
bool valid = true;
std::vector<SitePip>::const_iterator good_pip_end = pips_begin;
- for (auto iter = pips_begin; iter != pips_end; ++iter) {
- if (!ctx->bindPip(*iter, net)) {
+ std::vector<SitePip>::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<SitePip>::const_
ctx->unbindPip(*iter);
}
} else {
- NPNR_ASSERT(net->driver == ctx->getPipSrcWire(*good_pip_end));
+ NPNR_ASSERT(net->driver == ctx->getPipSrcWire(pip));
}
return valid;