From bceee36ef6e426e1ffd42e87fe4496c1bb46772c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 12 Feb 2015 13:24:35 +0100 Subject: [PATCH] etherbone: reads OK on hardware --- liteeth/core/etherbone/record.py | 2 +- test/test_etherbone.py | 28 ++++++++++++++++++++++++++-- test/test_la.py | 3 ++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/liteeth/core/etherbone/record.py b/liteeth/core/etherbone/record.py index e1ff7976..36a54bb9 100644 --- a/liteeth/core/etherbone/record.py +++ b/liteeth/core/etherbone/record.py @@ -169,7 +169,7 @@ class LiteEthEtherboneRecord(Module): self.comb += [ Record.connect(sender.source, packetizer.sink), 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) ] if endianness is "big": diff --git a/test/test_etherbone.py b/test/test_etherbone.py index 68fff21d..fd342898 100644 --- a/test/test_etherbone.py +++ b/test/test_etherbone.py @@ -1,7 +1,7 @@ -import socket +import socket, time from liteeth.test.model.etherbone import * -SRAM_BASE = 0x02000000 +SRAM_BASE = 0x02000000//4 import socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) @@ -11,6 +11,7 @@ packet = EtherbonePacket() packet.pf = 1 packet.encode() sock.sendto(bytes(packet), ("192.168.1.40", 20000)) +time.sleep(0.01) # test writes writes_datas = [j for j in range(16)] @@ -32,3 +33,26 @@ packet = EtherbonePacket() packet.records = [record] packet.encode() 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) diff --git a/test/test_la.py b/test/test_la.py index 8bf205fe..fe5d2019 100644 --- a/test/test_la.py +++ b/test/test_la.py @@ -16,7 +16,8 @@ conditions = { "core_udp_tx_fsm_state" : 1 } 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_sum("term") -- 2.30.2