serdes-transceiver/io_loopback.py

42 lines
1.1 KiB
Python
Raw Normal View History

2023-04-23 11:42:18 +08:00
from migen import *
class IOLoopBack(Module):
def __init__(self, pads):
self.o = Signal(4)
self.i = Signal(4)
self.t = Signal(4)
for i in range(4):
self.specials += Instance("IOBUFDS",
o_O=self.o[i],
io_IO=pads[i].p,
io_IOB=pads[i].n,
i_I=self.i[i],
# Always enable input buffer, so it is actually a loop back
i_T=self.t[i],
)
class SingleIOLoopback(Module):
def __init__(self, pad):
self.o = Signal()
self.i = Signal()
self.t = Signal()
self.specials += Instance(
# "IOBUFDS_DCIEN",
"IOBUFDS",
# p_DIFF_TERM="TRUE",
# p_IBUF_LOW_PWR="TRUE",
# p_USE_IBUFDISABLE="TRUE",
o_O=self.o,
io_IO=pad.p,
io_IOB=pad.n,
i_I=self.i,
# Always enable input buffer, so it is actually a loop back
i_T=self.t,
# i_IBUFDISABLE=~self.t,
# i_DCITERMDISABLE=~self.t,
)