back.rtlil: translate empty slices correctly.
authorwhitequark <whitequark@whitequark.org>
Wed, 2 Jan 2019 18:14:29 +0000 (18:14 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 2 Jan 2019 18:14:29 +0000 (18:14 +0000)
nmigen/back/rtlil.py

index 85856f8e133641055ed8f03a8cbc681ef090fdcf..8982f23ad410dd5a9329e25bf59b06b528503671 100644 (file)
@@ -319,7 +319,9 @@ class _ValueCompiler(xfrm.ValueVisitor):
             return self(value.value)
 
         sigspec = self._prepare_value_for_Slice(value.value)
-        if value.start + 1 == value.end:
+        if value.start == value.end:
+            return "{}"
+        elif value.start + 1 == value.end:
             return "{} [{}]".format(sigspec, value.start)
         else:
             return "{} [{}:{}]".format(sigspec, value.end - 1, value.start)