set_mmu_spr was using the slow-SPR index for the regfile
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 16 Dec 2021 14:37:06 +0000 (14:37 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 16 Dec 2021 14:37:06 +0000 (14:37 +0000)
not the actual 10-bit SPR number.  hence trying to set PRTBL
fails

src/soc/experiment/mmu.py
src/soc/simple/test/test_core.py

index 835749298eb4095cd2d9edef3234440c3b7ee9e7..e7010584ad0958e5660ae2793f12492f2df9537c 100644 (file)
@@ -372,6 +372,11 @@ class MMU(Elaboratable):
         self.rin = rin = RegStage("r_in")
         r = RegStage("r")
 
+        # get access to prtbl and pid for debug / testing purposes ONLY
+        # (actually, not needed, because setup_regs() triggers mmu direct)
+        # self._prtbl = r.prtbl
+        # self._pid = r.pid
+
         l_in  = self.l_in
         l_out = self.l_out
         d_out = self.d_out
index cbb093d286c5c2ba4689c4c3e14421ac5725a938..0c3ad1e2b196f3465d8cbda73ba14c5c7b98230a 100644 (file)
@@ -60,7 +60,7 @@ def set_mmu_spr(name, i, val, core):  # important keep pep8 formatting
     yield fsm.mmu.l_in.rs.eq(val)
     yield
     yield fsm.mmu.l_in.mtspr.eq(0)
-    print("mmu_spr was updated")
+    print("mmu_spr %s %d was updated %x" % (name, i, val))
 
 
 def setup_regs(pdecode2, core, test):
@@ -128,7 +128,10 @@ def setup_regs(pdecode2, core, test):
             sprname = spr_dict[sprname].SPR
         if sprname == 'XER':
             continue
+        print ('set spr %s val %x' % (sprname, val))
+
         fast = spr_to_fast_reg(sprname)
+
         if fast is None:
             # match behaviour of SPRMap in power_decoder2.py
             for i, x in enumerate(SPR):
@@ -138,7 +141,7 @@ def setup_regs(pdecode2, core, test):
                     if sprname not in mmu_sprs:
                         yield sregs.memory._array[i].eq(val)
                     else:
-                        yield from set_mmu_spr(sprname, i, val, core)
+                        yield from set_mmu_spr(sprname, x.value, val, core)
         else:
             print("setting fast reg %d (%s) to %x" %
                   (fast, sprname, val))