rohd icon indicating copy to clipboard operation
rohd copied to clipboard

Consistency for math helpers (isPow2, log2Ceil, etc.)

Open mkorbel1 opened this issue 5 months ago • 0 comments

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

mkorbel1 avatar Sep 17 '24 17:09 mkorbel1