add dump of SPRs to pypowersim
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 21 May 2021 13:50:58 +0000 (14:50 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 21 May 2021 13:50:58 +0000 (14:50 +0100)
src/openpower/decoder/isa/caller.py
src/openpower/decoder/isa/pypowersim.py

index 4ea2061a174b37964f8b7ec81062e6a4240b2ec7..613ad01c23defbf88ef7352322e170ef1388ee67 100644 (file)
@@ -191,6 +191,17 @@ class SPR(dict):
     def __call__(self, ridx):
         return self[ridx]
 
+    def dump(self):
+        keys = list(self.keys())
+        keys.sort()
+        for k in keys:
+            sprname = spr_dict.get(k, None)
+            if sprname is None:
+                sprname = k
+            else:
+                sprname = sprname.SPR
+            print("    ", sprname, hex(self[k].value))
+
 
 class PC:
     def __init__(self, pc_init=0):
index ca0a490071573572efb257906178d57bb4702f0a..d4e85585e091cc915e528c4f0273944b086f4b60 100644 (file)
@@ -166,8 +166,12 @@ def run_simulation():
                             initial_sprs=None, svstate=0, mmu=False,
                             initial_cr=0, mem=None,
                             initial_fprs=None)
+        print ("GPRs")
         simulator.gpr.dump()
+        print ("FPRs")
         simulator.fpr.dump()
+        print ("SPRs")
+        simulator.spr.dump()
 
 
 if __name__ == "__main__":