aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-27 15:08:37 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-27 15:08:37 +0200
commit92ddc31003b9847ae8496f6917b64468cd6ed564 (patch)
treeeb5c132b125a1757195940394610498872dba146 /common/nextpnr.cc
parent998ab2b20a65a323707306432871e4e7716f272e (diff)
downloadnextpnr-92ddc31003b9847ae8496f6917b64468cd6ed564.tar.gz
nextpnr-92ddc31003b9847ae8496f6917b64468cd6ed564.tar.bz2
nextpnr-92ddc31003b9847ae8496f6917b64468cd6ed564.zip
Improving debugability
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r--common/nextpnr.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc
index a7a3268e..ee0c13ba 100644
--- a/common/nextpnr.cc
+++ b/common/nextpnr.cc
@@ -185,6 +185,19 @@ void Context::check() const
assert(c.first == c.second->name);
if (c.second->bel != BelId())
assert(getBoundBelCell(c.second->bel) == c.first);
+ for (auto &port : c.second->ports) {
+ NetInfo *net = port.second.net;
+ if (net != nullptr) {
+ assert(nets.find(net->name) != nets.end());
+ if (port.second.type == PORT_OUT) {
+ assert(net->driver.cell == c.second.get() && net->driver.port == port.first);
+ } else if (port.second.type == PORT_IN) {
+ assert(std::count_if(net->users.begin(), net->users.end(), [&](const PortRef &pr) {
+ return pr.cell == c.second.get() && pr.port == port.first;
+ }) == 1);
+ }
+ }
+ }
}
}