Forum Discussion
Altera_Forum
Honored Contributor
13 years agoFloating point modules MegaWizard question
Hello people! I want to implement a small sinewave generator inside my Cyclone IV E using some of the floating point operations in the MegaWizard. I have two simple questions: First o...
Altera_Forum
Honored Contributor
13 years agoDo you want a sine wave, or to you want to experiment with the FP megawizard?
If you want a sine wave either use a Goertzel generator or a square wave and a low pass filter. The Goertzel generator might suffer from amplitude drift. If you only need specific frequencies and amplitudes you can verify that the values eventually repeat - indicating stable amplitude. Basically: sin(a+b) = 2sin(a)cos(b) - sin(a-b), so you can generate the next term of a sine wave from the previous 2 terms a constant (cos(b)) with a single multiply and a subtract.