-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strange error with arrays #51
Comments
Yup, it's a bug and I think I know where. |
I don't know if it helps, but I reduced it a bit further: from nmigen import *
from nmigen.cli import main
m = Module()
a = Signal(1)
array = Array(x for x in range(2))
m.d.sync += a.eq(array[a])
if __name__ == "__main__":
main(m, ports=[a]) fails similarly (https://hastebin.com/qujiciyihe.sql). |
Oh, I figured it out, thanks! It's an issue with how legalizer expands arrays into switches; it does that by replacing the array index with a constant. But, in this case, you also have the array index on left-hand side, which shouldn't be replaced with a constant. |
Ah, I understand. So from nmigen import *
from nmigen.cli import main
m = Module()
p = Signal(5, reset=0b11)
a = Signal(2, reset = 1)
m.d.sync += Cat(p.part(a, 1), a).eq(a)
if __name__ == "__main__":
main(m) Actually looking at the |
Thanks for the report! By the way, you can use |
This
gives a strange error (https://hastebin.com/cedapovure.sql) when running
generate
while
works.
I am not sure how to interpret this error and it seems like a bug in nmigen.
The text was updated successfully, but these errors were encountered: