From: lkcl Date: Fri, 14 Apr 2023 17:30:07 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls008_v1~14 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f5d6f46e3c17e94717db22766ccd7a5451f3f62;p=libreriscv.git --- diff --git a/openpower/sv/svstep.mdwn b/openpower/sv/svstep.mdwn index e080bbe4d..4a5fc363d 100644 --- a/openpower/sv/svstep.mdwn +++ b/openpower/sv/svstep.mdwn @@ -153,13 +153,121 @@ not normally found in Vector ISAs. if SVi = 6 then return SVSTATE.dststep if SVi = 7 then return SVSTATE.ssubstep # SUBVL source step if SVi = 8 then return SVSTATE.dsubstep # SUBVL dest step - ADVANCE_STEPS() + # SVi=0, explicit iteration requezted + src_iterate(); + dst_iterate(); return 0 ``` **ADVANCE_STEPS** ``` + def src_iterate(): # source-stepping iterator + subvl = self.subvl + vl = self.svstate.vl + pack = self.svstate.pack + unpack = self.svstate.unpack + ssubstep = self.svstate.ssubstep + end_ssub = ssubstep == subvl + end_src = self.svstate.srcstep == vl-1 + # first source step + srcstep = self.svstate.srcstep + srcmask = self.srcmask + if pack: + # pack advances subvl in *outer* loop + while True: + assert srcstep <= vl-1 + end_src = srcstep == vl-1 + if end_src: + if end_ssub: + self.loopend = True + else: + self.svstate.ssubstep += SelectableInt(1, 2) + srcstep = 0 # reset + break + else: + srcstep += 1 # advance srcstep + if not self.srcstep_skip: + break + if ((1 << srcstep) & srcmask) != 0: + break + else: + # advance subvl in *inner* loop + if end_ssub: + while True: + assert srcstep <= vl-1 + end_src = srcstep == vl-1 + if end_src: # end-point + self.loopend = True + srcstep = 0 + break + else: + srcstep += 1 + if not self.srcstep_skip: + break + if ((1 << srcstep) & srcmask) != 0: + break + else: + log(" sskip", bin(srcmask), bin(1 << srcstep)) + self.svstate.ssubstep = SelectableInt(0, 2) # reset + else: + # advance ssubstep + self.svstate.ssubstep += SelectableInt(1, 2) + + self.svstate.srcstep = SelectableInt(srcstep, 7) + + def dst_iterate(): # dest step iterator + vl = self.svstate.vl + subvl = self.subvl + pack = self.svstate.pack + unpack = self.svstate.unpack + dsubstep = self.svstate.dsubstep + end_dsub = dsubstep == subvl + dststep = self.svstate.dststep + end_dst = dststep == vl-1 + dstmask = self.dstmask + # now dest step + if unpack: + # unpack advances subvl in *outer* loop + while True: + assert dststep <= vl-1 + end_dst = dststep == vl-1 + if end_dst: + if end_dsub: + self.loopend = True + else: + self.svstate.dsubstep += SelectableInt(1, 2) + dststep = 0 # reset + break + else: + dststep += 1 # advance dststep + if not self.dststep_skip: + break + if ((1 << dststep) & dstmask) != 0: + break + else: + # advance subvl in *inner* loop + if end_dsub: + while True: + assert dststep <= vl-1 + end_dst = dststep == vl-1 + if end_dst: # end-point + self.loopend = True + dststep = 0 + break + else: + dststep += 1 + if not self.dststep_skip: + break + if ((1 << dststep) & dstmask) != 0: + break + self.svstate.dsubstep = SelectableInt(0, 2) # reset + else: + # advance ssubstep + self.svstate.dsubstep += SelectableInt(1, 2) + + self.svstate.dststep = SelectableInt(dststep, 7) + ``` [[!tag standards]]