sine and cosine wave generation

C

comp.arch.fpga

Can anyone give guidelines on how to generate sine and cosine wave in
VHDL?

You can build a numerical oscillator:

Initialization:
sin[0] = 1;
cos[0] = 0;

Iteration:
sin[t] = sin[t-1]-cos[t-1]*k;
cos[t] = cos[t-1]+sin[t-1]*k;

The Frequency depends on k. If k is 1/2**k you do not even net a
multiplier.

This only works for a continues sequence of values. If you need values
in random
order you must use a lookup table or CORDIC. Both are available as
cores in ISE.

Kolja Sulimma
cronologic ohg
 
S

Symon

FPGA said:
Can anyone give guidelines on how to generate sine and cosine wave in
VHDL?

library IEEE;
use IEEE.MATH_REAL.all;
signal x,y : real;begin x <= sin(y);end;HTH., Syms.
 
A

Arlet Ottens

comp.arch.fpga said:
Can anyone give guidelines on how to generate sine and cosine wave in
VHDL?

You can build a numerical oscillator:

Initialization:
sin[0] = 1;
cos[0] = 0;

Iteration:
sin[t] = sin[t-1]-cos[t-1]*k;
cos[t] = cos[t-1]+sin[t-1]*k;

The Frequency depends on k. If k is 1/2**k you do not even net a
multiplier.

This only works for a continues sequence of values. If you need values
in random
order you must use a lookup table or CORDIC. Both are available as
cores in ISE.

Kolja Sulimma
cronologic ohg

If you slightly modify the iteration, like this:

sin[t] = sin[t-1] - cos[t-1] * k;
cos[t] = cos[t-1] + sin[t] * k;

then the solution doesn't suffer from accumulating rounding errors, at
the cost of some distortion.
 
F

FPGA

You can build a numerical oscillator:
Initialization:
sin[0] = 1;
cos[0] = 0;
Iteration:
sin[t] = sin[t-1]-cos[t-1]*k;
cos[t] = cos[t-1]+sin[t-1]*k;
The Frequency depends on k. If k is 1/2**k you do not even net a
multiplier.
This only works for a continues sequence of values. If you need values
in random
order you must use a lookup table or CORDIC. Both are available as
cores in ISE.
Kolja Sulimma
cronologic ohg

If you slightly modify the iteration, like this:

sin[t] = sin[t-1] - cos[t-1] * k;
cos[t] = cos[t-1] + sin[t] * k;

then the solution doesn't suffer from accumulating rounding errors, at
the cost of some distortion.- Hide quoted text -

- Show quoted text -

Thanks all for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top