Consistency for math helpers (isPow2, log2Ceil, etc.)
- Dominant language
- Dart
- Stars
- 489
- Forks
- 88
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 10
Description
### 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` has `clog2`
- `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_
Contributor guide
Assessment
This issue has not been assessed yet.