diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/nextpnr.cc | 13 |
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); + } + } + } } } |