generating sine-like waveforms

Okay. Do you want pure sinewaves to better than 16-bit resolution using only 12-bit values? Uwe Bonnes points out that one lookup arrangement can work for multiple sinewave generations. You can use a coarse lookup for a first step and produce a pure-sine result using a little math. sine(a+b)=sin(a)cos(b)+sin(b)cos(a) and, for very small b, sin(a+b)=sin(a)+b*cos(a) which leaves you with the need to convert your "b" delta from a 2^n phase difference to radians. If I remember my investigations properly, you can get 18 bits pure sine accuracy with the single lookup with 2 multiplies even at extremely low audio frequencies.

To get past the psychoacoustic issues, you can generate your 12-bit values by taking your more-precise sine values and delta-sigma modulate the result providing very good audio.

You should be able to get this to run with a large number of independent sine generators. You can even run multiple DDS generators using a BlockRAM to store both the accumulator value and the phase increment value. For 36 bits, you can get 256 independent DDS generators running to produce independent phase values for your sine lookups.

You can do a huge amount of work in FPGAs when the needed frequencies are low. If you're only running at 30 MHz, you can do significantly more work by increasing the clock rate in your part. You should be able to run nearly

2k 18-bit accurate sinewaves through one sine-interpolated sinewave LUT structure. 300 clocks per sample, ~30 MHz external clock, ~180 MHz internal clock give ~1800 pipelined mechanisms.

Insults weren't intended. The frustrations in real engineering come from loosely defined specifications. If the true needs are communicated, engineers can deliver "precise" solutions that give the necessary psychoacoustic results.

Reply to
John_H
Loading thread data ...

snipped-for-privacy@gmail.com wrote:

Ahh, that is the missing part of the problem statement. You hadn't indicated before that you needed to make a bunch of these. Since it is audio, the sample frequencies are low compared to the possible clock speeds of modern FPGAs. Let's say you work at 44.1KHz, since that is a fairly standard audio sample rate. If you clock your FPGA at a very conservative 44.1 MHz, you can time multiplex 1000 generators using one set of hardware (and pipelined, current FPGAs can easily run at 5x that clock rate with some careful design). With that in mind, the cost of implementing a generator is not nearly the big deal it would be with a design that instanced 1000 copies.

There are numerous ways to generate a sine. IIR methods work OK if you are generating a sine at a specific frequency, but they are not very good for using over a bunch of frequencies or when it has to be programmable, or when it has to have many different frequencies time multiplexed from the same hardware. Instead, I'd focus on an NCO implementation using a DDS, modified DDS, Bresenham's or other algorithm to generate the linear phase, followed by one of several possible converters for conversion of the phase to a sinusoid. Others have mentioned look-ups, which you have rejected because of the size needed for adequate phase resolution at low frequencies. You can use multiple tables for a progressive improvement. The phase ramp itself with the two MSBs modified provides a first order (triangular) approximation to the sine. You can then use tables as corrections to the triangle approximation rather than the sine itself to reduce the width of the table data. You can also use linear interpolation between table entries to improve on the apparent resolution of the table. Alternatively, and this might be the best bet for your application, you can use CORDIC to obtain an arbitrarily high phase resolution and magnitude precision. Since you can multiplex 1000's of channels through one instance, the area associated with the CORDIC is not a significant problem (CORDIC compares favorably in area to a complex multiplier built in the fabric, but generally takes more area than one built using dedicated fast multipliers in the FPGA, especially if only the real output is needed).

You could also filter the triangle wave, but it is not going to give you good results over an extended frequency range, which you would need since the filter would be time-shared.

Reply to
Ray Andraka

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.