francof2a / fxpmath

A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility.
MIT License
183 stars 21 forks source link

Convert fixed numbers point stored in text format to fxpmath fixed point format #69

Closed rafaelnp closed 2 years ago

rafaelnp commented 2 years ago

Hello,

I am using fxpmath 0.4.8 on Linux and I have the following use case:

  1. generate signal using numpy (e.g. sinewave with 1 or multiple fequencies)
  2. generate a processed signal ("golden signal") using numpy, based on the original signal sfrom setp 1
  3. convert this generated signal to fixed point using fxpmath
  4. save the boh signals signal as base 2 (binary) in a file as text
  5. use both files in a VHDL Testbench, performing the same processing as in step 2, and resulting signal saved as a text file, again using base 2(binary)
  6. open the VHDL DUT (Design Unfer Test) generated signal file and convert to fxpmath fixed point format
  7. compare visually, using e.g mathplotlib, the VHDL DUT processed signals and the fxpmath fixed point "golden signal"

I am having difficulties on the step 6, I could not find a way to convert it to fxpmath fixed point. Any help or suggestion is appreciated.

Thanks in advance.