verilog: handle default in case statements
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 8 Dec 2011 22:04:20 +0000 (23:04 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 8 Dec 2011 22:04:20 +0000 (23:04 +0100)
migen/fhdl/verilog.py

index 05b231cc5e24546710fa282c2e05ecc81418d5d8..c403e897924791c0633038fee59c464afaba8a33 100644 (file)
@@ -65,6 +65,10 @@ def _printnode(ns, level, comb, node):
                        r += "\t"*(level + 1) + _printexpr(ns, case[0]) + ": begin\n"
                        r += _printnode(ns, level + 2, comb, case[1])
                        r += "\t"*(level + 1) + "end\n"
+               if node.default.l:
+                       r += "\t"*(level + 1) + "default: begin\n"
+                       r += _printnode(ns, level + 2, comb, node.default)
+                       r += "\t"*(level + 1) + "end\n"
                r += "\t"*level + "endcase\n"
                return r
        else: