2015-04-20 05:17:34 -04:00
|
|
|
from migen.fhdl.std import Instance, Module
|
|
|
|
from migen.genlib.io import DifferentialInput, DifferentialOutput
|
2015-04-20 04:06:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
class QuartusDifferentialInputImpl(Module):
|
|
|
|
def __init__(self, i_p, i_n, o):
|
|
|
|
self.specials += Instance("ALT_INBUF_DIFF",
|
2015-04-20 05:17:34 -04:00
|
|
|
name="ibuf_diff",
|
2015-04-20 04:06:24 -04:00
|
|
|
i_i=i_p,
|
|
|
|
i_ibar=i_n,
|
|
|
|
o_o=o)
|
|
|
|
|
|
|
|
|
|
|
|
class QuartusDifferentialInput:
|
|
|
|
@staticmethod
|
|
|
|
def lower(dr):
|
|
|
|
return QuartusDifferentialInputImpl(dr.i_p, dr.i_n, dr.o)
|
|
|
|
|
|
|
|
|
|
|
|
class QuartusDifferentialOutputImpl(Module):
|
|
|
|
def __init__(self, i, o_p, o_n):
|
|
|
|
self.specials += Instance("ALT_OUTBUF_DIFF",
|
2015-04-20 05:17:34 -04:00
|
|
|
name="obuf_diff",
|
2015-04-20 04:06:24 -04:00
|
|
|
i_i=i,
|
|
|
|
o_o=o_p,
|
|
|
|
o_obar=o_n)
|
|
|
|
|
|
|
|
|
|
|
|
class QuartusDifferentialOutput:
|
|
|
|
@staticmethod
|
|
|
|
def lower(dr):
|
|
|
|
return QuartusDifferentialOutputImpl(dr.i, dr.o_p, dr.o_n)
|
|
|
|
|
2015-04-20 05:17:34 -04:00
|
|
|
|
2015-04-20 04:06:24 -04:00
|
|
|
altera_special_overrides = {
|
|
|
|
DifferentialInput: QuartusDifferentialInput,
|
|
|
|
DifferentialOutput: QuartusDifferentialOutput
|
|
|
|
}
|