2015-02-28 03:02:28 -05:00
|
|
|
from misoclib.com.liteeth.common import *
|
|
|
|
from misoclib.com.liteeth.core.etherbone.packet import *
|
|
|
|
from misoclib.com.liteeth.core.etherbone.probe import *
|
|
|
|
from misoclib.com.liteeth.core.etherbone.record import *
|
|
|
|
from misoclib.com.liteeth.core.etherbone.wishbone import *
|
2015-02-09 16:37:41 -05:00
|
|
|
|
2015-04-13 04:20:02 -04:00
|
|
|
|
2015-02-11 08:33:17 -05:00
|
|
|
class LiteEthEtherbone(Module):
|
2015-04-13 03:53:43 -04:00
|
|
|
def __init__(self, udp, udp_port):
|
|
|
|
# decode/encode etherbone packets
|
|
|
|
self.submodules.packet = packet = LiteEthEtherbonePacket(udp, udp_port)
|
2015-02-11 19:12:52 -05:00
|
|
|
|
2015-04-13 03:53:43 -04: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 10:21:06 -05:00
|
|
|
|
2015-04-13 03:53:43 -04: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)
|
|
|
|
self.submodules += dispatcher, arbiter
|
2015-02-11 13:44:02 -05:00
|
|
|
|
2015-04-13 03:53:43 -04:00
|
|
|
# create mmap ŵishbone master
|
|
|
|
self.submodules.master = master = LiteEthEtherboneWishboneMaster()
|
|
|
|
self.comb += [
|
|
|
|
Record.connect(record.receiver.source, master.sink),
|
|
|
|
Record.connect(master.source, record.sender.sink)
|
|
|
|
]
|