Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: common: TristateImpl: support longer oe #2168

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion litex/build/efinix/common.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion litex/build/gowin/common.py
Original file line number Diff line number Diff line change
@@ -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:
6 changes: 3 additions & 3 deletions litex/build/lattice/common.py
Original file line number Diff line number Diff line change
@@ -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):
@@ -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) == nbits > 1 else ~oe
)

class LatticeECP5TrellisTristate(Module):
@@ -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) == nbits > 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,
)