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

[MooreToCore] Lower moore operators into comb or hw. #6940

Merged

Conversation

hailongSun2000
Copy link
Member

Aim to lower moore elementary operators into comb or hw, excluding assignments and variable declarations. The latter needs to analyze the entire IR to map variables and their values. And moore without mux(? :), which is substituted by scf.if.
The elementary operators include unary, binary, relational, shift, constant, concatenation, extract, and conversion operations.
The moore.extract operation receives a variable as its operand, but comb.extract does not. I asked @fabianschuiki for help. He taught me maybe I could use comb.shr to bring a variable down to bit position 0, and then capture the correct number of bits from 0 with comb.extract.

@hailongSun2000
Copy link
Member Author

Thanks for the code review in advance! ❤️

@hailongSun2000 hailongSun2000 force-pushed the hailong/lower-operators-to-comb branch from 1bccc51 to 7ba83f4 Compare April 23, 2024 03:19
@hailongSun2000 hailongSun2000 force-pushed the hailong/lower-operators-to-comb branch from 7ba83f4 to 423839f Compare April 23, 2024 10:11
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

Looks good to me once BoolCastOpConversion returns failure() in case the operand isn't a simple bit vector 😃. Thanks for adding these conversions! Really cool to see SV get a path into the core dialects.

lib/Conversion/MooreToCore/MooreToCore.cpp Outdated Show resolved Hide resolved
Co-authored-by: Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
@hailongSun2000 hailongSun2000 force-pushed the hailong/lower-operators-to-comb branch from 423839f to faeb582 Compare April 24, 2024 01:24
@hailongSun2000
Copy link
Member Author

Looks good to me once BoolCastOpConversion returns failure() in case the operand isn't a simple bit vector 😃. Thanks for adding these conversions! Really cool to see SV get a path into the core dialects.

It's an honor for me to participate in this! 😄

@hailongSun2000 hailongSun2000 merged commit d9e35fa into llvm:main Apr 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants