Skip to content

Commit

Permalink
build: common: TristateImpl: support longer oe
Browse files Browse the repository at this point in the history
support setting a different oe for every line in
the Tristates.

this is also needed for the multibit io, where oe has the same lenght
as the io., because some platforms use the generic implementation
of the SDR/DDRTristate, that uses a Tristate internally.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
  • Loading branch information
maass-hamburg committed Jan 23, 2025
1 parent ad5d7d3 commit 4be66b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion litex/build/efinix/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def __init__(self, io, o, oe, i=None):
io_data_i = platform.add_iface_io(io_name + "_OUT", len(io))
self.comb += io_data_i.eq(o)
io_data_e = platform.add_iface_io(io_name + "_OE", len(io))
self.comb += io_data_e.eq(oe)
self.comb += io_data_e.eq(oe if len(oe) == len(io) else Replicate(oe, len(io)))
if i is not None:
io_data_o = platform.add_iface_io(io_name + "_IN", len(io))
self.comb += i.eq(io_data_o)
Expand Down
2 changes: 1 addition & 1 deletion litex/build/gowin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(self, io, o, oe, i):
io_IO = io[bit] if nbits > 1 else io,
o_O = i[bit] if nbits > 1 else i,
i_I = o[bit] if nbits > 1 else o,
i_OEN = ~oe,
i_OEN = ~oe[bit] if len(oe) == nbits > 1 else ~oe,
)

class Gw5ATristate:
Expand Down
6 changes: 3 additions & 3 deletions litex/build/lattice/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(self, io, o, oe, i):
io_B = io[bit] if nbits > 1 else io,
i_I = o[bit] if nbits > 1 else o,
o_O = i[bit] if nbits > 1 else i,
i_T = ~oe
i_T = ~oe[bit] if len(oe) == nbits > 1 else ~oe
)

class LatticeECP5Tristate(Module):
Expand Down Expand Up @@ -183,7 +183,7 @@ def __init__(self, io, o, oe, i):
i_B = io[bit] if nbits > 1 else io,
i_I = o[bit] if nbits > 1 else o,
o_O = i[bit] if nbits > 1 else i,
i_T = ~oe
i_T = ~oe[bit] if len(oe) > 1 else ~oe
)

class LatticeECP5TrellisTristate(Module):
Expand Down Expand Up @@ -400,7 +400,7 @@ def __init__(self, io, o, oe, i):
self.specials += Instance("SB_IO",
p_PIN_TYPE = C(0b101001, 6), # PIN_OUTPUT_TRISTATE + PIN_INPUT
io_PACKAGE_PIN = io[bit] if nbits > 1 else io,
i_OUTPUT_ENABLE = oe,
i_OUTPUT_ENABLE = oe[bit] if len(oe) > 1 else oe,
i_D_OUT_0 = o[bit] if nbits > 1 else o,
o_D_IN_0 = i[bit] if nbits > 1 else i,
)
Expand Down

0 comments on commit 4be66b7

Please sign in to comment.