2015-09-30 08:17:37 -04:00
|
|
|
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):
|
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()
|
2015-09-30 08:17:37 -04:00
|
|
|
self.sink = Sink(eth_phy_description(8))
|
|
|
|
self.source = Source(eth_phy_description(8))
|
2015-04-13 03:53:43 -04:00
|
|
|
self.comb += Record.connect(self.sink, self.source)
|