From: whitequark Date: Wed, 2 Jan 2019 18:14:57 +0000 (+0000) Subject: hdl.ast: allow slicing [n:n] into n-bit value. X-Git-Tag: working~97 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2b04d71d0375ddc8695dbf3078674d9dbf0d5cb;p=nmigen.git hdl.ast: allow slicing [n:n] into n-bit value. --- diff --git a/nmigen/hdl/ast.py b/nmigen/hdl/ast.py index 9295ed4..56c61ca 100644 --- a/nmigen/hdl/ast.py +++ b/nmigen/hdl/ast.py @@ -361,7 +361,7 @@ class Slice(Value): raise TypeError("Slice end must be an integer, not '{!r}'".format(end)) n = len(value) - if start not in range(-n, n): + if start not in range(-(n+1), n+1): raise IndexError("Cannot start slice {} bits into {}-bit value".format(start, n)) if start < 0: start += n