From: Florent Kermarrec Date: Mon, 11 Feb 2019 18:41:12 +0000 (+0100) Subject: build/lattice/common/LatticeECXTrellisImpl: add support for nbits == 1 X-Git-Tag: 24jan2021_ls180~1395 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32543430c0c17c0829443a0a0f92aca455949ef4;p=litex.git build/lattice/common/LatticeECXTrellisImpl: add support for nbits == 1 --- diff --git a/litex/build/lattice/common.py b/litex/build/lattice/common.py index 45baddb8..d1e7e82e 100644 --- a/litex/build/lattice/common.py +++ b/litex/build/lattice/common.py @@ -44,8 +44,19 @@ lattice_ecpx_special_overrides = { class LatticeECPXTrellisTristateImpl(Module): def __init__(self, io, o, oe, i): nbits, sign = value_bits_sign(io) - for bit in range(nbits): + if nbits == 1: + # If `io` is an expression like `port[x]`, it is not legal to index further + # into it if it is only 1 bit wide. self.specials += \ + Instance("TRELLIS_IO", + p_DIR="BIDIR", + i_B=io, + i_I=o, + o_O=i, + i_T=~oe, + ) + else: + for bit in range(nbits): Instance("TRELLIS_IO", p_DIR="BIDIR", i_B=io[bit], @@ -54,6 +65,7 @@ class LatticeECPXTrellisTristateImpl(Module): i_T=~oe, ) + class LatticeECPXTrellisTristate(Module): @staticmethod def lower(dr):