rohd
rohd copied to clipboard
Consistency for math helpers (isPow2, log2Ceil, etc.)
Motivation
There are multiple places across ROHD and ROHD-HCL where public and private implementations of some common math operations are included.
For example:
-
LogicValue
hasclog2
-
FiniteStateMachine
has a private_logBase
function - ROHD-HCL's "ecc.dart" has
_isPowerOfTwo
- ROHD-HCL's
log2Ceil
Perhaps there are more!
Chisel, for reference, has these built-in math helpers: https://users.cs.duke.edu/~lkw34/Chisel-Cheatsheet.pdf
-
log2Ceil
-
log2Floor
-
isPow2
Desired solution
Determine a set of useful mathematical operations and implement them in a way that could be useful in as many ways as possible. Important to consider is that these should be applicable to int
, LogicValue
, and even maybe BigInt
. The APIs should all be located in one package, ideally (instead of spread between ROHD and ROHD-HCL). Old ones should be deprecated (or removed, if private).
Alternatives considered
No response
Additional details
No response