projects
/
nmigen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
318274d
)
back.rtlil: do not consider unreachable array elements when legalizing.
author
whitequark
<whitequark@whitequark.org>
Wed, 1 Jan 2020 15:26:05 +0000
(15:26 +0000)
committer
whitequark
<whitequark@whitequark.org>
Wed, 1 Jan 2020 15:26:05 +0000
(15:26 +0000)
Otherwise we produce invalid RTLIL.
nmigen/back/rtlil.py
patch
|
blob
|
history
diff --git
a/nmigen/back/rtlil.py
b/nmigen/back/rtlil.py
index 9869c61d77c15c3d78a8a094056072247612f42b..4a994fd4ffd9f55e8bab6dd35005fd85f262dfb7 100644
(file)
--- a/
nmigen/back/rtlil.py
+++ b/
nmigen/back/rtlil.py
@@
-374,7
+374,9
@@
class _ValueCompiler(xfrm.ValueVisitor):
elem = value.elems[-1]
return self.match_shape(elem, *value.shape())
else:
- raise LegalizeValue(value.index, range(len(value.elems)), value.src_loc)
+ max_index = 1 << len(value.index)
+ max_elem = len(value.elems)
+ raise LegalizeValue(value.index, range(min(max_index, max_elem)), value.src_loc)
class _RHSValueCompiler(_ValueCompiler):