move debug remap to ISACaller.remap_debug()
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Jul 2022 20:34:43 +0000 (21:34 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Jul 2022 20:34:43 +0000 (21:34 +0100)
src/openpower/decoder/isa/caller.py

index 7762a9f7aaa65b1d5fec670b23939dbbeb0546da..e592d84d26675a8dd17177501d3e8e8fcc340234 100644 (file)
@@ -1318,45 +1318,7 @@ class ISACaller(ISACallerHelper, ISAFPHelpers):
         if persist or self.last_op_svshape:
             remaps = self.get_remap_indices()
         if self.is_svp64_mode and (persist or self.last_op_svshape):
-            # just some convenient debug info
-            for i in range(4):
-                sname = 'SVSHAPE%d' % i
-                shape = self.spr[sname]
-                log(sname, bin(shape.value))
-                log("    lims", shape.lims)
-                log("    mode", shape.mode)
-                log("    skip", shape.skip)
-
-            # set up the list of steps to remap
-            mi0 = self.svstate.mi0
-            mi1 = self.svstate.mi1
-            mi2 = self.svstate.mi2
-            mo0 = self.svstate.mo0
-            mo1 = self.svstate.mo1
-            steps = [(self.dec2.in1_step, mi0),  # RA
-                     (self.dec2.in2_step, mi1),  # RB
-                     (self.dec2.in3_step, mi2),  # RC
-                     (self.dec2.o_step, mo0),   # RT
-                     (self.dec2.o2_step, mo1),   # EA
-                     ]
-            remap_idxs = self.remap_idxs
-            rremaps = []
-            # now cross-index the required SHAPE for each of 3-in 2-out regs
-            rnames = ['RA', 'RB', 'RC', 'RT', 'EA']
-            for i, (dstep, shape_idx) in enumerate(steps):
-                (shape, remap) = remaps[shape_idx]
-                remap_idx = remap_idxs[shape_idx]
-                # zero is "disabled"
-                if shape.value == 0x0:
-                    continue
-                # now set the actual requested step to the current index
-                yield dstep.eq(remap_idx)
-
-                # debug printout info
-                rremaps.append((shape.mode, i, rnames[i], shape_idx,
-                                remap_idx))
-            for x in rremaps:
-                log("shape remap", x)
+            yield from self.remap_debug(remaps)
         # after that, settle down (combinatorial) to let Vector reg numbers
         # work themselves out
         yield Settle()
@@ -1568,6 +1530,46 @@ class ISACaller(ISACallerHelper, ISAFPHelpers):
         if nia_update:
             self.update_pc_next()
 
+    def remap_debug(self, remaps):
+        # just some convenient debug info
+        for i in range(4):
+            sname = 'SVSHAPE%d' % i
+            shape = self.spr[sname]
+            log(sname, bin(shape.value))
+            log("    lims", shape.lims)
+            log("    mode", shape.mode)
+            log("    skip", shape.skip)
+
+        # set up the list of steps to remap
+        mi0 = self.svstate.mi0
+        mi1 = self.svstate.mi1
+        mi2 = self.svstate.mi2
+        mo0 = self.svstate.mo0
+        mo1 = self.svstate.mo1
+        steps = [(self.dec2.in1_step, mi0),  # RA
+                 (self.dec2.in2_step, mi1),  # RB
+                 (self.dec2.in3_step, mi2),  # RC
+                 (self.dec2.o_step, mo0),   # RT
+                 (self.dec2.o2_step, mo1),   # EA
+                 ]
+        remap_idxs = self.remap_idxs
+        rremaps = []
+        # now cross-index the required SHAPE for each of 3-in 2-out regs
+        rnames = ['RA', 'RB', 'RC', 'RT', 'EA']
+        for i, (dstep, shape_idx) in enumerate(steps):
+            (shape, remap) = remaps[shape_idx]
+            remap_idx = remap_idxs[shape_idx]
+            # zero is "disabled"
+            if shape.value == 0x0:
+                continue
+            # now set the actual requested step to the current index
+            yield dstep.eq(remap_idx)
+
+            # debug printout info
+            rremaps.append((shape.mode, i, rnames[i], shape_idx, remap_idx))
+        for x in rremaps:
+            log("shape remap", x)
+
     def check_write(self, info, name, output):
         if name == 'overflow':  # ignore, done already (above)
             return