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

Indexing into a 0-length array #239

Closed
emilazy opened this issue Sep 28, 2019 · 2 comments
Closed

Indexing into a 0-length array #239

emilazy opened this issue Sep 28, 2019 · 2 comments

Comments

@emilazy
Copy link
Contributor

emilazy commented Sep 28, 2019

What does it mean?? If nothing, then it should at least give a less messy error than it currently does.

@whitequark whitequark added the bug label Sep 28, 2019
@whitequark whitequark added this to the 0.1 milestone Sep 28, 2019
@whitequark
Copy link
Contributor

My view on semantics is that since we allow things like 0-bit signals (at quite some effort), we should allow 0-length arrays, too. The shape of a proxy into a 0-length array is always (0,False), and during legalization, it is treated like Cat() on both LHS and RHS.

Note that we cannot simply elide all code that refers to a 0-length array during legalization. For example, one could do something like Cat(empty_array[index_signal], lhs_signal).eq(1) and this would still need to assign lhs_signal.

An alternative would be to forbid creating a proxy into a 0-length array.

@whitequark
Copy link
Contributor

Turns out that's the semantics everything already implements, with the exception of a bug in RTLIL backend.

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

No branches or pull requests

2 participants