Skip to content
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

Accessing Memory objects with '[ ]' array syntax causes confusing build errors. #340

Closed
WRansohoff opened this issue Mar 27, 2020 · 3 comments · Fixed by #1078
Closed

Accessing Memory objects with '[ ]' array syntax causes confusing build errors. #340

WRansohoff opened this issue Mar 27, 2020 · 3 comments · Fixed by #1078

Comments

@WRansohoff
Copy link
Contributor

It sounds like it is only possible to access Memory data with square-bracket array syntax (memory[ index ]) during simulation.

But when I try to build a bitstream from a design which uses that syntax, it seems to cause an infinite loop in nMigen instead of printing an error. Interrupting the process results in some nested LegalizeValue exceptions which eventually point to:

nmigen.back.rtlil.LegalizeValue: ((+ (sig addr) (const 2'd2)), range(0, 1028), ('[...]/nmigen/hdl/mem.py', 91))

It sounds like this can be fixed by using the Memory object's read/write ports like the examples/basic/mem.py file demonstrates, but an error message might help make that more discoverable. Thanks!

@FFY00
Copy link
Contributor

FFY00 commented Mar 27, 2020

Hum, shouldn't RecursionError be raised? I think it would be good to investigate why it isn't triggered.

@whitequark
Copy link
Member

Hum, shouldn't RecursionError be raised? I think it would be good to investigate why it isn't triggered.

Because it's not an infinite loop or recursion. It's just really slow.

@whitequark
Copy link
Member

amaranth-lang/rfcs#45 may address this issue if accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants