2015-02-04 13:57:20 -05:00
|
|
|
from liteeth.common import *
|
|
|
|
from liteeth.mac import LiteEthMAC
|
|
|
|
from liteeth.core.arp import LiteEthARP
|
|
|
|
from liteeth.core.ip import LiteEthIP
|
2015-02-04 15:15:01 -05:00
|
|
|
from liteeth.core.udp import LiteEthUDP
|
2015-02-04 13:57:20 -05:00
|
|
|
|
|
|
|
class LiteEthIPCore(Module, AutoCSR):
|
2015-02-05 17:46:57 -05:00
|
|
|
def __init__(self, phy, mac_address, ip_address, clk_freq):
|
2015-02-04 15:15:01 -05:00
|
|
|
self.submodules.mac = LiteEthMAC(phy, 8, interface="crossbar", with_hw_preamble_crc=True)
|
2015-02-05 17:46:57 -05:00
|
|
|
self.submodules.arp = LiteEthARP(self.mac, mac_address, ip_address, clk_freq)
|
2015-02-04 15:15:01 -05:00
|
|
|
self.submodules.ip = LiteEthIP(self.mac, mac_address, ip_address, self.arp.table)
|
2015-02-04 13:57:20 -05:00
|
|
|
self.sink, self.source = self.ip.sink, self.ip.source
|
2015-02-04 15:15:01 -05:00
|
|
|
|
|
|
|
class LiteEthUDPIPCore(LiteEthIPCore):
|
2015-02-05 17:46:57 -05:00
|
|
|
def __init__(self, phy, mac_address, ip_address, clk_freq):
|
|
|
|
LiteEthIPCore.__init__(self, phy, mac_address, ip_address, clk_freq)
|
2015-02-04 15:15:01 -05:00
|
|
|
self.submodules.udp = LiteEthUDP(self.ip, ip_address)
|
|
|
|
self.sink, self.source = self.udp.sink, self.udp.source
|