CONNECT WITH MWRF
  • Facebook
  • Facebook
Subscribe

  
Reprints   Printer-Friendly    Email this Article    RSS        Font Size     What's This?


[Computer-Aided Engineering]
Design Finite Impulse Response Digital Filters
This four-part article series draws to a close with a practical example of designing a multipart FIR filter to meet the spectral-mask requirements of GSM cellular systems.

Ricardo A. Losada  |  ED Online ID #7965 |  April 2004
RECOMMENDED READING:
  •  Design Finite Impulse Response Digital Filters
  •  Design Finite Impulse Response Digital Filters
  •  Design Finite Impulse Response Digital Filters


Wisely employing digital capabilities can result in optimum filter designs with a minimum number of bits. As was seen last month, in some cases, even having an excess amount of processing power may not result in additional filter precision. The final installment of this four-part article series will examine the use of fixed-point filtering and provide a practical example of DSP-based FIR filtering to meet the spectral mask requirements of a Global System for Mobile Communications (GSM) cellular system.

Quantizing the coefficients correctly is not the only thing to keep in mind when implementing an FIR filter with fixed-point arithmetic. Suppose it is necessary to implement this filter using the direct-form structure. Figure 42 shows the structure as a reference for five coefficients. For the example at hand, we have 16-b coefficients, and suppose we need to filter 16-b data that is well scaled in the [−1, 1] range. We can generate random data with that characteristic as follows:

q = quantizer([16, 15], 'RoundMode', 'round');
xq = randquant (1, 1000, 1);

[In order to reproduce the results, the seed of the random number generator can be reset prior to generating the random vector, rand('seed', 0).] The [16, 18] format is used for the coefficients for illustration purposes. Since the input is already quantized, an input quantizer or a multiplicand quantizer is not needed:

Hq = qfilt('fir', {b}, ...
'CoefficientFormat', [16,18]);
set(Hq, 'InputFormat', 'none')
set(Hq, 'MultiplicandFormat', 'none');

For reference, the other parameters are set to default values:

OutputFormat = [16 15]
ProductFormat = [32 30]
SumFormat = [32 30]

but will be temporarily set to 'none' in order to have a reference for comparison:

set(Hq, 'OutputFormat', 'none');
set(Hq, 'ProductFormat', 'none');
set(Hq, 'SumFormat', 'none');
yi = filter(Hq, xq);

Quantity yi represents an "ideal" output or the best output one can hope to compute. Aside from using the 16-b quantized coefficients, all computations are performed with double-precision arithmetic. Quantity yi provides a nice reference signal for comparison purposes.

If the parameters are set back to their default values, it becomes apparent that the product format is not accurate for this case. The multiplication of [16, 18] coefficients with a [16, 15] input sample results in a [32, 33] product. On a DSP processor, two 16-b registers are being multiplied and the result stored in a 32-b product register. The correct setting for the ProductFormat is [32, 33]:

set(Hq, 'OutputFormat', quantizer([16, 15]));
set(Hq, 'ProductFormat', quantizer([32, 33]));
set(Hq, 'SumFormat', quantizer([32, 30]));
yq = filter(Hq, xq);

The qreport(Hq) reporting function is an extremely useful tool to monitor what has happened here. In this case, it reports that no overflows have occurred (see table). To measure how good the output is, the energy of the error and the maximum error are compared:

norm(yi − yq, 2)
ans = 0.00054794884123692
norm(yi − yq, inf)
ans = 3.05137364193797e−005

Figure 42 shows that there is a source of error when moving the data from the set of adders (what would be the accumulator in a DSP processor) to the output. The word length is being reduced from 32 b to 16 b. The theoretical power spectrum of the quantization noise at the output of the filter corresponding to the model in Fig. 43 is

where Hn(ejω) is the transfer function from the noise source to the output (in this case, simply 1) and ωx2 is the power spectrum of the noise source (in this case, a constant and equal to the variance of the noise):

where :

b = the number of bits.

(This formula is approximate because the signal at the accumulator does not cover the entire range [− 1, 1] and because an analog signal is not being quantized. Rather, the number of bits in an already quantized signal is being reduced.) In this case, the theoretical power spectrum is constant and for 16 b is

Sy(_) = 10log10 22(−15)/12 = 101.100811159671 dB

An estimate of the noise power spectrum can be computed with the "nlm" function:

[H, w, Pnn] = nlm(Hq, 512, 100);

Figure 44 shows a plot of the "Pnn" function (in dB) compared to the theoretical power spectrum.

If the quantization noise in Fig. 43 is the only noise in the system, it should be possible to obtain an output that exactly matches yi by setting the output format to be the same as the sum format (one can think of it as the ability to "look inside the accumulator"):

set(Hq, 'OutputFormat', quantizer([32,30]));
yq = filter(Hq, xq);
norm(yi − yq, 2)
ans = 2.02838467848398e−006
norm(yi − yq, inf)
ans = 7.98609107732773e−008

While the error has clearly been reduced, there is still some left, indicating some roundoff still present in the system. This is confirmed by looking at the power spectrum for the noise using the "nlm" function. Figure 45 shows the plot of the power spectrum. The noise is obviously less than before (about −168 dB), which is consistent with the smaller errors computed here. To find the source of the error, it is simply a matter of looking at the discrepancy between the product format and the sum format.


<-- prev. page     [1] 2 3     next page -->







Reprints   Printer-Friendly    Email this Article    RSS        Font Size     What's This?