# 3.2.3 p46 p232 VRSAVE (actually SPR #256)
# create CR then allow portions of it to be "selectable" (below)
- self.cr = SelectableInt(0, 32) # TODO, must be bits range 32-63 not 0-31
+ self._cr = SelectableInt(0, 64) # underlying reg
+ self.cr = FieldSelectableInt(self._cr, list(range(32,64)))
# "undefined", just set to variable-bit-width int (use exts "max")
self.undefined = SelectableInt(0, 256) # TODO, not hard-code 256!
if isinstance(subscript, slice):
return list(self)[subscript]
else:
- return self[subscript]
+ return OrderedDict.__getitem__(self, subscript)
def decode_instructions(form):
def check_extsign(a, b):
+ if isinstance(b, FieldSelectableInt):
+ b = b.get_range()
if b.bits != 256:
return b
return SelectableInt(b.value, a.bits)
self.br = br # map of indices.
def eq(self, b):
- self.si = copy(b.si)
- self.br = copy(b.br)
+ if isinstance(b, SelectableInt):
+ for i in range(b.bits):
+ self[i] = b[i]
+ else:
+ self.si = copy(b.si)
+ self.br = copy(b.br)
def _op(self, op, b):
vi = self.get_range()
return self.merge(vi)
def __getitem__(self, key):
+ print ("getitem", key, self.br)
key = self.br[key] # don't do POWER 1.3.4 bit-inversion
return self.si[key]
def __setitem__(self, key, value):
key = self.br[key] # don't do POWER 1.3.4 bit-inversion
- return self.si__setitem__(key, value)
+ return self.si.__setitem__(key, value)
def __negate__(self):
return self._op1(negate)