Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant