back.rtlil: only expand legalized values in Array/Part context on RHS.
Otherwise the following code fails to compile: index = Signal(1) array = Array(range(2)) with m.If(0 == array[index]): m.d.sync += index.eq(0) Fixes #51.
This commit is contained in:
parent
ce1eff5464
commit
083016d747
|
@ -299,9 +299,6 @@ class _ValueCompiler(xfrm.ValueVisitor):
|
||||||
def __init__(self, state):
|
def __init__(self, state):
|
||||||
self.s = state
|
self.s = state
|
||||||
|
|
||||||
def on_value(self, value):
|
|
||||||
return super().on_value(self.s.expand(value))
|
|
||||||
|
|
||||||
def on_unknown(self, value):
|
def on_unknown(self, value):
|
||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return None
|
||||||
|
@ -375,6 +372,9 @@ class _RHSValueCompiler(_ValueCompiler):
|
||||||
(3, "m"): "$mux",
|
(3, "m"): "$mux",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def on_value(self, value):
|
||||||
|
return super().on_value(self.s.expand(value))
|
||||||
|
|
||||||
def on_Const(self, value):
|
def on_Const(self, value):
|
||||||
if isinstance(value.value, str):
|
if isinstance(value.value, str):
|
||||||
return "{}'{}".format(value.nbits, value.value)
|
return "{}'{}".format(value.nbits, value.value)
|
||||||
|
|
Loading…
Reference in a new issue