We're designing an 8-channel waveform playback box for a aerospace customer. They will load large waveform files into our box, and we'll play them, each at his programmed clock rate.
I call it the Wayback Machine, and included this figure in the proposal:
One issue is that he may want "gear ratio" frequencies. If we use a binary-radix DDS to clock the output DAC, the frequencies are goofy and it's hard for him to get exact integer ratios.
Another thing that we want to do is smooth his waveform steps. The playback clock rate can vary from low Hz up to 400 KHz, and it's clumsy to switch in various lowpass filters as a function of that rate.
Here's the binary-radix version:
We clock the FIFO every time the phase accumulator rolls over.
The high N bits of the phase accumulator (16 or 18 maybe, to match the FPGA multiplier width) are used to linear interpolate between samples, always at 2 MHz. The output lowpass filter can now be fixed at something like 500 KHz.
I declared that the customer frequencies all be quantized to 0.001 Hz exactly. That lets him specify frequency gear ratios without slow channel-channel phase creep from binary rounding. So we came up with this:
The trick is to scale up the N MSBs of the mod-2e9 phase accumulator to generate the X and 1-X interpolation factors. That's a multiply by
2^31/2e9, which is about 1.073 (not 1.05... sorry) which is easily done. The N MSBs essentially scan the range 0 to 0.9313 fractional, so we have to stretch them up to 0.9999.Higher-order interpolations are possible with three samples, approaching a spline curve or bessel filter, or something, but I think the linear interpolation will look great on a scope, as compared to raw stairsteps.
The decimal frequency quantization thing could be done in a binary DDS with a goofy clock frequency, but that has undesirable side effects here. Or a really wide DDS could express 1 mHz pretty closely, but not exactly, and we could always load Fset with a multiple of that. Again, we have system reasons to not do that.
It's fun to bat this sort of stuff around.