Filter Evolution

Started by John Larkin January 17, 2015

We're working on the FPGA signal processing for The Wayback Machine.
This is a box that stores user-supplied waveform files and plays them
back at some programmable rate.

If we use a DDS clock to determine the playback sample rate, and dump
the file data into a DAC, we get the obvious stairsteps in the data,
at the sample rate SR. A sine wave at frequency Fs, which was sampled
at, say, SR=64Fs, will look pretty stair-steppy on a scope, but not
too bad. But a sinewave sampled at something like SR=3Fs will look
awful, a jumble not recognizable as a sine wave at all. Spice has a
sample/hold, so you could play with this if you're interested.

Mr Shannon said that a lowpass filter will fix this.

My first inclination was to take the last two data values and linear
interpolate at some higher rate than F. It can be done like this:

This removes the steps and looks pretty good at high ratios of SR/Fs.
But it can't output a value that's bigger than either of the inputs,
so we get this problem as the signal frequency approaches Nyquist:

We need a bigger red peak than the interpolator can make. The result
is squirmy waveforms and residual AM.

The classic analog transversal filter is...

which is simple if you think about it right: the delayed signal is
multiplied by a list tap gains that literally draw the desired filter
impulse response.

The digital version is the classic Finite Impulse Response filter

where the Z-1 blocks are just delays, namely a clocked data latch.
This can approximate any filter response (as long as a decent ratio
SR/Fs is maintained) but the output rate equals the input rate, so it
won't help my stairstep situation much, without squashing the system

So we sort of combined the interpolator with the FIR filter:

This is a digital FIR filter, but we change the tap gains Kn much
faster than the data sample rate... probably at 64 MHz. This upsamples
the data rate and smooths things out, an interpolator on steroids.

This turns out to be a known trick for DSP filtering.

The cool thing is that if we use K0 and K1 and set the rest of the Ks
to 0, I get my linear interpolation, at a much higher rate than the
customer's SR. K0=1 alone is "filtering off". If we use just the first
four Ks, I can approximate a cubic spline curve fit onto four samples,
which gives me the red curve slingshot effect that I need.

Adding more K terms makes the filter better, nicer waveforms and less
AM as we approach Nyquist, at the cost of more time delay.

15 taps looks pretty good, letting us get nice sine waves at around
0.7 of Nyquist, which is around SR/Fs of 3:1.

The math is an FPGA MAC (multiply/accumulate) operation. The Kn
coefficients will be stored in a block RAM lookup table. To keep the
table size down, we can break up the M bits into two chunks and do
some linear interpolation.


John Larkin         Highland Technology, Inc
picosecond timing   laser drivers and controllers

jlarkin att highlandtechnology dott com