aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-03-10 13:50:59 +0000
committerGitHub <noreply@github.com>2020-03-10 13:50:59 +0000
commitbb7358020928d0a26ab7becd123ccdc15b0206cb (patch)
treebe364e21a28d1d292ecda9a57337ba9fe81fe7e0 /ecp5
parent751f4556fde8a316030b36c3de53f08a548e3efa (diff)
parent9aa22433ff12d8e0d8edd7bba7d6fa27f097198f (diff)
downloadnextpnr-bb7358020928d0a26ab7becd123ccdc15b0206cb.tar.gz
nextpnr-bb7358020928d0a26ab7becd123ccdc15b0206cb.tar.bz2
nextpnr-bb7358020928d0a26ab7becd123ccdc15b0206cb.zip
Merge pull request #400 from YosysHQ/dave/tri-fixes
Improve handling of unused inout port bits
Diffstat (limited to 'ecp5')
-rw-r--r--ecp5/cells.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/ecp5/cells.cc b/ecp5/cells.cc
index c630c2c3..7f9f1579 100644
--- a/ecp5/cells.cc
+++ b/ecp5/cells.cc
@@ -432,7 +432,13 @@ void nxio_to_tr(Context *ctx, CellInfo *nxio, CellInfo *trio, std::vector<std::u
replace_port(nxio, ctx->id("I"), trio, ctx->id("I"));
} else if (nxio->type == ctx->id("$nextpnr_iobuf")) {
// N.B. tristate will be dealt with below
- trio->params[ctx->id("DIR")] = std::string("BIDIR");
+ NetInfo *i = get_net_or_empty(nxio, ctx->id("I"));
+ if (i == nullptr || i->driver.cell == nullptr)
+ trio->params[ctx->id("DIR")] = std::string("INPUT");
+ else {
+ log_info("%s: %s.%s\n", ctx->nameOf(i), ctx->nameOf(i->driver.cell), ctx->nameOf(i->driver.port));
+ trio->params[ctx->id("DIR")] = std::string("BIDIR");
+ }
replace_port(nxio, ctx->id("I"), trio, ctx->id("I"));
replace_port(nxio, ctx->id("O"), trio, ctx->id("O"));
} else {
@@ -446,6 +452,15 @@ void nxio_to_tr(Context *ctx, CellInfo *nxio, CellInfo *trio, std::vector<std::u
if (dinet != nullptr && dinet->name == nxio->name)
rename_net(ctx, dinet, ctx->id(dinet->name.str(ctx) + "$TRELLIS_IO_IN"));
+ if (ctx->nets.count(nxio->name)) {
+ int i = 0;
+ IdString new_name;
+ do {
+ new_name = ctx->id(nxio->name.str(ctx) + "$rename$" + std::to_string(i++));
+ } while (ctx->nets.count(new_name));
+ rename_net(ctx, ctx->nets.at(nxio->name).get(), new_name);
+ }
+
// Create a new top port net for accurate IO timing analysis and simulation netlists
if (ctx->ports.count(nxio->name)) {
IdString tn_netname = nxio->name;