Skip to content

Commit

Permalink
migen/genlib/io: add DifferentialOutput and Xilinx implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Mar 12, 2015
1 parent bf28664 commit ff266bc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mibuild/xilinx/common.py
Expand Up @@ -92,6 +92,15 @@ class XilinxDifferentialInput:
def lower(dr):
return XilinxDifferentialInputImpl(dr.i_p, dr.i_n, dr.o)

class XilinxDifferentialOutputImpl(Module):
def __init__(self, i, o_p, o_n):
self.specials += Instance("OBUFDS", i_I=i, o_O=o_p, o_OB=o_n)

class XilinxDifferentialOutput:
@staticmethod
def lower(dr):
return XilinxDifferentialOutputImpl(dr.i, dr.o_p, dr.o_n)

class XilinxGenericPlatform(GenericPlatform):
bitstream_ext = ".bit"

Expand All @@ -101,6 +110,7 @@ def get_verilog(self, *args, special_overrides=dict(), **kwargs):
MultiReg: XilinxMultiReg,
AsyncResetSynchronizer: XilinxAsyncResetSynchronizer,
DifferentialInput: XilinxDifferentialInput,
DifferentialOutput: XilinxDifferentialOutput,
}
so.update(special_overrides)
return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs)
Expand Down
16 changes: 16 additions & 0 deletions migen/genlib/io.py
Expand Up @@ -17,3 +17,19 @@ def iter_expressions(self):
@staticmethod
def lower(dr):
raise NotImplementedError("Attempted to use a differential input, but platform does not support them")

class DifferentialOutput(Special):
def __init__(self, i, o_p, o_n):
Special.__init__(self)
self.i = i
self.o_p = o_p
self.o_n = o_n

def iter_expressions(self):
yield self, "i", SPECIAL_INPUT
yield self, "o_p", SPECIAL_OUTPUT
yield self, "o_n", SPECIAL_OUTPUT

@staticmethod
def lower(dr):
raise NotImplementedError("Attempted to use a differential output, but platform does not support them")

0 comments on commit ff266bc

Please sign in to comment.