add dump function for regs
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 4 Apr 2020 21:00:51 +0000 (22:00 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 4 Apr 2020 21:00:51 +0000 (22:00 +0100)
src/soc/decoder/isa/caller.py
src/soc/decoder/power_pseudo.py

index 24ce2a63e05b5a53144ed3ba0a6350a60dd1d396..d83d3354d8575821d20f50a67fafa10a28e026f7 100644 (file)
@@ -62,6 +62,11 @@ class GPR(dict):
         rnum = self._get_regnum(attr)
         return self.regfile[rnum]
 
+    def dump(self):
+        for i in range(len(self)):
+            print("reg", i, hex(self[i].value))
+
+
 
 class ISACaller:
     # decoder2 - an instance of power_decoder2
index 3ac60c14093ae93f9cb51cd49d4c3a9a43168650..188ef0c2da4dd75aff47140309d5a8c42772e9f3 100644 (file)
@@ -139,13 +139,13 @@ do i = 0 to 7
     print(i)
 """
 
-code = testdo
+#code = testdo
 #code = _bpermd
 #code = testmul
 #code = testgetzero
 #code = testcat
 #code = testgpr
-#code = testmem
+code = testmem
 #code = testgprslice
 #code = testreg
 #code = cnttzd
@@ -251,14 +251,14 @@ def test():
             # uninitialised regs, drop them into dict for function
             for rname in gsc.parser.uninit_regs:
                 d[rname] = SelectableInt(0, 64)  # uninitialised (to zero)
-                print("uninitialised", rname, get_reg_hex(d[rname]))
+                print("uninitialised", rname, hex(d[rname].value))
 
             # read regs, drop them into dict for function
             for rname in gsc.parser.read_regs:
                 regidx = yield getattr(decode.sigforms['X'], rname)
                 d[rname] = gsc.gpr[regidx] # contents of regfile
                 d["_%s" % rname] = regidx # actual register value
-                print("read reg", rname, regidx, get_reg_hex(d[rname]))
+                print("read reg", rname, regidx, hex(d[rname].value))
 
             exec(compiled_code, d)  # code gets executed here in dict "d"
             print("Done")
@@ -284,8 +284,7 @@ def test():
                        traces=decode.ports()):
         sim.run()
 
-    for i in range(len(gsc.gpr)):
-        print("regfile", i, get_reg_hex(gsc.gpr[i]))
+    gsc.gpr.dump()
 
     for i in range(0, len(gsc.mem.mem), 16):
         hexstr = []