rnum = rnum.value
dict.__setitem__(self, rnum, value)
- def getz(self, rnum):
+ def getz(self, rnum, rvalue=None):
# rnum = rnum.value # only SelectableInt allowed
- log("GPR getzero?", rnum)
+ log("GPR getzero?", rnum, rvalue)
+ if rvalue is not None:
+ if rnum == 0:
+ return SelectableInt(0, rvalue.bits)
+ return rvalue
if rnum == 0:
return SelectableInt(0, 64)
return self[rnum]
regname = "_" + name
if not self.is_svp64_mode or ew_src == 64:
self.namespace[regname] = regnum
- elif regname in self.namespace:
- del self.namespace[regname]
+ else:
+ # FIXME: we're trying to access a sub-register, plain register
+ # numbers don't work for that. for now, just pass something that
+ # can be compared to 0 and probably will cause an error if misused.
+ # see https://bugs.libre-soc.org/show_bug.cgi?id=1221
+ self.namespace[regname] = regnum * 10000
if not self.is_svp64_mode or not self.pred_src_zero:
log('reading reg %s %s' % (name, str(regnum)), is_vec)
gprz = ast.Attribute(gprz, "getz", ast.Load())
# *sigh* see class GPR. we need index itself not reg value
ridx = ast.Name("_%s" % rid, ast.Load())
- p[0] = ast.Call(gprz, [ridx], [])
+ rvalue = ast.Name(rid, ast.Load())
+ p[0] = ast.Call(gprz, [ridx, rvalue], [])
print("tree", astor.dump_tree(p[0]))
else:
p[0] = p[2]
initial_svstate=svstate, expected=e)
+ def case_sv_addi_test_ra_0_sw_8(self):
+ """test of (RA|0) with sw=8"""
+ l = ['sv.addi/sw=8 *4, *12, 0x12',
+ 'sv.addi/sw=8 *8, *0, 0xAB']
+ prog = Program(list(SVP64Asm(l)), bigendian)
+
+ initial_regs = [0] * 32
+ initial_regs[12] = 0x123456789ABCDEF
+
+ svstate = SVP64State()
+ svstate.vl = 4 # VL
+ svstate.maxvl = 4 # MAXVL
+
+ e = ExpectedState(pc=0x10, int_regs=initial_regs)
+ e.intregs[4] = 0xEF + 0x12
+ e.intregs[5] = 0xCD + 0x12
+ e.intregs[6] = 0xAB + 0x12
+ e.intregs[7] = 0x89 + 0x12
+ e.intregs[8] = 0xAB
+ e.intregs[9] = 0xAB
+ e.intregs[10] = 0xAB
+ e.intregs[11] = 0xAB
+
+ self.add_case(prog, initial_regs, initial_svstate=svstate, expected=e)
+
+
def case_2_sv_add_ew32(self):
""">>> lst = ['sv.add/w=32 *1, *5, *9']
"""