Hi, I am trying to implement a DSP algorithm in a FPGA. My algorithm has sine and cosine functions in it. Can somebody help me in implementing sine and cosine functions in MATLAB fixed point (using fixed point toolbox) or VHDL. Thanks, SD
Sine function implementation in FPGA??
Oct 05, 2004
5 Replies
How many bits precision do you need? How many angles, or what is the angular resolution you need? How about the angular range if less than
+/-pi? There are several ways of obta> Hi,--
--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.
401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link
"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759
If a BRAM lookup isn't precise enough, a method I've seen used is a 5- or
6-term Maclaurin series using the Horner method. You need embedded multipliers for this though. You can use one multiplier, or one for each term for a fully parallel implementation. It all depends how fast you want to do it. The CORDIC probably uses a lot less hardware. If you have extra embedded multipliers, though, you can be lazy.
In the past I used sin(x) == sin(x[msb]+x[lsb]) and the expansion gives me 3 or 4 multiplies and small table lookups with a final PLA to correct a few odd cases. The table lookups for a course sin,cos (x[msb]) can be very small.
Also visit Ray Andraka's site, I'm sure there's something there on sin/cos with some interesting cordic functions.
You could also stuff a blockram with a pretty good size table too.
regards
johnjakson_usa_com
I have a National data book from the days when ROMs needed +12 volts with a SIN lookup rom set. There is the course ROM, and then more ROMs and an adder. I believe the fine ROMs are linear interpolation, such that only an adder is needed.
As for the original problem, it would be easier to say with more description of what the real problem is. The best solution might depend on details not yet given.
-- glen
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required