litex/misoc/cores/liteeth_mini/phy/loopback.py

36 lines
1010 B
Python
Raw Normal View History

from migen import *
from misoc.interconnect.csr import *
from misoc.interconnect.stream import *
from misoc.cores.liteeth_mini.common import *
from misoc.cores.liteeth.mini.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(eth_phy_description(8))
self.source = Source(eth_phy_description(8))
self.comb += Record.connect(self.sink, self.source)