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/lattice/common.py: added Tristate support for ECP5 when build with diamond #2125

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
19 changes: 19 additions & 0 deletions litex/build/lattice/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,29 @@ class LatticeECP5DifferentialOutput:
def lower(dr):
return LatticeECP5DifferentialOutputImpl(dr.i, dr.o_p, dr.o_n)

# ECP5 Special Tristate ----------------------------------------------------------------------------

class LatticeECP5TristateImpl(Module):
def __init__(self, io, o, oe, i):
nbits, sign = value_bits_sign(io)
for bit in range(nbits):
self.specials += Instance("BB",
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
)

class LatticeECP5Tristate(Module):
@staticmethod
def lower(dr):
return LatticeECP5TristateImpl(dr.target, dr.o, dr.oe, dr.i)

# ECP5 Special Overrides ---------------------------------------------------------------------------

lattice_ecp5_special_overrides = {
AsyncResetSynchronizer: LatticeECP5AsyncResetSynchronizer,
Tristate: LatticeECP5Tristate,
SDRInput: LatticeECP5SDRInput,
SDROutput: LatticeECP5SDROutput,
DDRInput: LatticeECP5DDRInput,
Expand Down
Loading