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

cxxrtl: Fix ctlz, udivmod #4067

Merged
merged 4 commits into from
Dec 12, 2023
Merged

cxxrtl: Fix ctlz, udivmod #4067

merged 4 commits into from
Dec 12, 2023

Conversation

povik
Copy link
Member

@povik povik commented Dec 11, 2023

I tried to fix ctlz and give it the usual semantics, then adjusted the divisor_shift calculation in udivmod appropriately.

@povik
Copy link
Member Author

povik commented Dec 11, 2023

Ping @merryhime, I cannot formally request review but I am requesting review

@povik
Copy link
Member Author

povik commented Dec 12, 2023

Huh, tests still stuck?

@povik
Copy link
Member Author

povik commented Dec 12, 2023

udivmod is getting chunks with higher bits uncleared, let me see where from.

@povik
Copy link
Member Author

povik commented Dec 12, 2023

Now, hopefully?

divisor = divisor.shl(value<Bits>{divisor_shift});
int64_t divisor_shift = divisor.ctlz() - dividend.ctlz();
assert(divisor_shift >= 0);
divisor = divisor.shl(value<Bits>{(chunk::type) divisor_shift});
Copy link
Member Author

Choose a reason for hiding this comment

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

Force pushed to make this cast to chunk::type instead of unsigned int

@povik
Copy link
Member Author

povik commented Dec 12, 2023

OK, there's the usual fluke CI failure on macOS but other than that the hang is no more.

@whitequark
Copy link
Member

@povik Thanks for handling this!

@povik
Copy link
Member Author

povik commented Dec 12, 2023

@whitequark Will you be able to review this today? If not we might need to revert #4061 to unblock CI.

@povik povik merged commit 5837fe8 into YosysHQ:master Dec 12, 2023
15 of 16 checks passed
@povik povik deleted the cxxrtl-udivmod-fix branch December 12, 2023 20:23
@povik povik mentioned this pull request Jan 10, 2024
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.

3 participants