add SVP64REMAP Record
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 17 Jun 2021 18:43:00 +0000 (19:43 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 17 Jun 2021 18:43:00 +0000 (19:43 +0100)
https://libre-soc.org/openpower/sv/remap/

src/openpower/sv/svp64.py

index 634687e28e6f9dbb2a0b1db89878f620be345e7c..8c7a196384f24142aa95baf9f64a97dbe4df0c64 100644 (file)
@@ -8,7 +8,9 @@ For full spec see https://libre-soc.org/openpower/sv/
 
 from nmigen import Record
 
+
 # in nMigen, Record begins at the LSB and fills upwards
+# however in OpenPOWER, numbering is MSB0.  sigh.
 class SVP64Rec(Record):
     """SVP64 RM (Remap) Record.
 
@@ -35,5 +37,36 @@ class SVP64Rec(Record):
 
     def ports(self):
         return [self.mmode, self.mask, self.elwidth, self.ewsrc,
-                self.extra, self.mode]
+                self.subvl, self.extra, self.mode]
+
+
+# in nMigen, Record begins at the LSB and fills upwards
+# however in OpenPOWER, numbering is MSB0.  sigh.
+class SVP64REMAP(Record):
+    """SVP64 SHAPE (REMAP) Record.
+
+    https://libre-soc.org/openpower/sv/remap/
+
+    | Field Name  | Field bits | Description                            |
+    |-------------|------------|----------------------------------------|
+    | XDIMSZ      | `0:5`      | X Dimension size                       |
+    | YDIMSZ      | `6:11`     | Y Dimension size                       |
+    | ZDIMSZ      | `12:17`    | Z Dimension size                       |
+    | PERMUTE     | `18:20`    | Permutation order (XYZ, XZY, YXZ...)   |
+    | INVXYZ      | `21:23`    | Invert order of X or Y or Z            |
+    | OFFSET      | `24:29`    | Adds to index before modulo            |
+    | APPLYDIM    | `30:31`    | how many dimensions in use             |
+    """
+    def __init__(self, name=None):
+        Record.__init__(self, layout=[("applydim" , 2),
+                                      ("offset"   , 6),
+                                      ("invxyz"   , 3),
+                                      ("permute"  , 3),
+                                      ("zdimsz"   , 6),
+                                      ("ydimsz"   , 6),
+                                      ("xdimsz"   , 6)], name=name)
+
+    def ports(self):
+        return [self.applydim, self.offset, self.invxyz, self.permute,
+                self.zdimsz, self.ydimsz, self.xdimsz]