move default case out of switch, to make room for multiple switches
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 4 Mar 2020 16:49:01 +0000 (16:49 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 4 Mar 2020 16:49:01 +0000 (16:49 +0000)
and a *list* of subdecoders

src/decoder/power_decoder.py

index de85759235a84a4de41ffa9da34f82a743ca77c6..96ad6a73aa83c47b9275ad91ab0d788ff7bc6dab 100644 (file)
@@ -136,6 +136,9 @@ class PowerDecoder(Elaboratable):
                         comb += self.op.eq(subdecoder.op)
 
         else:
+            comb += self.op._eq(None) # default case
+            # TODO: detect if subdecoders is a *list*, and do
+            # a for-loop around the *list* of subdecoders
             with m.Switch(opcode_switch):
                 self.handle_subdecoders(m)
                 for row in self.opcodes:
@@ -146,8 +149,6 @@ class PowerDecoder(Elaboratable):
                         continue
                     with m.Case(opcode):
                         comb += self.op._eq(row)
-                with m.Default():
-                    comb += self.op._eq(None)
         return m
 
     def handle_subdecoders(self, m):