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

feature request: strength reduction for division or remainder when the denominator is a constant power of two #2411

Open
ekiwi opened this issue Nov 10, 2021 · 0 comments

Comments

@ekiwi
Copy link
Contributor

ekiwi commented Nov 10, 2021

Feature Description

If there is a division or a remainder operation where the denominator is a constant power of two, the firrtl compiler should replace the div/rem operation with appropriate bit slicing or a static shift. Personally I would prefer to just use bit slicing since that is imho a better canonical form.

This would allow users to write:

val r = in / 4.U

instead of:

val r = in >> 2.U

and get (almost) identical Verilog.

This is important because a division in Verilog might be a red flag. But also, personally, I would prefer if the SMT/btor2 backend only emitted div/rem is it absolutely needs to.

Type of Feature

  • better optimization
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