FPGA Central

World's 1st FPGA Portal

 FPGA Groups > FPGA Sine function implementation in FPGA??

 FPGA comp.arch.fpga newsgroup (usenet)

10-06-2004, 12:30 AM
 SD Guest Posts: n/a
Sine function implementation in FPGA??

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
10-06-2004, 01:03 AM
 Symon Guest Posts: n/a
Re: Sine function implementation in FPGA??

Dear SD,
Put this in the search box :-
sine generation group:comp.arch.fpga
Isn't the internet great?
Cheers, Syms.
"SD" <[email protected]> wrote in message
news:[email protected] om...
> 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

10-06-2004, 01:14 AM
 Ray Andraka Guest Posts: n/a
Re: Sine function implementation in FPGA??

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 obtaining the sine. For lower angular
resolution, a look up table works fine if you have the on-chip memory
available. There are also several approximations (one that I've used is
a two step linear approximation with a correction that uses two fairly
small look-ups). You can also compute the sign algorithmically using a
CORDIC rotation at the expense of more latency. If your design needs to
multiply some signal by a sine, say a mixer and local oscillator, then
CORDIC might be advantageous as it can accomplish both the sine and the
multiply in one operation. I have papers on my website on CORDIC and a
Xilinx XCELL article I wrote on using CORDIC as a mixer in a digital
radio app. For behavioral VHDL, you can use the sine and cosine
functions in ieee.math_real...those are computed using CORDIC in that
package, by the way.

SD wrote:

> 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

--
--Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
401/884-7930 Fax 401/884-7950
email [email protected]
http://www.andraka.com

"They that give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety."
-Benjamin Franklin, 1759

10-06-2004, 04:01 AM
 Kevin Neilson Guest Posts: n/a
Re: Sine function implementation in FPGA??

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.

"SD" <[email protected]> wrote in message
news:[email protected] om...
> 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

10-06-2004, 04:26 AM
 john jakson Guest Posts: n/a
Re: Sine function implementation in FPGA??

[email protected] (SD) wrote in message news:<[email protected] com>...
> 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

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
10-06-2004, 07:53 AM
 glen herrmannsfeldt Guest Posts: n/a
Re: Sine function implementation in FPGA??

john jakson wrote:

> [email protected] (SD) wrote in message news:<[email protected] com>...

>>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.

> 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.

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

 Bookmarks

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post khoa nguyen FPGA 3 03-01-2004 10:47 AM Sebastian Lange FPGA 12 09-30-2003 05:57 AM

All times are GMT +1. The time now is 06:30 PM.