Add recursive decoding
authorMichael Nolan <mtnolan2640@gmail.com>
Mon, 2 Mar 2020 15:40:28 +0000 (10:40 -0500)
committerMichael Nolan <mtnolan2640@gmail.com>
Mon, 2 Mar 2020 15:40:28 +0000 (10:40 -0500)
src/decoder/power_decoder.py
src/decoder/test/test_power_decoder.py

index f0d44876f95f056e32367ea367236df80f4c357d..148e1c37d283c925383bfd8643c231b444b392b3 100644 (file)
@@ -83,6 +83,8 @@ class PowerDecoder(Elaboratable):
 
         self.op = PowerOp()
         self.suffix = suffix
+        if suffix[1] - suffix[0] >= width:
+            self.suffix = None
         self.width = width
 
     def suffix_mask(self):
@@ -116,7 +118,8 @@ class PowerDecoder(Elaboratable):
                 for key, row in opcodes.items():
                     subdecoder = PowerDecoder(width=self.width - opc_in.width,
                                               opcodes=row,
-                                              opint=False)
+                                              opint=False,
+                                              suffix=self.suffix)
                     setattr(m.submodules, "dec%d" % key, subdecoder)
                     comb += subdecoder.opcode_in.eq(self.opcode_in[self.suffix[1]:])
                     with m.Case(key):
index b1851c91983c770d1d6248b02cb049762d1c2cc9..c0a82863871ea2ede96de6d0a8e484969e9c7503 100644 (file)
@@ -105,5 +105,6 @@ class DecoderTestCase(FHDLTestCase):
         self.run_test(32, "extra.csv", False)
         self.generate_ilang(32, "extra.csv", False)
 
+
 if __name__ == "__main__":
     unittest.main()