2015-02-28 03:02:28 -05:00
|
|
|
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):
|
2015-04-13 03:53:43 -04:00
|
|
|
def __init__(self):
|
|
|
|
self._reset = CSRStorage()
|
2015-04-13 05:23:27 -04:00
|
|
|
|
|
|
|
# # #
|
|
|
|
|
2015-04-13 03:53:43 -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
|
|
|
|
2015-04-13 03:53:43 -04: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):
|
2015-04-13 03:53:43 -04:00
|
|
|
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)
|