Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Signal(range(0)) raises SyntaxWarning #1019

Closed
rroohhh opened this issue Jan 7, 2024 · 2 comments · Fixed by #1054
Closed

Signal(range(0)) raises SyntaxWarning #1019

rroohhh opened this issue Jan 7, 2024 · 2 comments · Fixed by #1054

Comments

@rroohhh
Copy link
Contributor

rroohhh commented Jan 7, 2024

Signal(range(0)) raises

SyntaxWarning: Reset value 0 equals the non-inclusive end of the signal shape range(0, 0); this is likely an off-by-one error

Is this warning intended?
To me this warning is quite confusing, as amaranth implicitly converts range(0) (which would be something like a never type) to unsigned(0), and Signal(unsigned(0)) does not raise the same warning.

Some more discussion can be found in the IRC logs.

@whitequark
Copy link
Member

Is this warning intended?

It is intended in the sense that I added that warning and it performs to its specification.

To me this warning is quite confusing

I agree with Wanda that the behavior is not well-defined. Can you share the code?

@whitequark
Copy link
Member

We have discussed this issue on the 2024-01-29 meeting. We have decided to allow Signal(range(0)) without a warning, and also turn all cases of Signal(range(X, Y, Z), reset=R) where R not in range(X, Y, Z) into hard errors.

lethalbit referenced this issue in shrine-maiden-heavy-industries/torii-hdl May 7, 2024
Fixes #1019.

Co-Authored-By: Wanda <wanda@phinode.net>
Co-Authored-By: Aki Van Ness <aki@lethalbit.net>
# for free to join this conversation on GitHub. Already have an account? # to comment
Development

Successfully merging a pull request may close this issue.

2 participants