self.crl[regnum].eq(cr0)
def do_outregs_nia(self, asmop, ins_name, info, outs,
- carry_en, rc_en, ffirst_hit, ew_dst):
+ ca_en, rc_en, ffirst_hit, ew_dst):
ffirst_hit, vli = ffirst_hit
- # write out any regs for this instruction
- for name, output in outs.items():
- yield from self.check_write(info, name, output, carry_en, ew_dst)
+ # write out any regs for this instruction, but only if fail-first is ok
+ # XXX TODO: allow CR-vector to be written out even if ffirst fails
+ if not ffirst_hit or vli:
+ for name, output in outs.items():
+ yield from self.check_write(info, name, output, ca_en, ew_dst)
# restore the CR value on non-VLI failfirst (from sv.cmp and others
# which write directly to CR in the pseudocode (gah, what a mess)
# if ffirst_hit and not vli:
lst = SVP64Asm(
[
# load VL bytes but test if they are zero and truncate
- "sv.lbz/ff=RC1 *16, 1(10)",
+ "sv.lbz/ff=RC1 *16, 1(10)", # deliberately offset by 1
]
)
lst = list(lst)
for i in range(8): # set to garbage
initial_regs[16+i] = (0xbeef00) + i # identifying garbage
+ # calculate expected regs
+ expected_regs = deepcopy(initial_regs)
+ for i, c in enumerate(tst_string[1:]): # note the offset 1(10)
+ c = ord(c)
+ if c == 0: break # strcpy stop at NUL
+ expected_regs[16+i] = c
+
# some memory with identifying garbage in it
initial_mem = {16: 0xf0f1_f2f3_f4f5_f6f7,
24: 0x4041_4243_4445_4647,
initial_regs=initial_regs)
mem = sim.mem.dump(printout=True, asciidump=True)
print (mem)
- self.assertEqual(sim.svstate.vl, 1)
+ self.assertEqual(sim.svstate.vl, 2)
+ for i in range(len(expected_regs)):
+ print ("%i %x %x" % (i, sim.gpr(i).value, expected_regs[i]))
+ self.assertEqual(sim.gpr(i), expected_regs[i])
def run_tst_program(self, prog, initial_regs=None,
svstate=None, initial_fprs=None,