aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-09-24 15:25:37 +0100
committerDavid Shah <davey1576@gmail.com>2018-09-24 15:25:37 +0100
commit2ee86ab5a80fdc2c49c6c6e34a2c0d31ae291c63 (patch)
tree6dae031af8587633a1c7715b6e116ea3e9157fa9
parentd5d9fb27a66604c89b7a2746e7ca9749b62aec91 (diff)
downloadnextpnr-2ee86ab5a80fdc2c49c6c6e34a2c0d31ae291c63.tar.gz
nextpnr-2ee86ab5a80fdc2c49c6c6e34a2c0d31ae291c63.tar.bz2
nextpnr-2ee86ab5a80fdc2c49c6c6e34a2c0d31ae291c63.zip
ice40: Tristate IO support fixes
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r--ice40/cells.cc12
-rw-r--r--ice40/cells.h2
-rw-r--r--ice40/pack.cc2
3 files changed, 10 insertions, 6 deletions
diff --git a/ice40/cells.cc b/ice40/cells.cc
index e79a1fda..70b89631 100644
--- a/ice40/cells.cc
+++ b/ice40/cells.cc
@@ -312,7 +312,7 @@ void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_l
replace_port(dff, ctx->id("Q"), lc, ctx->id("O"));
}
-void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio)
+void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, std::unordered_set<IdString> &todelete_cells)
{
if (nxio->type == ctx->id("$nextpnr_ibuf")) {
sbio->params[ctx->id("PIN_TYPE")] = "1";
@@ -339,12 +339,16 @@ void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio)
sbio->params[ctx->id("PIN_TYPE")] = "41";
replace_port(tbuf, ctx->id("A"), sbio, ctx->id("D_OUT_0"));
replace_port(tbuf, ctx->id("E"), sbio, ctx->id("OUTPUT_ENABLE"));
- ctx->nets.erase(donet->name);
- if (!donet->users.empty())
+
+ if (donet->users.size() > 1) {
+ for (auto user : donet->users)
+ log_info(" remaining tristate user: %s.%s\n", user.cell->name.c_str(ctx), user.port.c_str(ctx));
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);
+ }
+ ctx->nets.erase(donet->name);
+ todelete_cells.insert(tbuf->name);
}
}
diff --git a/ice40/cells.h b/ice40/cells.h
index 16135448..054388ac 100644
--- a/ice40/cells.h
+++ b/ice40/cells.h
@@ -98,7 +98,7 @@ void lut_to_lc(const Context *ctx, CellInfo *lut, CellInfo *lc, bool no_dff = tr
void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_lut = false);
// Convert a nextpnr IO buffer to a SB_IO
-void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio);
+void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, std::unordered_set<IdString> &todelete_cells);
// Return true if a port is a clock port
bool is_clock_port(const BaseCtx *ctx, const PortRef &port);
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 7c853e0e..feca8a77 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -424,7 +424,7 @@ static void pack_io(Context *ctx)
// Create a SB_IO buffer
std::unique_ptr<CellInfo> ice_cell =
create_ice_cell(ctx, ctx->id("SB_IO"), ci->name.str(ctx) + "$sb_io");
- nxio_to_sb(ctx, ci, ice_cell.get());
+ nxio_to_sb(ctx, ci, ice_cell.get(), packed_cells);
new_cells.push_back(std::move(ice_cell));
sb = new_cells.back().get();
}