From 6e4efa1c66ee1a2fc84c56625ddff7ed7dd0818b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 8 Jul 2021 19:02:37 +0100 Subject: [PATCH] add ability to explicitly increment SVSTATE srcstep/dststep --- openpower/isa/simplev.mdwn | 5 +- src/openpower/decoder/isa/caller.py | 277 +++++++++++------- .../decoder/isa/test_caller_setvl.py | 27 +- src/openpower/decoder/pseudo/parser.py | 7 +- 4 files changed, 197 insertions(+), 119 deletions(-) diff --git a/openpower/isa/simplev.mdwn b/openpower/isa/simplev.mdwn index a5182547..97e6aff2 100644 --- a/openpower/isa/simplev.mdwn +++ b/openpower/isa/simplev.mdwn @@ -12,7 +12,7 @@ SVL-Form Pseudo-code: if (vf & (¬vs) & ¬(ms)) = 1 then - SVSTATE_NEXT(vf) + SVSTATE_NEXT else VLimm <- SVi + 1 if vs = 1 then @@ -30,7 +30,8 @@ Pseudo-code: VL = MVL SVSTATE[0:6] <- MVL SVSTATE[7:13] <- VL - RT <- [0]*57 || VL + if _RT != 0b00000 then + GPR(_RT) <- [0]*57 || VL MSR[6] <- vf Special Registers Altered: diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index aeefe257..600e0827 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -107,11 +107,20 @@ class GPR(dict): self[i] = SelectableInt(regfile[i], 64) def __call__(self, ridx): + if isinstance(ridx, SelectableInt): + ridx = ridx.value return self[ridx] def set_form(self, form): self.form = form + def __setitem__(self, rnum, value): + # rnum = rnum.value # only SelectableInt allowed + log("GPR setitem", rnum, value) + if isinstance(rnum, SelectableInt): + rnum = rnum.value + dict.__setitem__(self, rnum, value) + def getz(self, rnum): # rnum = rnum.value # only SelectableInt allowed log("GPR getzero?", rnum) @@ -479,7 +488,8 @@ def get_pdecode_idx_out(dec2, name): return out, o_isvec elif name == 'RT': log ("get_pdecode_idx_out", out_sel, OutSel.RT.value, - OutSel.RT_OR_ZERO.value, out, o_isvec) + OutSel.RT_OR_ZERO.value, out, o_isvec, + dec2.dec.RT) if out_sel == OutSel.RT.value: return out, o_isvec elif name == 'FRA': @@ -1115,81 +1125,19 @@ class ISACaller: dest_cr, src_cr, src_byname, dest_byname = False, False, {}, {} log ("sv rm", sv_rm, dest_cr, src_cr, src_byname, dest_byname) - # get SVSTATE VL (oh and print out some debug stuff) - if self.is_svp64_mode: - vl = self.svstate.vl.asint(msb0=True) - srcstep = self.svstate.srcstep.asint(msb0=True) - dststep = self.svstate.dststep.asint(msb0=True) - sv_a_nz = yield self.dec2.sv_a_nz - fft_mode = yield self.dec2.use_svp64_fft - in1 = yield self.dec2.e.read_reg1.data - log ("SVP64: VL, srcstep, dststep, sv_a_nz, in1 fft", - vl, srcstep, dststep, sv_a_nz, in1, fft_mode) - - # get predicate mask - srcmask = dstmask = 0xffff_ffff_ffff_ffff + # see if srcstep/dststep need skipping over masked-out predicate bits if self.is_svp64_mode: - pmode = yield self.dec2.rm_dec.predmode - reverse_gear = yield self.dec2.rm_dec.reverse_gear - sv_ptype = yield self.dec2.dec.op.SV_Ptype - srcpred = yield self.dec2.rm_dec.srcpred - dstpred = yield self.dec2.rm_dec.dstpred - pred_src_zero = yield self.dec2.rm_dec.pred_sz - pred_dst_zero = yield self.dec2.rm_dec.pred_dz - if pmode == SVP64PredMode.INT.value: - srcmask = dstmask = get_predint(self.gpr, dstpred) - if sv_ptype == SVPtype.P2.value: - srcmask = get_predint(self.gpr, srcpred) - elif pmode == SVP64PredMode.CR.value: - srcmask = dstmask = get_predcr(self.crl, dstpred, vl) - if sv_ptype == SVPtype.P2.value: - srcmask = get_predcr(self.crl, srcpred, vl) - log (" pmode", pmode) - log (" reverse", reverse_gear) - log (" ptype", sv_ptype) - log (" srcpred", bin(srcpred)) - log (" dstpred", bin(dstpred)) - log (" srcmask", bin(srcmask)) - log (" dstmask", bin(dstmask)) - log (" pred_sz", bin(pred_src_zero)) - log (" pred_dz", bin(pred_dst_zero)) - - # okaaay, so here we simply advance srcstep (TODO dststep) - # until the predicate mask has a "1" bit... or we run out of VL - # let srcstep==VL be the indicator to move to next instruction - if not pred_src_zero: - while (((1<