import sys
from openpower.decoder.selectable_int import (SelectableInt, onebit,
selectconcat, FieldSelectableInt)
+from openpower.decoder.selectable_int import EFFECTIVELY_UNLIMITED as EU
from nmutil.divmod import trunc_divs, trunc_rems
from operator import floordiv, mod
from openpower.decoder.selectable_int import selectltu as ltu
def EXTS(value):
- """ extends sign bit out from current MSB to all 256 bits
+ """ extends sign bit out from current MSB to MAX limit bits
"""
log("EXTS", value, type(value))
assert isinstance(value, SelectableInt)
- return SelectableInt(exts(value.value, value.bits) & ((1 << 256)-1), 256)
+ return SelectableInt(exts(value.value, value.bits) & ((1 << EU)-1), EU)
def EXTZ(value):
- """ zero extend to 256 bits
+ """ zero extend to EFFECTIVELY_UNLIMITED bits
"""
if isinstance(value, SelectableInt):
value = value.value
- return SelectableInt(value & ((1 << 256) - 1), 256)
+ return SelectableInt(value & ((1 << EU) - 1), EU)
def EXTS64(value):
from openpower.decoder.power_insn import SVP64Instruction
from openpower.decoder.power_svp64 import SVP64RM, decode_extra
from openpower.decoder.selectable_int import (FieldSelectableInt,
- SelectableInt, selectconcat)
+ SelectableInt, selectconcat,
+ EFFECTIVELY_UNLIMITED)
from openpower.fpscr import FPSCRState
from openpower.util import LogKind, log
self.cr_backup = 0 # sigh, dreadful hack: for fail-first (VLi)
# "undefined", just set to variable-bit-width int (use exts "max")
- # self.undefined = SelectableInt(0, 256) # TODO, not hard-code 256!
+ # self.undefined = SelectableInt(0, EFFECTIVELY_UNLIMITED)
self.namespace = {}
self.namespace.update(self.spr)
if name == 'CR0': # ignore, done already (above)
return
if isinstance(output, int):
- output = SelectableInt(output, 256)
+ output = SelectableInt(output, EFFECTIVELY_UNLIMITED)
# write carry flafs
if name in ['CA', 'CA32']:
if carry_en:
# check zeroing due to predicate bit being zero
if self.is_svp64_mode and self.pred_dst_zero:
log('zeroing reg %s %s' % (str(regnum), str(output)), is_vec)
- output = SelectableInt(0, 256)
+ output = SelectableInt(0, EFFECTIVELY_UNLIMITED)
log("write reg %s%s 0x%x ew %d" % (reg_prefix, str(regnum),
output.value, ew_dst),
kind=LogKind.InstrInOuts)
neg, inv, lshift, rshift, lt, eq)
from openpower.util import log
+EFFECTIVELY_UNLIMITED = 1024
def check_extsign(a, b):
if isinstance(b, FieldSelectableInt):
b = b.get_range()
if isinstance(b, int):
return SelectableInt(b, a.bits)
- if b.bits != 256:
+ if b.bits != EFFECTIVELY_UNLIMITED:
return b
return SelectableInt(b.value, a.bits)
def __rsub__(self, b):
log("rsub", b, self.value)
if isinstance(b, int):
- b = SelectableInt(b, 256) # max extent
+ b = SelectableInt(b, EFFECTIVELY_UNLIMITED) # max extent
#b = check_extsign(self, b)
#assert b.bits == self.bits
return SelectableInt(b.value - self.value, b.bits)