1 Introduction

With the rapid development of digital signal processing theory and application technology, it is difficult to meet the requirements with only one sampling frequency in a digital system. In practical applications, the problem of sampling rate conversion is often encountered, that is, a digital system is required to work in a “multi-sampling rate” state. In recent years, “multi-sampling rate digital signal processing” based on sampling rate conversion has become one of the main research contents in the subject of digital signal processing. Intuitively, the digital signal collected at the sampling rate F1 is first converted into an analog signal, and then the analog-to-digital conversion is performed at the sampling rate F2, thereby realizing the sampling rate conversion from F1 to F2, which is The easiest way to convert sample rate. But this is more troublesome, and it is easy to damage the signal, so in the actual application of the variable sampling system, changing the sampling frequency does not pass through the analog signal, but is completely realized in the digital domain. In digital signal processing, filtering plays an extremely important role, and the digital filter suitable for variable sampling rate systems is the main content to be discussed in this article.

2. Design process and structure of FIR digital filter

Digital filters can be divided into two types according to the time domain characteristics of their impulse response functions: infinite impulse response (IIR) filters and finite impulse response (FIR) filters. FIR filter is widely used in various digital signal processing systems. Its system is always stable, which can meet the strict requirements of the filter for amplitude and phase characteristics, avoid problems such as temperature drift and noise of analog filters, and easily realize linear phase. And easy-to-use hardware implementation, these are the outstanding advantages of the FIR system, but also difficult to achieve in the IIR system. Although the IIR filter system is easier to obtain better passband and stopband attenuation characteristics than the FIR filter system, in order to obtain better attenuation characteristics of the FIR system, the system function H(z) order is generally required to be high, that is, the filter The device length M should be larger. Based on the above considerations, this paper chooses FIR filter to complete the design.

2.1 The basic principle and design basis of FIR digital filter

The system function of the FIR filter is:

The difference equation describing the relationship between the input x(n) and the output y(n) can be written directly from the system function. Let x(n) be a sequence of M points, then we get:

As far as hardware implementation is concerned, the basic structure of FIR digital filter is a segmented delay line, and the output of each segment is weighted and accumulated to obtain the output of the filter.

Figure 1 Basic structure of FIR filter

In Figure 1, x(n) is the input signal, x(ni) is the input signal delayed by i sampling periods, h(i) (i = 0, 1, …, n-1) is the ith delay The weighted value of the section (ie the filter coefficient), y(n) is the output signal of the filter at time t = nT.

The design of an FIR digital filter generally goes through three steps: target determination, approximation, and computer implementation. Usually before designing the filter, some technical indicators should be determined according to the specific application. The form of the index generally gives the magnitude and phase responses in the frequency domain. There are two main types of amplitude indicators, namely absolute indicators and relative indicators. After the technical indicators are determined, the model of the filter can be determined according to the mathematical knowledge and the basic principle of the filter to approximate the given indicator. The result of the last two steps is usually a filter described by a differential or coefficient function or impulse response. According to this description, it is implemented in hardware or software and its frequency and phase characteristics are analyzed. So far, the whole process of a filter design has been completed.

2.2 Using Matlab to realize FIR digital filter

Matlab is an interactive matrix-based software that is widely used in various fields such as teaching, research, and engineering design. With the development of Matlab software, especially the continuous improvement of Matlab’s signal processing toolbox, not only the computer-aided design of digital filters is possible, but also the design can be optimized.

In the field of digital signal processing, sampling frequency conversion is the process of converting the signal sampling frequency from a given frequency F1=1/T1 to another frequency F2=1/T2, which is a nonlinear process. When the new sampling frequency is higher than the original frequency, ie F2 > F1, it is called up-sampling rate or interpolation; on the contrary, when the new sampling frequency is lower than the original frequency, it is called down-sampling rate or decimation.

Suppose that a certain band-limited time waveform x(t) is sampled at the sampling rate fs (under the condition that the sampling theorem is satisfied), and the time sequence x(k) is obtained. Perform sampling rate transformation on x(k), such as upsampling rate, that is, increase the sampling rate by L (positive integer) times, and the upsampling sequence is represented by Y(m), then the relationship between the sequences before and after upsampling is:

This formula shows that L-1 zeros are inserted between every two adjacent points of the sampled data of the input signal. Upsampling rate conversion can be achieved. Because decimation is a dual system of interpolation, correspondingly, the relationship between the sequences before and after downsampling is:

This formula shows that the down-sampling rate conversion can be realized as long as one sample point is drawn every M sample points of the input signal.

The design of variable sampling rate FIR digital filter is divided into interpolation FIR filter design and decimation FIR filter design. The design of the interpolation and decimation filters is based on half-band filters. The following is a design example:

A half-band filter is a special kind of FIR filter with the following characteristics:

(1) The impulse response of the half-band filter is zero at the other even points except that the zero point is not zero;

(2) The filter template required by the half-band filter must be symmetrical about f/4. That is, H(ejπ/2)=0.5, and the number of parameters of the filter must be odd;

(3) The frequency response of the filter is symmetrical about the center, that is

Based on the advantages of the half-band filter, the equiripple approximation method is generally used to design the FIR filter on the basis of the half-band filter. The filter order is low and the maximum error is the smallest.

Design metrics for a given half-band filter:

The passband cutoff frequency is 20KHz, the sampling frequency is 88.2KHz, the passband ripple is 0.001, and the stopband attenuation is 70dB.

According to the above indicators, combined with its advantages, use the remez function in Matlab’s signal processing tool to design the FIR filter. The remez function uses the Parks-McClellan algorithm, which uses the remez exchange algorithm and the Chebyshev approximation theory to design filters, so that the amplitude-frequency response of the actual filter optimally fits the amplitude-frequency response of the ideal filter, so that there is a difference between them. The maximum error is minimized.

Call the remezord and remez functions to design this filter, which is known by the calling format [N, fo, ao, w] = remezord (f, m, rip, Fs), first determine the calling parameters of the remezord function according to the design indicators, and estimate the filter The lowest order N of the filter, its return function is used as the calling parameter of the remez function, and then directly write the program to call the remez function to obtain the filter unit impulse response h(n), and obtain the amplitude-frequency response as shown in Figure 2:

Figure 2 Amplitude-frequency response of variable sampling rate FTIR filter

By analyzing the amplitude-frequency response of the half-band filter, it can be found that both the passband and stopband ripples of the filter are within 0.0015dB, and the stopband attenuation reaches 70dB.

The program running results show that the filter order N=43, which basically meets the design requirements.

3. FPGA hardware implementation of FIR digital filter

The filter coefficient and order of the required FIR filter have been obtained by the previous Matlab design, and the hardware implementation of the filter is completed by using FPGA. The FIR filter is mainly composed of multiply-add units. If the FIR filter is directly constructed according to the intuitive structure, it will take up a lot of resources, which is obviously uneconomical. Now propose a TOP-DOWN structure diagram that utilizes FPGA hardware to realize filtering, as shown in Figure 3. It adopts a serial structure to realize that the hardware will directly multiply the input data with its corresponding filter coefficient, but it does not need to be multiplied by all the numbers before adding, as in the parallel structure, but the previous level product is latched, Directly multiply and accumulate with the latter level, which can greatly save hardware resources and improve execution speed. The FIR digital filter system is mainly divided into two modules: data storage and data operation. The main function of the data storage module is to control the chip select signal and address decoding with the clock, read the data corresponding to the ROM address in the ROM look-up table, which is the filter coefficient, and output it synchronously with the corresponding input signal to the data arithmetic module. The main function of the data operation module is to complete the multiplication and accumulation of the input signal and the corresponding filter coefficient.

Figure 3 FIR filter hardware implementation top-down structure diagram

4 Conclusion

Because FPGA has the characteristics of high speed, small area and reliable performance, it has become the first hardware implementation scheme for digital filters to work at very high frequencies. In this paper, Matlab is used to design a variable sampling rate FIR filter with a given index, and it is implemented in FPGA hardware.

The innovation of this paper: A hardware implementation scheme of FIR digital filter with variable sampling rate based on FPGA is proposed, which saves hardware resources, reduces design cost, and has practical value.

Responsible editor: gt

Leave a Reply

Your email address will not be published.