use case statement in PowerDecode2
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 15 Jul 2020 13:21:23 +0000 (14:21 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 15 Jul 2020 13:21:23 +0000 (14:21 +0100)
src/soc/decoder/power_decoder2.py

index 06bdf14ef33fc8eb26fa04098b81baabc502d589..3f5686ba879ef3bdc6a45594328209d6cd94f872 100644 (file)
@@ -368,15 +368,14 @@ class DecodeOut2(Elaboratable):
         # B, BC or BCREG: potential implicit register (LR) output
         # these give bl, bcl, bclrl, etc.
         op = self.dec.op
-        with m.If((op.internal_op == MicrOp.OP_BC) |
-                  (op.internal_op == MicrOp.OP_B) |
-                  (op.internal_op == MicrOp.OP_BCREG)):
-            with m.If(self.lk): # "link" mode
-                comb += self.fast_out.data.eq(FastRegs.LR) # constant: LR
-                comb += self.fast_out.ok.eq(1)
+        with m.Switch(op.internal_op):
+            with m.Case(MicrOp.OP_BC, MicrOp.OP_B, MicrOp.OP_BCREG):
+                with m.If(self.lk): # "link" mode
+                    comb += self.fast_out.data.eq(FastRegs.LR) # constant: LR
+                    comb += self.fast_out.ok.eq(1)
 
-        # RFID 2nd spr (fast)
-        with m.If(op.internal_op == MicrOp.OP_RFID):
+            # RFID 2nd spr (fast)
+            with m.Case(MicrOp.OP_RFID):
                 comb += self.fast_out.data.eq(FastRegs.SRR1) # constant: SRR1
                 comb += self.fast_out.ok.eq(1)