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>
This commit is contained in:
Keith Rothman 2021-03-25 17:12:13 -07:00
parent c8dccd3e7b
commit 55c9d43c70

View File

@ -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;