Multi-channel Farrow Filter Design Example

This example demonstrates how to use the Altera® DSP Builder Advanced Blockset (DSPB-AB) to implement a multi-channel sample rate conversion filter based on a Farrow structure.

Sample rate conversion has a wide range of applications such as wireless communications, medical imaging, and military applications. Instead of implementing polyphase decomposition, the Farrow resampling filter uses low-order polynomials to realize the same functionality, thus results in significant logic savings. It is particularly efficient for processing multiple channels or multiple parallel data paths, where all channels or data paths require the same set of filter coefficients.

In this example, we build a Farrow sample rate conversion filter using DSPB-AB primitive blocks. In particular, we demonstrate how to take advantage of the folding feature of the DSPB-AB. The folding feature of the DSPB-AB automatically realizes resource sharing and hardware re-use based on user-specified system parameters.

The functional block diagram of a Farrow filter is shown in Figure 1. All modules are designed using primitive blocks in DSPB-AB.

Figure 1. Farrow Filter Block Diagram

Figure 1. Farrow Filter Block Diagram

The symbol r is used to quantify the sampling phase difference between the current input and desired output sample. The value is normalized between 0 and 1. For each output sample, you can calculate r using the following formula:

r = (Output_time – Input_time)* Input_Sampling_Frequency

In this demo, we used a recursive algorithm to calculate r for each output sample:

formula

where n is an integer indicating the number of samples or discrete time stamp. C1 is defined as the fractional part of the inverse of rate change factorformula and formula.

Features

This demonstration has the following features:

  • Supports both decimation and interpolation.
  • Supports almost any rational sample rate change factor
  • Supports up to 16 channels, although you can easily modify the design to support more channels
  • Supports parameterization via a setup script
  • Supports easy modification of the resampling filter (polynomial) order by extending the length of the tap delay lines
  • Provides initialization and post-simulation scripts to configure parameters and compare and check outputs
  • Supports automatic folding, allowing time-division multiplexing on multipliers, adders, and other hardware resources

Note 1: For version 9.1, the design requires that the FPGA clock rate is an integer multiple of both the input sample rate and output sample rate. In future releases, the output sample rate does not have to divide the FPGA clock rate. Therefore, it can theoretically support irrational downsampling rate changes as well. There is no structural changes for the different sample rate it supports.

Note 2: All channels should be processed by one data path (i.e., a single wire in the DSPB-AB design). If you have a large number of channels, you should increase your FPGA clock rate such that you don’t have to split the data channels onto multiple parallel data paths. To support multiple wires or multiple data paths, you need to modify the data alignment block, which is not covered in this example.

For more information on designing resampling filters in DSPB-AB, please refer to AN 623: Using the DSP Builder Advanced Blockset to Implement Resampling Filters (PDF).

Download the files used in this example:

Files in the .zip download include:

  • farrowm.mdl—DSPB-AB design file for the multiple-channel Farrow sample rate change filter
  • setup_farrowm.m—MATLAB script to configure initialization and parameters of farrow.mdl
  • stop_farrowm.m—MATLAB script to plot the Farrow resampling filter output and compare it with the input waveform

For more information on related features used in this design example, go to:

Related Links

 

 

Design Examples Disclaimer

These design examples may only be used within Altera Corporation devices and remain the property of Altera. They are being provided on an “as-is” basis and as an accommodation; therefore, all warranties, representations, or guarantees of any kind (whether express, implied, or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.