Re: fixed point math algorithms



sanborne wrote:
I have another question related to fixed point.

I wrote a function in MATLAB that will take an arbitrary yet well
behaved function and generate an if-then-elseif tree that can
approximate that function over a given interval. For example, the
following is the output of my function to approximate the natural
logarithm over an interval of 1e-4 to 1 (I apologize if you are
unfamiliar with MATLAB, as this is a VHDL forum, but the functionality
of this code should be relatively clear):

Stuff deleted....

Yipe.

I think converting this code to VHDL should be relatively straight
forward, although I do not know very well how to deal with fixed
point. How, for example would I convert the constant coefficients
above into fixed point hardware?

Yes. You can compare a fixed point number of any width to a number of any other width. I would just say:
if x < to_sfixed (0.0263665, x'high, x'low);

Without knowing your "fi" function, I couldn't say more.

But my real question is whether this is the right approach. I am
afraid the hardware implementation of the equivalent VHDL would use a
TON of multipliers, and might have other problems too. How would
someone implement a non-linear, yet common function in hardware? Note
that taylor series is definitely not the answer. After a fairly in-
depth study the above solution is the best I could come up with. Are
there any other suggestions? Is there something better than my binary
if-tree approach?

Thanks a ton for any responses.

The wonderful thing about fixed point math is that a Taylor series will give you a good result in a finite number of iterations. As to multipliers, they work the same fixed point or signed. Like I said, it depends on what "fi" does.
.



Relevant Pages

  • Re: Matlab Sound Output/Input Time Delay Measurement
    ... To the extent that Matlab can do multiple I/O's in practice, ... Matlab can also handle multiple I/O interactions by having the system hardware buffer ... don't get to time-stamp the individual samples. ... interrupt latency; ensure that key sequences are all read into instruction ...
    (comp.soft-sys.matlab)
  • Re: About alternatives to Matlab
    ... if not all data acquisition hardware ... Usually you have to mess equally much with Matlab, ... When it comes to data acquisition, LabView is far superior ... Then do the decision of which language to use - including Python, ...
    (comp.lang.python)
  • Re: exactly what I was talking about...
    ... you need to work with the hardware you're given. ... A function in MATLAB that uses an array of say 4 or 5 mbit ... only *you* know what your MATLAB algorithm is about. ... write code for these blocks explicitly in the DSP. ...
    (comp.dsp)
  • external DMA and scoping issues
    ... I am trying to write a matlab library to call functions from ... The hardware supports DMA transactions that can ... different thread that handled the cancelation from a user. ...
    (comp.soft-sys.matlab)
  • sine of a matrix using taylor series expension in matlab
    ... matrix using taylor series in matlab. ... I know i can find the sine of a ... taylor series expension of Sin...what will be the matlab command ...
    (sci.math.num-analysis)