add function to turn permute into an order list
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 5 Jul 2021 13:30:50 +0000 (14:30 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 5 Jul 2021 13:30:50 +0000 (14:30 +0100)
src/openpower/sv/svp64.py

index 32880775f5be8bdecceae359468507ea6bbd9ffb..e9ba29b12272b28120e64610962d8f54eed2464b 100644 (file)
@@ -68,6 +68,15 @@ class SVP64REMAP(Record):
                                       ("ydimsz"  , 6),
                                       ("xdimsz"  , 6)], name=name)
 
+    def order(self, permute):
+        options = {0b000: [0,1,2],
+                   0b001: [0,2,1],
+                   0b010: [1,0,2],
+                   0b011: [1,2,0],
+                   0b100: [2,0,1],
+                   0b101: [2,1,0]}
+        return options[permute]
+
     def ports(self):
         return [self.mode, self.skip, self.offset, self.invxyz, self.permute,
                 self.zdimsz, self.ydimsz, self.xdimsz]