+class Mem:
+
+ def __init__(self):
+ self.mem = []
+ for i in range(128):
+ self.mem.append(i)
+
+ def __call__(self, addr, sz):
+ res = []
+ for s in range(sz): # TODO: big/little-end
+ res.append(SelectableInt(self.mem[addr.value + s], 8))
+ print ("memread", addr, sz, res)
+ return selectconcat(*res)
+
+ def memassign(self, addr, sz, val):
+ print ("memassign", addr, sz, val)
+ for s in range(sz):
+ byte = (val.value) >> (s*8) & 0xff # TODO: big/little-end
+ self.mem[addr.value + s] = byte
+