aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2023-01-29 22:04:13 +0100
committerSylvain Munaut <tnt@246tNt.com>2023-01-29 22:35:19 +0100
commitf50d4c1ed13142471505e0233e7985052d868ac2 (patch)
treedeaf661d7c07a89534ed3f817714925a6a32bd44 /ice40
parent0cf5006e3bbad476616f09bf1baf8a2953e1c616 (diff)
downloadnextpnr-f50d4c1ed13142471505e0233e7985052d868ac2.tar.gz
nextpnr-f50d4c1ed13142471505e0233e7985052d868ac2.tar.bz2
nextpnr-f50d4c1ed13142471505e0233e7985052d868ac2.zip
ice40: Support for undriven / unconnected output ports
If a port specified as output (and thus had a $nextpnr_obuf inserted) is undriven (const `z` or const `x`), we make sure to not enable the output driver. Also enable pull-ups if it was requested by the user. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/cells.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/ice40/cells.cc b/ice40/cells.cc
index 5e3bd139..10964f3c 100644
--- a/ice40/cells.cc
+++ b/ice40/cells.cc
@@ -411,7 +411,12 @@ void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, pool<IdString> &to
nxio->movePortTo(id_O, sbio, id_D_IN_0);
pull_up_attr = true;
} else if (nxio->type == ctx->id("$nextpnr_obuf")) {
- sbio->params[id_PIN_TYPE] = 25;
+ NetInfo *i = nxio->getPort(id_I);
+ if (i == nullptr || i->driver.cell == nullptr) {
+ sbio->params[id_PIN_TYPE] = 1;
+ pull_up_attr = true;
+ } else
+ sbio->params[id_PIN_TYPE] = 25;
nxio->movePortTo(id_I, sbio, id_D_OUT_0);
} else if (nxio->type == ctx->id("$nextpnr_iobuf")) {
// N.B. tristate will be dealt with below