etherbone: reads OK on hardware

This commit is contained in:
Florent Kermarrec 2015-02-12 13:24:35 +01:00
parent 23c4f5c090
commit bceee36ef6
3 changed files with 29 additions and 4 deletions

View File

@ -169,7 +169,7 @@ class LiteEthEtherboneRecord(Module):
self.comb += [ self.comb += [
Record.connect(sender.source, packetizer.sink), Record.connect(sender.source, packetizer.sink),
Record.connect(packetizer.source, source), Record.connect(packetizer.source, source),
source.length.eq(sender.source.wcount*4 + 4), # XXX verify this source.length.eq(sender.source.wcount*4 + 4 +etherbone_record_header_len), # XXX improve this
source.ip_address.eq(last_ip_address) source.ip_address.eq(last_ip_address)
] ]
if endianness is "big": if endianness is "big":

View File

@ -1,7 +1,7 @@
import socket import socket, time
from liteeth.test.model.etherbone import * from liteeth.test.model.etherbone import *
SRAM_BASE = 0x02000000 SRAM_BASE = 0x02000000//4
import socket import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@ -11,6 +11,7 @@ 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))
time.sleep(0.01)
# test writes # test writes
writes_datas = [j for j in range(16)] writes_datas = [j for j in range(16)]
@ -32,3 +33,26 @@ packet = EtherbonePacket()
packet.records = [record] packet.records = [record]
packet.encode() packet.encode()
sock.sendto(bytes(packet), ("192.168.1.40", 20000)) sock.sendto(bytes(packet), ("192.168.1.40", 20000))
time.sleep(0.01)
# test reads
reads_addrs = [SRAM_BASE+j for j in range(16)]
reads = EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs)
record = EtherboneRecord()
record.writes = None
record.reads = reads
record.bca = 0
record.rca = 0
record.rff = 0
record.cyc = 0
record.wca = 0
record.wff = 0
record.byte_enable = 0xf
record.wcount = 0
record.rcount = len(reads_addrs)
packet = EtherbonePacket()
packet.records = [record]
packet.encode()
sock.sendto(bytes(packet), ("192.168.1.40", 20000))
time.sleep(0.01)

View File

@ -16,7 +16,8 @@ conditions = {
"core_udp_tx_fsm_state" : 1 "core_udp_tx_fsm_state" : 1
} }
conditions = { conditions = {
"etherbonesocdevel_master_bus_stb" : 1 "etherbonesocdevel_master_bus_stb" : 1,
"etherbonesocdevel_master_bus_we" : 0
} }
la.configure_term(port=0, cond=conditions) la.configure_term(port=0, cond=conditions)
la.configure_sum("term") la.configure_sum("term")