From: Florent Kermarrec Date: Mon, 16 Feb 2015 22:37:08 +0000 (+0100) Subject: etherbone: fix addressing X-Git-Tag: 24jan2021_ls180~2604^2~14 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a3183c15d167120372d981484e8f22ff34f53bb;p=litex.git etherbone: fix addressing --- diff --git a/liteeth/core/etherbone/record.py b/liteeth/core/etherbone/record.py index 36a54bb9..77bc0378 100644 --- a/liteeth/core/etherbone/record.py +++ b/liteeth/core/etherbone/record.py @@ -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), diff --git a/liteeth/test/etherbone_tb.py b/liteeth/test/etherbone_tb.py index c49dc3c2..275dc2e6 100644 --- a/liteeth/test/etherbone_tb.py +++ b/liteeth/test/etherbone_tb.py @@ -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 index 00000000..e69de29b diff --git a/test/test_etherbone.py b/test/test_etherbone.py index fd342898..4fb4acd2 100644 --- a/test/test_etherbone.py +++ b/test/test_etherbone.py @@ -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