fhdl/structure: all case statements should be lists
authorSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Sep 2015 09:22:24 +0000 (17:22 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 17 Sep 2015 09:22:24 +0000 (17:22 +0800)
migen/fhdl/structure.py

index e3faae51d77ddd2e4cb2026bc61e0d4ece9fd761..ba72f09b056a6ebc6bd1465973b8237c6af1ab11 100644 (file)
@@ -547,6 +547,8 @@ class Case(_Statement):
             if (not isinstance(k, Constant) 
                     and not (isinstance(k, str) and k == "default")):
                 raise TypeError("Case object is not a Migen constant")
+            if not isinstance(v, _collections.Iterable):
+                v = [v]
             if not _check_statement(v):
                 raise TypeError("Not all objects for case {} "
                                 "are Migen statements".format(k))