from openpower.decoder.power_enums import XER_bits, CryIn, spr_dict
from openpower.util import fast_reg_to_spr, slow_reg_to_spr # HACK!
from openpower.consts import XERRegsEnum
-from openpower.test.common import (mask_extend, SkipCase, _id, skip_case,
- skip_case_if, TestAccumulatorBase,
- TestCase)
# TODO: make this a util routine (somewhere)
for i, x in enumerate(SPR):
if spr_num == x.value:
return i
+
+
+# TODO: make this a util routine (somewhere)
+def mask_extend(x, nbits, repeat):
+ res = 0
+ extended = (1<<repeat)-1
+ for i in range(nbits):
+ if x & (1<<i):
+ res |= extended << (i*repeat)
+ return res
+
+