- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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 of all, should the input in the SINCOS module be in radians (0 - 2*pi) or in degrees (0 - 360)? And the second question is how does the output latency work? In time t=0 it takes the input and does calculations for the cycles required while neglecting input until it finishes, and then it takes the next input at cycle (t=0 + latency) again, or does it work in a queue taking all inputs sequentially? Thanks a lot in advance!Link Copied

5 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Altera forgot to mention the angle unit in the users guide, I presume it's radian as with altfp_atan.

Pipelined IP can process new input values every clock cycle.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Do 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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Thanks a lot for your answers!

Basically I just wanted to create a reference for PWM creation, but I used a slow custom updown counter. Now I am having problems with Timing requirements. I have my external crystal clock for DE0 Nano and inside the chip I have two PLLs (450MHz and 75MHz), some state machines and some other custom code. The code simulate4s perfectly but doesnt run correctly. I removed all warnings and now I try to see where the problem is. I changed the first PLL to 150MHz (that PLL is used for the PWM creation) and now it works. I constantly have a timing requirements not met and I was wondering what is the easiest way to tell the compiler to fit my design for 450MHzTopic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page