etherbone: reads OK on hardware
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 12 Feb 2015 12:24:35 +0000 (13:24 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 12 Feb 2015 14:50:07 +0000 (15:50 +0100)
liteeth/core/etherbone/record.py
test/test_etherbone.py
test/test_la.py

index e1ff79769262af96451769d90faa6ad3740b0939..36a54bb939655ca4f044fb4a77797216666160aa 100644 (file)
@@ -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":
index 68fff21dc40d9cd1c97aa7277dc165b7949c6a14..fd3428986832a393ebe8a69c8396f7c107c5c12b 100644 (file)
@@ -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)
index 8bf205feafe95b2c4b0d1209c5cecc059401306a..fe5d201967d9e63d3043a0a2ebcb864071407981 100644 (file)
@@ -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")