return dump of SPRs (to be used for saving, later)
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 21 May 2021 13:54:45 +0000 (14:54 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 21 May 2021 13:54:45 +0000 (14:54 +0100)
src/openpower/decoder/isa/caller.py

index 613ad01c23defbf88ef7352322e170ef1388ee67..05bb3fb60954aa802575f1919641dadbff3e0580 100644 (file)
@@ -191,7 +191,8 @@ class SPR(dict):
     def __call__(self, ridx):
         return self[ridx]
 
-    def dump(self):
+    def dump(self, printout=True):
+        res = []
         keys = list(self.keys())
         keys.sort()
         for k in keys:
@@ -200,7 +201,11 @@ class SPR(dict):
                 sprname = k
             else:
                 sprname = sprname.SPR
-            print("    ", sprname, hex(self[k].value))
+            res.append((sprname, self[k].value))
+        if printout:
+            for sprname, value in res:
+                print("    ", sprname, hex(value))
+        return res
 
 
 class PC: