From 5e8b24615952eaf7e7c24b85c0eb97e0e618b986 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Fri, 24 Mar 2023 01:23:33 -0700 Subject: [PATCH] Use slices to access memory contents to support both mmap and SparseMemory Signed-off-by: Alex Forencich --- cocotbext/axi/memory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocotbext/axi/memory.py b/cocotbext/axi/memory.py index c4585f6..b4ef42b 100644 --- a/cocotbext/axi/memory.py +++ b/cocotbext/axi/memory.py @@ -36,10 +36,10 @@ class Memory: super().__init__(**kwargs) def read(self, address, length): - return self.mem.read(address, length) + return self.mem[address:address+length] def write(self, address, data): - self.mem.write(address, data) + self.mem[address:address+len(data)] = data def write_words(self, address, data, byteorder='little', ws=2): words = data