From 3a83ad5d176f518726e64afe84efeff0c69f4e61 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 2 Jan 2019 18:14:29 +0000 Subject: [PATCH] back.rtlil: translate empty slices correctly. --- nmigen/back/rtlil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 2.30.2