From: whitequark Date: Sun, 6 Oct 2019 08:52:49 +0000 (+0000) Subject: back.rtlil: don't crash legalizing values with no branches. X-Git-Tag: v0.1rc1~38 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2512a9a12d2c062b8f34330c379ec523b125f38d;p=nmigen.git back.rtlil: don't crash legalizing values with no branches. Fixes #239. --- diff --git a/nmigen/back/rtlil.py b/nmigen/back/rtlil.py index e962366..7dbe085 100644 --- a/nmigen/back/rtlil.py +++ b/nmigen/back/rtlil.py @@ -731,7 +731,8 @@ class _StatementCompiler(xfrm.StatementVisitor): src=src(legalize.src_loc)) as switch: width, signed = legalize.value.shape() tests = ["{:0{}b}".format(v, width) for v in legalize.branches] - tests[-1] = "-" * width + if tests: + tests[-1] = "-" * width for branch, test in zip(legalize.branches, tests): with self.case(switch, (test,)): self._wrap_assign = False