Skip to content

Commit

Permalink
Experimental support for arbitrary width WordMem
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdphk committed Apr 18, 2021
1 parent 0ee2ae3 commit 36639c7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pyreveng/mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class WordMem(AddressSpace):
def __init__(self, lo, hi, bits=8, attr=0, **kwargs):
assert lo < hi
assert bits > 0
assert bits <= 64
# assert bits <= 64
assert attr >= 0
assert attr <= 7

Expand All @@ -491,14 +491,19 @@ def __init__(self, lo, hi, bits=8, attr=0, **kwargs):

if bits <= 8:
self.mt = ctypes.c_uint8
self.m = (self.mt * ln)()
elif bits <= 16:
self.mt = ctypes.c_uint16
self.m = (self.mt * ln)()
elif bits <= 32:
self.mt = ctypes.c_uint32
else:
self.m = (self.mt * ln)()
elif bits <= 64:
self.mt = ctypes.c_uint64

self.m = (self.mt * ln)()
self.m = (self.mt * ln)()
else:
self.mt = int
self.m = [None] * ln

self.at = ctypes.c_uint8
self.a = (self.at * ln)()
Expand Down

0 comments on commit 36639c7

Please sign in to comment.