aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/cells.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-19 14:10:28 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-19 14:10:28 +0200
commita8071a418ddb35698cf1b9958c6caddc2e839cb2 (patch)
tree3c03d1e0c0cbc3a5222049110b7f07d12549a31c /ice40/cells.cc
parentecc2c486d9988a44eed7c2a197b0a0e50bd96248 (diff)
downloadnextpnr-a8071a418ddb35698cf1b9958c6caddc2e839cb2.tar.gz
nextpnr-a8071a418ddb35698cf1b9958c6caddc2e839cb2.tar.bz2
nextpnr-a8071a418ddb35698cf1b9958c6caddc2e839cb2.zip
ice40: Improve error reporting for invalid tristate usage
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/cells.cc')
-rw-r--r--ice40/cells.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/ice40/cells.cc b/ice40/cells.cc
index 6a8e7b5e..582e5c14 100644
--- a/ice40/cells.cc
+++ b/ice40/cells.cc
@@ -37,7 +37,7 @@ CellInfo *create_ice_cell(Context *ctx, IdString type, std::string name)
CellInfo *new_cell = new CellInfo();
if (name.empty()) {
new_cell->name = IdString(ctx, "$nextpnr_" + type.str() + "_" +
- std::to_string(auto_idx++));
+ std::to_string(auto_idx++));
} else {
new_cell->name = ctx->id(name);
}
@@ -200,8 +200,8 @@ void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio)
}
NetInfo *donet = sbio->ports.at(ctx->id("D_OUT_0")).net;
CellInfo *tbuf =
- net_driven_by(ctx, donet, []
- (const Context *ctx, const CellInfo *cell) {
+ net_driven_by(ctx, donet,
+ [](const Context *ctx, const CellInfo *cell) {
return cell->type == ctx->id("$_TBUF_");
},
"Y");
@@ -210,6 +210,10 @@ void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio)
replace_port(tbuf, "A", sbio, "D_OUT_0");
replace_port(tbuf, "E", sbio, "OUTPUT_ENABLE");
ctx->nets.erase(donet->name);
+ if (!donet->users.empty())
+ log_error("unsupported tristate IO pattern for IO buffer '%s', "
+ "instantiate SB_IO manually to ensure correct behaviour\n",
+ nxio->name.c_str(ctx));
ctx->cells.erase(tbuf->name);
}
}
@@ -251,7 +255,8 @@ bool is_enable_port(const Context *ctx, const PortRef &port)
bool is_global_net(const Context *ctx, const NetInfo *net)
{
- return bool(net_driven_by(ctx, net, is_gbuf, ctx->id("GLOBAL_BUFFER_OUTPUT")));
+ return bool(
+ net_driven_by(ctx, net, is_gbuf, ctx->id("GLOBAL_BUFFER_OUTPUT")));
}
NEXTPNR_NAMESPACE_END