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

A minor bug (or functional extensions) of range select #143

Open
jsn1993 opened this issue Sep 18, 2015 · 0 comments
Open

A minor bug (or functional extensions) of range select #143

jsn1993 opened this issue Sep 18, 2015 · 0 comments

Comments

@jsn1993
Copy link
Contributor

jsn1993 commented Sep 18, 2015

See this code fragment:

bit = Bits(8, 12)
left = Bits(16, 0)
right = Bits(16, 8)
bit [ left : right ]

Then in Bits.py line 296, "ones = (1 << nbits) - 1" will raise an error because nbits should be an integer.

The semantics are to capture bit [ 0 : 8 ], but the type of nbits ("nbits = stop - start" in line 284) after this subtraction is still Bits.

I think it is useful to cast nbits to integer here because in some circumstances programmers may get the left and right range from an input port and may forget to cast Bits to integer.

Suggestion: nbits = stop - start --> nbits= (int)(stop-start)

@jsn1993 jsn1993 changed the title Some minor bugs (or functional extensions) of range select A minor bug (or functional extensions) of range select Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant