back.rtlil: don't emit a slice if all bits are used.

This commit is contained in:
whitequark 2018-12-16 16:05:38 +00:00
parent 9794e732e2
commit 2833b36c73

View file

@ -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)