Skip to content

Commit ff266bc

Browse files
committedMar 12, 2015
migen/genlib/io: add DifferentialOutput and Xilinx implementation
1 parent bf28664 commit ff266bc

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
 

Diff for: ‎mibuild/xilinx/common.py

+10
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ class XilinxDifferentialInput:
9292
def lower(dr):
9393
return XilinxDifferentialInputImpl(dr.i_p, dr.i_n, dr.o)
9494

95+
class XilinxDifferentialOutputImpl(Module):
96+
def __init__(self, i, o_p, o_n):
97+
self.specials += Instance("OBUFDS", i_I=i, o_O=o_p, o_OB=o_n)
98+
99+
class XilinxDifferentialOutput:
100+
@staticmethod
101+
def lower(dr):
102+
return XilinxDifferentialOutputImpl(dr.i, dr.o_p, dr.o_n)
103+
95104
class XilinxGenericPlatform(GenericPlatform):
96105
bitstream_ext = ".bit"
97106

@@ -101,6 +110,7 @@ def get_verilog(self, *args, special_overrides=dict(), **kwargs):
101110
MultiReg: XilinxMultiReg,
102111
AsyncResetSynchronizer: XilinxAsyncResetSynchronizer,
103112
DifferentialInput: XilinxDifferentialInput,
113+
DifferentialOutput: XilinxDifferentialOutput,
104114
}
105115
so.update(special_overrides)
106116
return GenericPlatform.get_verilog(self, *args, special_overrides=so, **kwargs)

Diff for: ‎migen/genlib/io.py

+16
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,19 @@ def iter_expressions(self):
1717
@staticmethod
1818
def lower(dr):
1919
raise NotImplementedError("Attempted to use a differential input, but platform does not support them")
20+
21+
class DifferentialOutput(Special):
22+
def __init__(self, i, o_p, o_n):
23+
Special.__init__(self)
24+
self.i = i
25+
self.o_p = o_p
26+
self.o_n = o_n
27+
28+
def iter_expressions(self):
29+
yield self, "i", SPECIAL_INPUT
30+
yield self, "o_p", SPECIAL_OUTPUT
31+
yield self, "o_n", SPECIAL_OUTPUT
32+
33+
@staticmethod
34+
def lower(dr):
35+
raise NotImplementedError("Attempted to use a differential output, but platform does not support them")

0 commit comments

Comments
 (0)
Please sign in to comment.