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

fix numerical overflow in bit shift operation #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bunnie
Copy link

@bunnie bunnie commented Dec 18, 2022

In xsim, the limited bit width of the shift-right argument r_grant_encoded causes overflow when the shift amount is multiplied by DATA_WIDTH, leading to a result of always 0 (for example, on a 32-bit wide 3x1 crossbar, r_grant_encoded would have a bit width of 2 bits, which is then multiplied by 32, which yields 0 for any value of r_grant_encoded that is multiplied and then stuffed back into its 2-bit specified width).

This creates an explicitly sized shift right argument to fix this small compatibility issue. I'm not actually sure if this is a bug is xsim (this is the Xilinx Vivado simulator) or if it's an issue with the code; however, empirically, this fixes an issue encountered simulating the code.

In `xsim`, the limited precision of the shift-right argument
causes overflow when the shift amount is multiplied by data
width, leading to a result of always 0.

This creates an explicitly sized shift right argument to fix
this small compatibility issue.
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

Successfully merging this pull request may close these issues.

1 participant