From 1457c32052b71fc056523f2cbeeefc44c028d765 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 22 Apr 2020 10:41:50 +0200 Subject: [PATCH] xilinx/common: use a common SDRTristate implementation for Spartan6, 7-Series and Ultrascale. --- litex/build/xilinx/common.py | 47 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/litex/build/xilinx/common.py b/litex/build/xilinx/common.py index 53b165070..a36b8af41 100644 --- a/litex/build/xilinx/common.py +++ b/litex/build/xilinx/common.py @@ -1,5 +1,5 @@ # This file is Copyright (c) 2014-2015 Sebastien Bourdeauducq -# This file is Copyright (c) 2014-2018 Florent Kermarrec +# This file is Copyright (c) 2014-2020 Florent Kermarrec # This file is Copyright (c) 2016-2018 Robert Jordens # This file is Copyright (c) 2015 William D. Jones # License: BSD @@ -127,6 +127,27 @@ class XilinxDifferentialOutput: def lower(dr): return XilinxDifferentialOutputImpl(dr.i, dr.o_p, dr.o_n) +# Common SDRTristate ------------------------------------------------------------------------------- + +class XilinxSDRTristateImpl(Module): + def __init__(self, io, o, oe, i, clk): + _o = Signal() + _oe_n = Signal() + _i = Signal() + self.specials += SDROutput(o, _o) + self.specials += SDROutput(~oe, _oe_n) + self.specials += SDRInput(_i, i) + self.specials += Instance("IOBUF", + io_IO = io, + o_O = _i, + i_I = _o, + i_T = _oe_n, + ) + +class XilinxSDRTristate: + @staticmethod + def lower(dr): + return XilinxSDRTristateImpl(dr.io, dr.o, dr.oe, dr.i, dr.clk) # Common Special Overrides ------------------------------------------------------------------------- @@ -135,6 +156,7 @@ xilinx_special_overrides = { AsyncResetSynchronizer: XilinxAsyncResetSynchronizer, DifferentialInput: XilinxDifferentialInput, DifferentialOutput: XilinxDifferentialOutput, + SDRTristate: XilinxSDRTristate, } # Spartan6 DDROutput ------------------------------------------------------------------------------- @@ -201,28 +223,6 @@ class XilinxSDRInputS6: def lower(dr): return XilinxDDRInputImplS6(dr.i, dr.o, Signal(), dr.clk) -# Spartan6 SDRTristate ----------------------------------------------------------------------------- - -class XilinxSDRTristateImplS6(Module): - def __init__(self, io, o, oe, i, clk): - _o = Signal() - _oe_n = Signal() - _i = Signal() - self.specials += SDROutput(o, _o) - self.specials += SDROutput(~oe, _oe_n) - self.specials += SDRInput(_i, i) - self.specials += Instance("IOBUF", - io_IO = io, - o_O = _i, - i_I = _o, - i_T = _oe_n, - ) - -class XilinxSDRTristateS6: - @staticmethod - def lower(dr): - return XilinxSDRTristateImplS6(dr.io, dr.o, dr.oe, dr.i, dr.clk) - # Spartan6 Special Overrides ----------------------------------------------------------------------- xilinx_s6_special_overrides = { @@ -230,7 +230,6 @@ xilinx_s6_special_overrides = { DDRInput: XilinxDDRInputS6, SDROutput: XilinxSDROutputS6, SDRInput: XilinxSDRInputS6, - SDRTristate: XilinxSDRTristateS6, } # 7-Series DDROutput -------------------------------------------------------------------------------