Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

How can calculate the sine an cosine function by using FPGA?

Status
Not open for further replies.

nattawoot_s

Newbie level 5
Joined
Jan 16, 2003
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
99
how to calculate cosine

How can calculate the sine and consine function by using FPGA or VHDL code?
 

lollobrigido

Full Member level 2
Joined
Dec 13, 2002
Messages
133
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Location
Italy
Activity points
1,001
calculate sine

try to search in google or similar, about "CORDIC" algorithms

Good luck
Lollo
 

redsk_y

Member level 4
Joined
Jan 1, 2002
Messages
79
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
italy
Activity points
427
cos calculation vhdl

You can use a look-up table or a CORDIC algorithm.

Try a search also in this forum.

If you use @ltera they have an evaluation macro that implements
CORDIC in serial or parallel way.

Bye
 

Gunship

Member level 2
Joined
Dec 31, 2001
Messages
51
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Activity points
520
sine calculation vhdl

nattawoot_s said:
How can calculate the sine and consine function by using FPGA or VHDL code?
If you are using Xilinx, you can use the coregen to produce a sine cosine lookup table. I am not sure how Altera will work but I will assume they have something like that also.

Gunship
 

Mazi3

Advanced Member level 4
Joined
May 29, 2002
Messages
101
Helped
5
Reputation
10
Reaction score
3
Trophy points
1,298
Location
Europe
Activity points
960
vhdl code to calculate sine using cordic

for small table of sines/cosines you can use look-up table, for values more precise you can use CORDIC.

CORDIC is very simple in fact, if you take any complex number, let it be overal length of 1, then if you multiply with another complex number with length 1 then you in fact just rotates the first one.

for example take Z*e^ia where a is angle (let it be 0) and i is SQRT(-1);imaginary unit and Z is nonzero constant. this is complex number laying on real axe (cos a + i sin a)-Euler's rule.
then if you multiply it with e^ib, where b is also angle (nonzero for example), you get
Z*e^î(a+b). as you see you have rotated vector Z around center for angle b. :idea:
with this in mind you can make sin/cos generator (but you need very small look table - very eficient method is by principle of succesive aproximation). the resut is precise as you want it :)
Use pipeline multiplier, becouse you need four multipliers (if' it's pipelined, you can multiplex imput data and then demultiplex result)
 

nattawoot_s

Newbie level 5
Joined
Jan 16, 2003
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
99
calculate sinus

I'm used altera Flex10k FPGA.
 

steshenko

Member level 3
Joined
May 31, 2002
Messages
62
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
392
how to calculate cos

There are special IP Core In Xilinx Core Generator. Imho, best way - look-up table - calculation provide many cells and slowly.
 

bunalmis

Full Member level 5
Joined
Jan 3, 2003
Messages
268
Helped
19
Reputation
38
Reaction score
11
Trophy points
1,298
Location
Ireland
Activity points
2,147
calculation of sines

Do you want to calculate sinus of any angle. (0, pi/2, pi, pi/4 .. random)
or do you want to calculate sinus of periodic incremental angle.(0,0.01,0.02,0.03.....) Which one ?
 

gnomix

Member level 4
Joined
Jun 14, 2001
Messages
75
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
italy
Activity points
649
cosine series vhdl code

nattawoot_s said:
How can calculate the sine and consine function by using FPGA or VHDL code?

For synopsys users:
If you have the DesignWare Foundation Library (dw_2) licensed, you can use the DW02_sincos model.

see attached file.
 

snakebites

Junior Member level 2
Joined
Aug 14, 2002
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
CHINA
Activity points
99
sine lookup table fpga

Xilinx has IPcore named CORDIC. It will can be configured as sin, cos, arc tan, square root function.
 

lcking

Member level 1
Joined
Sep 12, 2002
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
210
how to calculate sine

DDS through LUT or CORDIC algorithm
 

ddt694

Full Member level 3
Joined
Dec 12, 2002
Messages
170
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,296
Activity points
1,407
how to calculate sinus

LUT may be the most popular way for FPGA
 

lcking

Member level 1
Joined
Sep 12, 2002
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
210
tan lookup table fpga

CORDIC algorithm is easy to implement with FPGA
 

Hello

Newbie level 2
Joined
Mar 2, 2003
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
16
vhdl+sine

if I use xilinx FPGA, what is the max speed that can be achieved...and how much resource will it take...
 

Hello

Newbie level 2
Joined
Mar 2, 2003
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
16
sine cosine fpga

if I use xilinx FPGA, and use cordic algorithm, what is the max speed that can be achieved...and how much resource will it take...
 

Aircraft Maniac

Member level 5
Joined
May 18, 2002
Messages
80
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
656
using lookup tables sine cosine in vhdl

For the cordic core at opencores the following data is available:

Vendor Family Device Resource usage Max. Clock speed
Altera ACEX EP1K50-1 2190lcells 68MHz
Xilinx Spartan-II XC2S100-6 704slices 93MHz


Aircraft Maniac
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,348
Reputation
4,690
Reaction score
2,273
Trophy points
1,413
Location
Southwest, USA
Activity points
62,484
Re: How can calculate the sine an cosine function by using F

If you want to "Roll Your Own" here an interesting PDF on CORDIC Algorithms for FPGAs.

It's always good to know the reason why!
 

rohi

Newbie level 4
Joined
Mar 22, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
INDIA
Activity points
1,313
Re: How can calculate the sine an cosine function by using F

i want to implement a function which will convert cartesian to polar co-orinates using IPcoder CORDIC in VHDL using Xlinx.


help me
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top