aboutsummaryrefslogtreecommitdiffstats
path: root/common/context.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-03-01 16:38:48 +0000
committerGitHub <noreply@github.com>2022-03-01 16:38:48 +0000
commit0a70b9c992c06a7553725b3742052eb95abd5f20 (patch)
treed1d8436576bad3424031c5ce435d76717fef196e /common/context.cc
parentd8bea3ccfc7b6e925a9fd63c9172748ea0420e88 (diff)
parent86699b42f619960bfefd4d0b479dd44a90527ea4 (diff)
downloadnextpnr-0a70b9c992c06a7553725b3742052eb95abd5f20.tar.gz
nextpnr-0a70b9c992c06a7553725b3742052eb95abd5f20.tar.bz2
nextpnr-0a70b9c992c06a7553725b3742052eb95abd5f20.zip
Merge pull request #925 from YosysHQ/gatecat/netlist-iv
Switch to potentially-sparse net users array
Diffstat (limited to 'common/context.cc')
-rw-r--r--common/context.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/context.cc b/common/context.cc
index faddf825..e35d3e49 100644
--- a/common/context.cc
+++ b/common/context.cc
@@ -334,13 +334,13 @@ void Context::check() const
nameOf(port.first), nameOf(net));
}
} else if (port.second.type == PORT_IN) {
- int usr_count = std::count_if(net->users.begin(), net->users.end(), [&](const PortRef &pr) {
- return pr.cell == c.second.get() && pr.port == port.first;
- });
- if (usr_count != 1)
- CHECK_FAIL("input cell port '%s.%s' appears %d rather than expected 1 times in users vector of "
- "net '%s'\n",
- nameOf(c.first), nameOf(port.first), usr_count, nameOf(net));
+ if (!port.second.user_idx)
+ CHECK_FAIL("input cell port '%s.%s' on net '%s' has no user index\n", nameOf(c.first),
+ nameOf(port.first), nameOf(net));
+ auto net_user = net->users.at(port.second.user_idx);
+ if (net_user.cell != c.second.get() || net_user.port != port.first)
+ CHECK_FAIL("input cell port '%s.%s' not in associated user entry of net '%s'\n",
+ nameOf(c.first), nameOf(port.first), nameOf(net));
}
}
}