add read grouping to etherbone, we now have interesting upload speeds... :)

This commit is contained in:
Florent Kermarrec 2015-02-23 18:53:59 +01:00
parent ac5b7c073a
commit b6ebcece95
1 changed files with 10 additions and 9 deletions

View File

@ -21,8 +21,12 @@ class LiteScopeEtherboneDriver:
def close(self): def close(self):
pass pass
def read(self, addr, burst_length=1): def read(self, addr, burst_length=None, repeats=None):
reads_addrs = [addr+4*j for j in range(burst_length)] def to_int(v):
return 1 if v is None else v
reads_addrs = []
for i in range(to_int(repeats)):
reads_addrs += [addr+4*j for j in range(to_int(burst_length))]
reads = EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs) reads = EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs)
record = EtherboneRecord() record = EtherboneRecord()
record.writes = None record.writes = None
@ -45,14 +49,11 @@ class LiteScopeEtherboneDriver:
datas, addrs = self.rx_sock.recvfrom(8192) datas, addrs = self.rx_sock.recvfrom(8192)
packet = EtherbonePacket(datas) packet = EtherbonePacket(datas)
packet.decode() packet.decode()
values = packet.records.pop().writes.get_datas() datas = packet.records.pop().writes.get_datas()
if self.debug: if self.debug:
for i, val in enumerate(values): for i, data in enumerate(datas):
print("RD %08X @ %08X" %(val, addr + 4*i)) print("RD %08X @ %08X" %(data, addr + 4*(i%to_int(burst_length))))
if burst_length == 1: return datas
return values[0]
else:
return values
def write(self, addr, datas): def write(self, addr, datas):
if not isinstance(datas, list): if not isinstance(datas, list):