From: whitequark Date: Wed, 2 Jan 2019 18:14:29 +0000 (+0000) Subject: back.rtlil: translate empty slices correctly. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3a83ad5d176f518726e64afe84efeff0c69f4e61;p=nmigen.git back.rtlil: translate empty slices correctly. --- diff --git a/nmigen/back/rtlil.py b/nmigen/back/rtlil.py index 85856f8..8982f23 100644 --- a/nmigen/back/rtlil.py +++ b/nmigen/back/rtlil.py @@ -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)