aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-04 12:15:23 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-04 12:15:23 +0200
commite0a851976f7bc51702bc6ba667f36749cd554ebb (patch)
tree7ad0979da5cf954ccef6a21884d23fd55c3d7299 /common/nextpnr.cc
parentb96727549ccd319f61d33982f678075880fad166 (diff)
downloadnextpnr-e0a851976f7bc51702bc6ba667f36749cd554ebb.tar.gz
nextpnr-e0a851976f7bc51702bc6ba667f36749cd554ebb.tar.bz2
nextpnr-e0a851976f7bc51702bc6ba667f36749cd554ebb.zip
refactor: Replace assert with NPNR_ASSERT
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r--common/nextpnr.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc
index 40eb2536..a197eaff 100644
--- a/common/nextpnr.cc
+++ b/common/nextpnr.cc
@@ -47,8 +47,8 @@ const char *IdString::c_str(const BaseCtx *ctx) const { return str(ctx).c_str();
void IdString::initialize_add(const BaseCtx *ctx, const char *s, int idx)
{
- assert(ctx->idstring_str_to_idx->count(s) == 0);
- assert(int(ctx->idstring_idx_to_str->size()) == idx);
+ NPNR_ASSERT(ctx->idstring_str_to_idx->count(s) == 0);
+ NPNR_ASSERT(int(ctx->idstring_idx_to_str->size()) == idx);
auto insert_rc = ctx->idstring_str_to_idx->insert({s, idx});
ctx->idstring_idx_to_str->push_back(&insert_rc.first->first);
}
@@ -170,12 +170,12 @@ void Context::check() const
{
for (auto &n : nets) {
auto ni = n.second.get();
- assert(n.first == ni->name);
+ NPNR_ASSERT(n.first == ni->name);
for (auto &w : ni->wires) {
- assert(n.first == getBoundWireNet(w.first));
+ NPNR_ASSERT(n.first == getBoundWireNet(w.first));
if (w.second.pip != PipId()) {
- assert(w.first == getPipDstWire(w.second.pip));
- assert(n.first == getBoundPipNet(w.second.pip));
+ NPNR_ASSERT(w.first == getPipDstWire(w.second.pip));
+ NPNR_ASSERT(n.first == getBoundPipNet(w.second.pip));
}
}
}
@@ -183,24 +183,24 @@ void Context::check() const
for (auto w : getWires()) {
IdString net = getBoundWireNet(w);
if (net != IdString()) {
- assert(nets.at(net)->wires.count(w));
+ NPNR_ASSERT(nets.at(net)->wires.count(w));
}
}
for (auto &c : cells) {
- assert(c.first == c.second->name);
+ NPNR_ASSERT(c.first == c.second->name);
if (c.second->bel != BelId())
- assert(getBoundBelCell(c.second->bel) == c.first);
+ NPNR_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());
+ NPNR_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);
+ NPNR_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);
+ NPNR_ASSERT(std::count_if(net->users.begin(), net->users.end(), [&](const PortRef &pr) {
+ return pr.cell == c.second.get() && pr.port == port.first;
+ }) == 1);
}
}
}