litex/liteeth/core/etherbone/__init__.py

32 lines
1.2 KiB
Python
Raw Normal View History

2015-02-09 16:37:41 -05:00
from liteeth.common import *
from liteeth.generic import *
from liteeth.generic.arbiter import Arbiter
from liteeth.generic.dispatcher import Dispatcher
from liteeth.core.etherbone.packet import *
from liteeth.core.etherbone.probe import *
from liteeth.core.etherbone.record import *
2015-02-11 13:44:02 -05:00
from liteeth.core.etherbone.wishbone import *
2015-02-09 16:37:41 -05:00
class LiteEthEtherbone(Module):
def __init__(self, udp, udp_port):
2015-02-11 19:12:52 -05:00
# decode/encode etherbone packets
self.submodules.packet = packet = LiteEthEtherbonePacket(udp, udp_port)
2015-02-11 19:12:52 -05:00
# packets can be probe (etherbone discovering) or records with
# writes and reads
self.submodules.probe = probe = LiteEthEtherboneProbe()
self.submodules.record = record = LiteEthEtherboneRecord()
2015-02-11 19:12:52 -05:00
# arbitrate/dispatch probe/records packets
dispatcher = Dispatcher(packet.source, [probe.sink, record.sink])
self.comb += dispatcher.sel.eq(~packet.source.pf)
arbiter = Arbiter([probe.source, record.source], packet.sink)
2015-02-11 19:12:52 -05:00
self.submodules += dispatcher, arbiter
2015-02-11 13:44:02 -05:00
2015-02-11 19:12:52 -05:00
# create mmap ŵishbone master
self.submodules.master = master = LiteEthEtherboneWishboneMaster()
2015-02-11 13:44:02 -05:00
self.comb += [
2015-02-11 19:12:52 -05:00
Record.connect(record.receiver.source, master.sink),
Record.connect(master.source, record.sender.sink)
2015-02-11 13:44:02 -05:00
]