From edc4c856151103afbc249a5f84fd7761b5edb3bc Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 23 Jun 2021 11:43:41 +0200 Subject: [PATCH] build/lattice/common: Add ECP5 Differential Output support. --- litex/build/lattice/common.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/litex/build/lattice/common.py b/litex/build/lattice/common.py index 73d3a6581..b243a9796 100644 --- a/litex/build/lattice/common.py +++ b/litex/build/lattice/common.py @@ -111,9 +111,9 @@ class LatticeECP5DDROutput: class LatticeECP5DifferentialInputImpl(Module): def __init__(self, i_p, i_n, o): self.specials += Instance("ILVDS", - i_A=i_p, - i_AN=i_n, - o_Z=o, + i_A = i_p, + i_AN = i_n, + o_Z = o, ) class LatticeECP5DifferentialInput: @@ -121,6 +121,21 @@ class LatticeECP5DifferentialInput: def lower(dr): return LatticeECP5DifferentialInputImpl(dr.i_p, dr.i_n, dr.o) +# ECP5 Differential Output ------------------------------------------------------------------------- + +class LatticeECP5DifferentialOutputImpl(Module): + def __init__(self, i, o_p, o_n): + self.specials += Instance("OLVDS", + i_A = i, + o_Z = o_p, + o_ZN = o_n, + ) + +class LatticeECP5DifferentialOutput: + @staticmethod + def lower(dr): + return LatticeECP5DifferentialOutputImpl(dr.i, dr.o_p, dr.o_n) + # ECP5 Special Overrides --------------------------------------------------------------------------- lattice_ecp5_special_overrides = { @@ -130,6 +145,7 @@ lattice_ecp5_special_overrides = { DDRInput: LatticeECP5DDRInput, DDROutput: LatticeECP5DDROutput, DifferentialInput: LatticeECP5DifferentialInput, + DifferentialOutput: LatticeECP5DifferentialOutput, } # ECP5 Trellis Tristate ----------------------------------------------------------------------------