From 1a3183c15d167120372d981484e8f22ff34f53bb Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 16 Feb 2015 23:37:08 +0100 Subject: [PATCH] etherbone: fix addressing --- liteeth/core/etherbone/record.py | 4 ++-- liteeth/test/etherbone_tb.py | 2 +- liteeth/test/model/__init__.py | 0 test/test_etherbone.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 liteeth/test/model/__init__.py diff --git a/liteeth/core/etherbone/record.py b/liteeth/core/etherbone/record.py index 36a54bb93..77bc0378d 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 c49dc3c26..275dc2e6a 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 000000000..e69de29bb diff --git a/test/test_etherbone.py b/test/test_etherbone.py index fd3428986..4fb4acd29 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