add gpr lookup in Indexed SVSHAPE iterator (no elwidths yet)
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 9 Jul 2022 20:45:12 +0000 (21:45 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 9 Jul 2022 20:45:12 +0000 (21:45 +0100)
src/openpower/decoder/isa/svshape.py

index e22395c25db4f3e867b3388837a25dfd78651d88..e5d9ed26d469301722a538d0a4cc7a03c9ad6577 100644 (file)
@@ -22,8 +22,9 @@ from openpower.util import log
 
 
 class SVSHAPE(SelectableInt):
-    def __init__(self, value):
+    def __init__(self, value, gpr=None):
         SelectableInt.__init__(self, value, 32)
+        self·gpr = gpr # for Indexed mode
         offs = 0
         # set up sub-fields from Record layout
         self.fsi = {}
@@ -144,9 +145,17 @@ class SVSHAPE(SelectableInt):
     def offset(self, value):
         self.fsi['offset'].eq(value)
 
+    def _indexed_iterator(self, *args):
+        idx, stop = yield from iterate_indices(*args)
+        if self.gpr is None:
+            return idx, stop
+        return self.gpr(self.svgpr+idx), stop # TODO: ekwidths
+
     def get_iterator(self):
         log ("SVSHAPE get_iterator", self.mode, self.ydimsz)
-        if self.mode == 0b00:
+        if self.mode == 0b00 and self.is_indexed():
+            iterate_fn = self._indexed_iterator
+        elif self.mode == 0b00:
             iterate_fn = iterate_indices
         elif self.mode in [0b01, 0b11]:
             # further sub-selection