Indexed SVSHAPE add bypass mode when dim sizes are 1
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 10 Jul 2022 16:18:50 +0000 (17:18 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 10 Jul 2022 16:18:50 +0000 (17:18 +0100)
src/openpower/decoder/isa/remapyield.py
src/openpower/decoder/isa/svshape.py

index 93de9723e913b9ba4bd95fb099da37388fc2d001..b5fa6465745cfeaf5b84f7ab6a6c01b2b39f95ae 100644 (file)
@@ -17,6 +17,7 @@ def iterate_indices(SVSHAPE):
     if SVSHAPE.invxyz[1]: y_r.reverse()
     if SVSHAPE.invxyz[2]: z_r.reverse()
     # start an infinite (wrapping) loop
+    step = 0 # track src/dst step
     while True:
         for z in z_r:   # loop over 1st order dimension
             z_end = z == z_r[-1]
@@ -69,9 +70,9 @@ def iterate_indices(SVSHAPE):
                                 ((y_end and x_end and z_end)<<2))
 
                     if hasattr(SVSHAPE, "postprocess"): # for Indexed mode
-                        result = SVSHAPE.postprocess(result)
+                        result = SVSHAPE.postprocess(result, step)
                     yield result + SVSHAPE.offset, loopends
-
+                    step += 1
 def demo():
     # set the dimension sizes here
     xdim = 3
index dbddd5dbe1bc731fd67170000699bf0404dd82a0..5530b28de0ed0a5c8f139bc35156a04173b10d31 100644 (file)
@@ -148,11 +148,13 @@ class SVSHAPE(SelectableInt):
     def offset(self, value):
         self.fsi['offset'].eq(value)
 
-    def postprocess(self, idx):
+    def postprocess(self, idx, step):
         if self.mode != 0b00 or not self.is_indexed():
             return idx
         if self.gpr is None:
             return idx
+        if self.xdimsz == 1 and self.ydimsz == 1:
+            idx = step # no Index remapping
         remap = self.gpr(self.svgpr+idx).value # TODO: elwidths
         log ("indexed_iterator", self.svgpr, idx, remap)
         return remap