By Adam Taylor
Happy New Year! Having demonstrated how we can achieve a significant performance boost using SDSoC to define and implement our low-pass filter, I thought it would be good to explain briefly how you can create the other types of filters using SDSoC before moving to the next subject. Based on the work from our initial low-pass filter, we can also implement:
- High-Pass Filters
- Band-Pass Filters
- Band-Stop Filters
Once I have explained the basics of the above three filters, you should be able to create any filter you desire and implement it within SDSoC.
Perhaps the easiest to explain initially is the high-pass filter. We can then combine high-pass and low-pass filters to generate both band-pass and band-stop filters. The difference is only in how we combine them.
To design our high-pass filter, we must first start with a low-pass filter and then perform either a spectral inversion or a spectral reversal. Each approach has a different effect in the frequency domain. As engineers, we must be certain to pick the correct filter type for our application.
Original low pass filter
Performing a spectral inversion is the simplest approach. We simply invert each filter coefficient value and then add one to the center value. Performing this action converts the low pass filter’s pass band into a stop band and the low pass filter’s stop band into a pass band. Using a 33-tap low-pass filter with a cut off of 0.208 fs as shown above. We can perform a spectral inversion and get the following results (I used Octave for all these examples):
In the frequency response above you can clearly see the attenuation of the filter decreasing as the frequency increases (the pass band should begin around 0.208 fs). Just as with the low pass-filter, including more coefficients creates a sharper transition band from stop to pass band.
However we may not want to just switch around the pass and stop bands. We may desire to mirror the frequency response, which is where we use spectral reversal. To perform a spectral reversal, we invert every other coefficient. This has the effect of shifting the response by 0.5 fs as can be seen below in the frequency response for the original low-pass filter once subjected to spectral reversal.
Please note the X axis represents radians per sample. As such, FS = 2π and 0.5 FS (Nyquist) = 1π on all of the diagrams above.
We can combine the low- and high-pass filters in series to produce band-pass filters. Alternately we can convolve the low-pass and high-pass constants together to provide a simpler implementation using only the one filter kernel. We can create a similar band-reject filter by running high- and low-pass filters in parallel and summing the outputs of the two filters together.
Of course, now that we know how to use SDSoC to implement signal-processing filters, there is no stopping our abilities. I have (all be it briefly) discussed how we can create a whole range of other filters that will be of use in the real world. You can find out more on custom filter design in Xilinx Xcell Journal Issue 78.
If we have a number of different frequencies we wish to separate using band-pass filters, then we need to look at more complex filter banks, which are generally based on FFT’s.
Having discussed SDSoC’s use for filtering, I am going to leave this topic for a little while we look at the embedded vision kit and image-processing for the Zynq SoC. Of course, this application requires a number of different filtering techniques, which we’ll be exploring in future blog posts.
If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.
You also can find links to all the previous MicroZed Chronicles blogs on my own Web site, here.