back.rtlil: fix off-by-one in Part legalization.
authorwhitequark <whitequark@whitequark.org>
Thu, 28 Mar 2019 05:12:02 +0000 (05:12 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 28 Mar 2019 05:12:12 +0000 (05:12 +0000)
Fixes #52.

nmigen/back/rtlil.py

index 6fcd50bf603e36e7fc201cbb24aefa1f5d68af4c..b338491c6d9cbb0c1d8217b83055564fb0c60f9e 100644 (file)
@@ -571,7 +571,7 @@ class _LHSValueCompiler(_ValueCompiler):
         if isinstance(offset, ast.Const):
             return self(ast.Slice(value.value, offset.value, offset.value + value.width))
         else:
-            raise LegalizeValue(value.offset, range((1 << len(value.offset)) - 1))
+            raise LegalizeValue(value.offset, range((1 << len(value.offset))))
 
     def on_Repl(self, value):
         raise TypeError # :nocov: