Re: fixed point math algorithms
- From: David Bishop <dbishop@xxxxxxxx>
- Date: Wed, 03 Dec 2008 22:37:32 -0500
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.
.
- Follow-Ups:
- Re: fixed point math algorithms
- From: sanborne
- Re: fixed point math algorithms
- References:
- fixed point math algorithms
- From: sanborne
- fixed point math algorithms
- Prev by Date: Re: fixed point in VHDL
- Next by Date: Re: fixed point math algorithms
- Previous by thread: fixed point math algorithms
- Next by thread: Re: fixed point math algorithms
- Index(es):
Relevant Pages
|