From e8e14d8ca51a4f1dc9465eb814d9bbcd1b15e47a Mon Sep 17 00:00:00 2001 From: Pawel Sagan Date: Mon, 6 Sep 2021 21:00:18 +0200 Subject: [PATCH 1/2] build/lattice: add DDRTristate for Crosslink-NX --- litex/build/lattice/common.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/litex/build/lattice/common.py b/litex/build/lattice/common.py index 842872e78..36dfe2b6b 100644 --- a/litex/build/lattice/common.py +++ b/litex/build/lattice/common.py @@ -298,6 +298,23 @@ class LatticeNXDDROutput: def lower(dr): return LatticeNXDDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk) +# NX DDR Tristate ------------------------------------------------------------------------------------ + +class LatticeNXDDRTristateImpl(Module): + def __init__(self, io, o1, o2, oe1, oe2, i1, i2, clk): + _o = Signal() + _oe = Signal() + _i = Signal() + self.specials += DDROutput(i1, i2, _o, clk) + self.specials += SDROutput(oe1|oe2, _oe, clk) + self.specials += DDRInput(_i, o1, o2, clk) + self.specials += Tristate(io, _o, _oe, _i) + +class LatticeNXDDRTristate: + @staticmethod + def lower(dr): + return LatticeNXDDRTristateImpl(dr.io, dr.o1, dr.o2, dr.oe1, dr.oe2, dr.i1, dr.i2, dr.clk) + # NX Special Overrides ----------------------------------------------------------------------------- lattice_NX_special_overrides = { @@ -306,6 +323,7 @@ lattice_NX_special_overrides = { SDROutput: LatticeNXSDROutput, DDRInput: LatticeNXDDRInput, DDROutput: LatticeNXDDROutput, + DDRTristate: LatticeNXDDRTristate, } lattice_NX_special_overrides_for_oxide = dict(lattice_NX_special_overrides) From 6c0a758468c79f80ecaf285a215a0ddeb0b7e958 Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Mon, 20 Sep 2021 10:57:20 +0200 Subject: [PATCH 2/2] Added syn_useioff attribute support for Oxide toolchain and for the DDRTristate in Crosslink NX Signed-off-by: Maciej Kurc --- litex/build/lattice/common.py | 1 + litex/build/lattice/oxide.py | 1 + 2 files changed, 2 insertions(+) diff --git a/litex/build/lattice/common.py b/litex/build/lattice/common.py index 36dfe2b6b..d325c4f1c 100644 --- a/litex/build/lattice/common.py +++ b/litex/build/lattice/common.py @@ -309,6 +309,7 @@ class LatticeNXDDRTristateImpl(Module): self.specials += SDROutput(oe1|oe2, _oe, clk) self.specials += DDRInput(_i, o1, o2, clk) self.specials += Tristate(io, _o, _oe, _i) + _oe.attr.add("syn_useioff") class LatticeNXDDRTristate: @staticmethod diff --git a/litex/build/lattice/oxide.py b/litex/build/lattice/oxide.py index f2042480c..f59863937 100644 --- a/litex/build/lattice/oxide.py +++ b/litex/build/lattice/oxide.py @@ -108,6 +108,7 @@ def _run_script(script): class LatticeOxideToolchain: attr_translate = { "keep": ("keep", "true"), + "syn_useioff": ("syn_useioff", 1), } special_overrides = common.lattice_NX_special_overrides_for_oxide