[Bug 580] redirect MMU SPRs to the MMU
authorTobias Platen <tplaten@posteo.de>
Tue, 26 Jan 2021 19:27:40 +0000 (20:27 +0100)
committerTobias Platen <tplaten@posteo.de>
Tue, 26 Jan 2021 19:27:40 +0000 (20:27 +0100)
src/soc/decoder/power_decoder2.py

index 32cd73321f8c07d59578229a97be261a33b2da2a..1633d1912aa468bf44b8f4ed1568cbc28a1ddd82 100644 (file)
@@ -725,7 +725,25 @@ class PowerDecodeSubset(Elaboratable):
         # set up instruction, pick fn unit
         # no op: defaults to OP_ILLEGAL
         comb += self.do_copy("insn_type", self.op_get("internal_op"))
         # set up instruction, pick fn unit
         # no op: defaults to OP_ILLEGAL
         comb += self.do_copy("insn_type", self.op_get("internal_op"))
-        comb += self.do_copy("fn_unit", self.op_get("function_unit"))
+
+        #function unit for decoded instruction
+        fn = self.op_get("function_unit")
+        spr = Signal(10, reset_less=True)
+        comb += spr.eq(decode_spr_num(self.dec.SPR)) # from XFX
+
+        # for first test only forward SPR 18 to mmu
+        with m.If(self.dec.op.internal_op == MicrOp.OP_MTSPR):
+            with m.If((spr == 18) | (spr == 19)):
+                comb += self.do_copy("fn_unit",Function.MMU)
+            with m.Else():
+                comb += self.do_copy("fn_unit",fn)
+        with m.If(self.dec.op.internal_op == MicrOp.OP_MFSPR):
+            with m.If((spr == 18) | (spr == 19)):
+                comb += self.do_copy("fn_unit",Function.MMU)
+            with m.Else():
+                comb += self.do_copy("fn_unit",fn)
+        with m.Else():
+            comb += self.do_copy("fn_unit",fn)
 
         # immediates
         if self.needs_field("zero_a", "in1_sel"):
 
         # immediates
         if self.needs_field("zero_a", "in1_sel"):