Skip to content

Commit

Permalink
Merge pull request enjoy-digital#2068 from VOGL-electronic/ddrtristat…
Browse files Browse the repository at this point in the history
…e_oe2_optional

build: io: make oe2 of DDRTristate optional
  • Loading branch information
enjoy-digital authored Dec 4, 2024
2 parents bff25c2 + c1733ea commit a32096e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion litex/build/efinix/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def lower(dr):

class EfinixDDRTristateImpl(LiteXModule):
def __init__(self, io, o1, o2, oe1, oe2, i1, i2, clk):
assert oe1 == oe2
assert oe2 is None
assert_is_signal_or_clocksignal(clk)
platform = LiteXContext.platform
io_name = platform.get_pin_name(io)
Expand Down
8 changes: 4 additions & 4 deletions litex/build/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,20 @@ def __init__(self, io, o1, o2, oe1, oe2, i1, i2, clk):
_oe = Signal()
_i = Signal()
self.specials += DDROutput(o1, o2, _o, clk)
self.specials += DDROutput(oe1, oe2, _oe, clk)
self.specials += DDROutput(oe1, oe2, _oe, clk) if oe2 is not None else SDROutput(oe1, _oe, clk)
self.specials += DDRInput(_i, i1, i2, clk)
self.specials += Tristate(io, _o, _oe, _i)

class DDRTristate(Special):
def __init__(self, io, o1, o2, oe1, oe2, i1, i2, clk=None):
def __init__(self, io, o1, o2, oe1, oe2=None, i1=None, i2=None, clk=None):
Special.__init__(self)
self.io = io
self.o1 = o1
self.o2 = o2
self.oe1 = oe1
self.oe2 = oe2
self.i1 = i1
self.i2 = i2
self.i1 = i1 if i1 is not None else Signal()
self.i2 = i2 if i2 is not None else Signal()
self.clk = clk if clk is not None else ClockSignal()

def iter_expressions(self):
Expand Down
3 changes: 2 additions & 1 deletion litex/build/lattice/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,12 @@ def lower(dr):

class LatticeNXDDRTristateImpl(Module):
def __init__(self, io, o1, o2, oe1, oe2, i1, i2, clk):
assert oe2 is None
_o = Signal()
_oe = Signal()
_i = Signal()
self.specials += DDROutput(o1, o2, _o, clk)
self.specials += SDROutput(oe1 | oe2, _oe, clk)
self.specials += SDROutput(oe1, _oe, clk)
self.specials += DDRInput(_i, i1, i2, clk)
self.specials += Tristate(io, _o, _oe, _i)
_oe.attr.add("syn_useioff")
Expand Down
2 changes: 1 addition & 1 deletion litex/build/xilinx/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def __init__(self, io, o1, o2, oe1, oe2, i1, i2, clk):
_oe_n = Signal()
_i = Signal()
self.specials += DDROutput(o1, o2, _o, clk)
self.specials += DDROutput(~oe1, ~oe2, _oe_n, clk)
self.specials += DDROutput(~oe1, ~oe2, _oe_n, clk) if oe2 is not None else SDROutput(~oe1, _oe_n, clk)
self.specials += DDRInput(_i, i1, i2, clk)
self.specials += Instance("IOBUF",
io_IO = io,
Expand Down

0 comments on commit a32096e

Please sign in to comment.