litex/misoclib/com/liteeth/phy/loopback.py

32 lines
920 B
Python
Raw Normal View History

from misoclib.com.liteeth.common import *
from misoclib.com.liteeth.generic import *
2015-01-27 17:59:06 -05:00
2015-04-13 04:20:02 -04:00
2015-01-28 03:14:01 -05:00
class LiteEthPHYLoopbackCRG(Module, AutoCSR):
def __init__(self):
self._reset = CSRStorage()
2015-04-13 05:23:27 -04:00
# # #
self.clock_domains.cd_eth_rx = ClockDomain()
self.clock_domains.cd_eth_tx = ClockDomain()
self.comb += [
self.cd_eth_rx.clk.eq(ClockSignal()),
self.cd_eth_tx.clk.eq(ClockSignal())
]
2015-01-27 17:59:06 -05:00
reset = self._reset.storage
self.comb += [
self.cd_eth_rx.rst.eq(reset),
self.cd_eth_tx.rst.eq(reset)
]
2015-01-27 17:59:06 -05:00
2015-04-13 04:20:02 -04:00
2015-01-28 03:14:01 -05:00
class LiteEthPHYLoopback(Module, AutoCSR):
def __init__(self):
self.dw = 8
self.submodules.crg = LiteEthLoopbackPHYCRG()
self.sink = sink = Sink(eth_phy_description(8))
self.source = source = Source(eth_phy_description(8))
self.comb += Record.connect(self.sink, self.source)