etherbone: fix addressing
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 16 Feb 2015 22:37:08 +0000 (23:37 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 16 Feb 2015 23:02:49 +0000 (00:02 +0100)
liteeth/core/etherbone/record.py
liteeth/test/etherbone_tb.py
liteeth/test/model/__init__.py [new file with mode: 0644]
test/test_etherbone.py

index 36a54bb939655ca4f044fb4a77797216666160aa..77bc0378dc285e1aa5a760ca4908cbb53404fa3f 100644 (file)
@@ -52,7 +52,7 @@ class LiteEthEtherboneRecordReceiver(Module):
                        source.eop.eq(counter.value == fifo.source.wcount-1),
                        source.count.eq(fifo.source.wcount),
                        source.be.eq(fifo.source.byte_enable),
-                       source.addr.eq(base_addr.q + counter.value),
+                       source.addr.eq(base_addr.q[2:] + counter.value),
                        source.we.eq(1),
                        source.data.eq(fifo.source.data),
                        fifo.source.ack.eq(source.ack),
@@ -80,7 +80,7 @@ class LiteEthEtherboneRecordReceiver(Module):
                        source.eop.eq(counter.value == fifo.source.rcount-1),
                        source.count.eq(fifo.source.rcount),
                        source.base_addr.eq(base_addr.q),
-                       source.addr.eq(fifo.source.data),
+                       source.addr.eq(fifo.source.data[2:]),
                        fifo.source.ack.eq(source.ack),
                        If(source.stb & source.ack,
                                counter.ce.eq(1),
index c49dc3c2617fdce656c45c6bd7ccd3f490727e47..275dc2e6ab78d03ccd0175fa5841420562e2af23 100644 (file)
@@ -86,7 +86,7 @@ class TB(Module):
 
                        # test reads
                        if test_reads:
-                               reads_addrs = [j for j in range(16)]
+                               reads_addrs = [0x1000 + 4*j for j in range(16)]
                                reads = etherbone.EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs)
                                record = etherbone.EtherboneRecord()
                                record.writes = None
diff --git a/liteeth/test/model/__init__.py b/liteeth/test/model/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index fd3428986832a393ebe8a69c8396f7c107c5c12b..4fb4acd2986fd50062e65199ac995d9c583e4c02 100644 (file)
@@ -1,7 +1,7 @@
 import socket, time
 from liteeth.test.model.etherbone import *
 
-SRAM_BASE = 0x02000000//4
+SRAM_BASE = 0x02000000
 
 import socket
 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -36,7 +36,7 @@ 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_addrs = [SRAM_BASE+4*j for j in range(16)]
 reads = EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs)
 record = EtherboneRecord()
 record.writes = None