1 from liteeth
.common
import *
2 from liteeth
.mac
.common
import *
3 from liteeth
.mac
.core
import LiteEthMACCore
4 from liteeth
.mac
.frontend
.wishbone
import LiteEthMACWishboneInterface
6 class LiteEthMAC(Module
, AutoCSR
):
7 def __init__(self
, phy
, dw
, interface
="crossbar", endianness
="big",
8 with_hw_preamble_crc
=True):
9 self
.submodules
.core
= LiteEthMACCore(phy
, dw
, endianness
, with_hw_preamble_crc
)
11 if interface
== "crossbar":
12 self
.submodules
.crossbar
= LiteEthMACCrossbar()
13 self
.submodules
.packetizer
= LiteEthMACPacketizer()
14 self
.submodules
.depacketizer
= LiteEthMACDepacketizer()
16 Record
.connect(self
.crossbar
.master
.source
, self
.packetizer
.sink
),
17 Record
.connect(self
.packetizer
.source
, self
.core
.sink
),
18 Record
.connect(self
.core
.source
, self
.depacketizer
.sink
),
19 Record
.connect(self
.depacketizer
.source
, self
.crossbar
.master
.sink
)
21 elif interface
== "wishbone":
22 self
.submodules
.interface
= LiteEthMACWishboneInterface(dw
, 2, 2)
24 Record
.connect(self
.interface
.source
, self
.core
.sink
),
25 Record
.connect(self
.core
.source
, self
.interface
.sink
)
27 self
.ev
, self
.bus
= self
.interface
.sram
.ev
, self
.interface
.bus
28 self
.csrs
= self
.interface
.get_csrs()
29 elif interface
== "dma":
30 raise NotImplementedError
32 raise ValueError(interface
+ " not supported by LiteEthMac!")