intel / rohd

The Rapid Open Hardware Development (ROHD) framework is a framework for describing and verifying hardware in the Dart programming language.
https://intel.github.io/rohd-website
BSD 3-Clause "New" or "Revised" License
370 stars 65 forks source link

Fixed point support #470

Open samimia-swks opened 6 months ago

samimia-swks commented 6 months ago

Motivation

Efficient DSP hardware is typically implemented in fixed point arithmetic: see https://en.wikipedia.org/wiki/Q_(number_format) https://ieeexplore.ieee.org/document/7199829

It is painful to write a fixed point data path in SV, as it offers no help in managing the Q point (the number of fractional bits). The designer has to undertake the error prone process of

Desired solution

Add support for signed and unsigned fixed point 'type's in ROHD, and overload operators such as +, - and * to shift as necessary and keep track of the Q point of the result

Alternatives considered

No response

Additional details

No response

mkorbel1 commented 6 months ago

Thank you for the feature suggestion! I'm wondering whether there's sufficient complexity that it needs to be integrated into ROHD itself or if it could be added to the library at https://github.com/intel/rohd-hcl.

samimia-swks commented 6 months ago

Hi Max. I am very unfamiliar with Dart and ROHD still, but in my mind a user friendly implementation would look something like this wish list:

There is more here but this covers most of the use cases for DSP applications.

mkorbel1 commented 6 months ago

Thanks for the context, very helpful! I think this sounds quite achievable.