bug 1155: add convenience SVSHAPE.is_triangle() function
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 27 Dec 2023 10:44:05 +0000 (10:44 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 27 Dec 2023 10:44:05 +0000 (10:44 +0000)
src/openpower/decoder/isa/svshape.py

index 7876fda4b58736a3992c8c9058970c30a6b840e3..e6294fba8c6e817aecd48a3c3c1e5afcd1ebdd46 100644 (file)
@@ -49,6 +49,10 @@ class SVSHAPE(SelectableInt):
         "REMAP Indexed Mode"
         return self.mode == 0b00 and self.submode2 in [0b110, 0b111]
 
+    def is_triangle(self):
+        "REMAP Triangle Mode"
+        return self.mode == 0b11 and self.skip in [0b00, 0b01]
+
     @property
     def submode2(self):
         return self.fsi['permute'].asint(msb0=True)
@@ -60,8 +64,8 @@ class SVSHAPE(SelectableInt):
     @property
     def order(self):
         permute = self.fsi['permute'].asint(msb0=True)
-        if self.is_indexed():
-            permute = (permute-0b110)*2 # xyz or yxz
+        if self.is_indexed() or self.is_triangle():
+            permute = (permute&0b001)*2 # xyz or yxz
         return SVP64SHAPE.order(permute)
 
     @order.setter
@@ -140,14 +144,14 @@ class SVSHAPE(SelectableInt):
 
     @property
     def skip(self):
-        if self.is_indexed():
+        if self.is_indexed() or self.is_triangle():
             inv = self.fsi['invxyz'].asint(msb0=True)
             return (inv & 0b100) >> 2
         return self.fsi['skip'].asint(msb0=True)
 
     @skip.setter
     def skip(self, value):
-        assert not self.is_indexed() # TODO
+        assert not (self.is_indexed() or self.is_triangle()) # TODO
         self.fsi['skip'].eq(value)
 
     @property