add setter/getter properties to SVP64State, minor code-morph in ISACaller
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 13 Sep 2022 13:42:53 +0000 (14:42 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 13 Sep 2022 13:42:53 +0000 (14:42 +0100)
src/openpower/decoder/isa/caller.py
src/openpower/decoder/isa/svstate.py

index 9b1ba07fc10f0bd50c40212e3d1b700d11ebb03a..08e6d7048c8e9cbd92877e397fb2035f37e5e157 100644 (file)
@@ -1694,6 +1694,8 @@ class ISACaller(ISACallerHelper, ISAFPHelpers):
         dststep = self.svstate.dststep
         ssubstep = self.svstate.ssubstep
         dsubstep = self.svstate.dsubstep
+        pack = self.svstate.pack
+        unpack = self.svstate.unpack
         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
@@ -1707,8 +1709,6 @@ class ISACaller(ISACallerHelper, ISAFPHelpers):
         srcmask = dstmask = 0xffff_ffff_ffff_ffff
 
         pmode = yield self.dec2.rm_dec.predmode
-        pack = yield self.dec2.rm_dec.pack
-        unpack = yield self.dec2.rm_dec.unpack
         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
@@ -1742,19 +1742,30 @@ class ISACaller(ISACallerHelper, ISAFPHelpers):
         # okaaay, so here we simply advance srcstep (TODO dststep)
         # this can ONLY be done at the beginning of the "for" loop
         # (this is all actually a FSM so it's hell to keep track sigh)
+        srcstep_skip = False
         if ssubstart:
             # 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 << srcstep) & srcmask) == 0) and (srcstep != vl):
-                    log("      sskip", bin(1 << srcstep))
-                    srcstep += 1
+                srcstep_skip = True
+
+        # srcstep-skipping opportunity identified
+        if srcstep_skip:
+            while (((1 << srcstep) & srcmask) == 0) and (srcstep != vl):
+                log("      sskip", bin(1 << srcstep))
+                srcstep += 1
+
+        dststep_skip = False
         if dsubstart:
             # same for dststep
             if not pred_dst_zero:
-                while (((1 << dststep) & dstmask) == 0) and (dststep != vl):
-                    log("      dskip", bin(1 << dststep))
-                    dststep += 1
+                dststep_skip = True
+
+        # dststep-skipping opportunity identified
+        if dststep_skip:
+            while (((1 << dststep) & dstmask) == 0) and (dststep != vl):
+                log("      dskip", bin(1 << dststep))
+                dststep += 1
 
         # now work out if the relevant mask bits require zeroing
         if pred_dst_zero:
index 9b8c89be9cbf5227dde3f208ed645e8020b2a05d..8b9358339c24cbacd67e93e80375ff2503ee8953 100644 (file)
@@ -143,3 +143,19 @@ class SVP64State(SelectableInt):
     def RMpst(self, value):
         self.fsi['RMpst'].eq(value)
 
+    @property
+    def unpack(self):
+        return self.fsi['unpack'].asint(msb0=True)
+
+    @maxvl.setter
+    def unpack(self, value):
+        self.fsi['unpack'].eq(value)
+
+    @property
+    def pack(self):
+        return self.fsi['pack'].asint(msb0=True)
+
+    @maxvl.setter
+    def pack(self, value):
+        self.fsi['pack'].eq(value)
+