aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-10-03 12:14:49 +0100
committerDavid Shah <davey1576@gmail.com>2018-10-03 12:14:49 +0100
commit7ef8a7415d40d3c93662c0cc13bf79f6728d73fd (patch)
tree1f0aa2f4c072e37374cef7c197fb1e7fb5a15200 /ice40
parent2298c89c7bbdf44ae7f519c9e27845a409c728b3 (diff)
downloadnextpnr-7ef8a7415d40d3c93662c0cc13bf79f6728d73fd.tar.gz
nextpnr-7ef8a7415d40d3c93662c0cc13bf79f6728d73fd.tar.bz2
nextpnr-7ef8a7415d40d3c93662c0cc13bf79f6728d73fd.zip
ice40: Add error for bad PACKAGE_PIN connections
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/pack.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 35503298..3c9112a0 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -391,6 +391,8 @@ static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)
static void pack_io(Context *ctx)
{
std::unordered_set<IdString> packed_cells;
+ std::unordered_set<IdString> delete_nets;
+
std::vector<std::unique_ptr<CellInfo>> new_cells;
log_info("Packing IOs..\n");
@@ -410,14 +412,20 @@ static void pack_io(Context *ctx)
log_info("%s feeds SB_IO %s, removing %s %s.\n", ci->name.c_str(ctx), sb->name.c_str(ctx),
ci->type.c_str(ctx), ci->name.c_str(ctx));
NetInfo *net = sb->ports.at(ctx->id("PACKAGE_PIN")).net;
+ if (((ci->type == ctx->id("$nextpnr_ibuf") || ci->type == ctx->id("$nextpnr_iobuf")) &&
+ net->users.size() > 1) ||
+ (ci->type == ctx->id("$nextpnr_obuf") && (net->users.size() > 2 || net->driver.cell != nullptr)))
+ log_error("PACKAGE_PIN of SB_IO '%s' connected to more than a single top level IO.\n",
+ sb->name.c_str(ctx));
+
if (net != nullptr) {
- ctx->nets.erase(net->name);
+ delete_nets.insert(net->name);
sb->ports.at(ctx->id("PACKAGE_PIN")).net = nullptr;
}
if (ci->type == ctx->id("$nextpnr_iobuf")) {
NetInfo *net2 = ci->ports.at(ctx->id("I")).net;
if (net2 != nullptr) {
- ctx->nets.erase(net2->name);
+ delete_nets.insert(net2->name);
}
}
} else {
@@ -435,6 +443,9 @@ static void pack_io(Context *ctx)
for (auto pcell : packed_cells) {
ctx->cells.erase(pcell);
}
+ for (auto dnet : delete_nets) {
+ ctx->nets.erase(dnet);
+ }
for (auto &ncell : new_cells) {
ctx->cells[ncell->name] = std::move(ncell);
}