etherbone: writes OK on hardware

This commit is contained in:
Florent Kermarrec 2015-02-12 12:33:52 +01:00
parent bfb50e698f
commit 23c4f5c090
3 changed files with 26 additions and 1 deletions

View File

@ -29,7 +29,7 @@ class LiteEthEtherboneRecordReceiver(Module):
self.comb += Record.connect(sink, fifo.sink) self.comb += Record.connect(sink, fifo.sink)
self.submodules.base_addr = base_addr = FlipFlop(32) self.submodules.base_addr = base_addr = FlipFlop(32)
self.comb += base_addr.d.eq(sink.data) self.comb += base_addr.d.eq(fifo.source.data)
self.submodules.counter = counter = Counter(max=512) self.submodules.counter = counter = Counter(max=512)

View File

@ -127,6 +127,9 @@ class EtherboneSoC(GenSoC, AutoCSR):
# Etherbone # Etherbone
self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000) self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000)
self.add_wb_master(self.etherbone.master.bus)
self.submodules.sram = wishbone.SRAM(1024)
self.add_wb_slave(lambda a: a[23:25] == 1, self.sram.bus)
class EtherboneSoCDevel(EtherboneSoC, AutoCSR): class EtherboneSoCDevel(EtherboneSoC, AutoCSR):
csr_map = { csr_map = {
@ -163,6 +166,7 @@ class EtherboneSoCDevel(EtherboneSoC, AutoCSR):
# etherbone wishbone master # etherbone wishbone master
self.etherbone.master.bus.dat_w, self.etherbone.master.bus.dat_w,
self.etherbone.master.bus.dat_r, self.etherbone.master.bus.dat_r,
self.etherbone.master.bus.adr,
self.etherbone.master.bus.sel, self.etherbone.master.bus.sel,
self.etherbone.master.bus.cyc, self.etherbone.master.bus.cyc,
self.etherbone.master.bus.stb, self.etherbone.master.bus.stb,

View File

@ -11,3 +11,24 @@ packet = EtherbonePacket()
packet.pf = 1 packet.pf = 1
packet.encode() packet.encode()
sock.sendto(bytes(packet), ("192.168.1.40", 20000)) sock.sendto(bytes(packet), ("192.168.1.40", 20000))
# test writes
writes_datas = [j for j in range(16)]
writes = EtherboneWrites(base_addr=SRAM_BASE, datas=writes_datas)
record = EtherboneRecord()
record.writes = writes
record.reads = None
record.bca = 0
record.rca = 0
record.rff = 0
record.cyc = 0
record.wca = 0
record.wff = 0
record.byte_enable = 0xf
record.wcount = len(writes_datas)
record.rcount = 0
packet = EtherbonePacket()
packet.records = [record]
packet.encode()
sock.sendto(bytes(packet), ("192.168.1.40", 20000))