compat.fhdl.structure: fix Case().makedefault().
authorwhitequark <cz@m-labs.hk>
Thu, 13 Jun 2019 03:54:46 +0000 (03:54 +0000)
committerwhitequark <cz@m-labs.hk>
Thu, 13 Jun 2019 03:56:57 +0000 (03:56 +0000)
Fixes #100.

nmigen/compat/fhdl/structure.py

index a36086ec9d28e61dca0904be2754530aaf052d61..0a58d743aec80e16f3178040ddd1b8063adc7806 100644 (file)
@@ -105,7 +105,7 @@ class Case(ast.Switch):
                         or (isinstance(choice, str) and choice == "default")
                         or choice > key):
                     key = choice
-        if isinstance(key, str) and key == "default":
+        elif isinstance(key, str) and key == "default":
             key = "-" * len(self.test)
         else:
             key = "{:0{}b}".format(wrap(key).value, len(self.test))