From: whitequark Date: Sun, 16 Dec 2018 16:05:38 +0000 (+0000) Subject: back.rtlil: don't emit a slice if all bits are used. X-Git-Tag: working~206 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2833b36c73e8e48b25a2f2228fe52ac3e1af9943;p=nmigen.git back.rtlil: don't emit a slice if all bits are used. --- diff --git a/nmigen/back/rtlil.py b/nmigen/back/rtlil.py index 5641322..05d4ac6 100644 --- a/nmigen/back/rtlil.py +++ b/nmigen/back/rtlil.py @@ -273,7 +273,9 @@ class _ValueCompiler(xfrm.AbstractValueTransformer): raise NotImplementedError # :nocov: def on_Slice(self, value): - if value.end == value.start + 1: + if value.start == 0 and value.end == len(value.value): + return self(value.value) + elif value.start + 1 == value.end: return "{} [{}]".format(self(value.value), value.start) else: return "{} [{}:{}]".format(self(value.value), value.end - 1, value.start)