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

peepopt: avoid shift-amount underflow #4452

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

phsauter
Copy link
Contributor

This solves issue #4413. shiftadd did not consider underflows for unsigned shift-amounts.
Specifically the issue arises if peepopt receives an expression like

wire [6:0] shift;
wire [7:0] data, shift2;
assign shift2 = shift - 1'b1;
assign out = data >> shift2;

Here an intended underflow occurs if shift<1. (by intended I mean it is what the current network implies, no matter what the designer might have wanted).
This adds a filter for the case described and adds the bug to the tests.

Copy link
Collaborator

@widlarizer widlarizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added test does fail prior to this PR, so it covers the added logic, which seems sound

@widlarizer widlarizer added the merge-after-jf Merge: PR will be merged after the next Dev JF unless concerns are raised label Aug 19, 2024
@widlarizer widlarizer merged commit e0d3bbf into YosysHQ:main Aug 19, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-after-jf Merge: PR will be merged after the next Dev JF unless concerns are raised
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants