MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015...

8
MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department of Electrical and Computer Engineering Instituto Superior T´ ecnico Av. Rovisco Pais, 1049-001 Lisboa, Portugal email: [email protected] Abstract—The implementation of a digital signal processing system is always with a finite number of bits and will be introduced errors due to quantization, since the quantized values are basically approximations of values with higher precision. The sources of these errors can be the analogue-to-digital converters and the arithmetic operations performed. If the system imple- mented has a very large number of arithmetic operations, as an adaptive system, these errors increase further more. Nevertheless, the quantization errors can be reduced if increased the resolution used in the conversion and in the arithmetic operations. However, in some cases this is not the best solution to use, mostly because it increases the price of the system and does not reduce significantly the error. Thus it is presented solutions to reduce the quantization error from the arithmetic operations of an adaptive filter without the need to increase the resolution. Index Terms—adaptive filter, LMS algorithm, fixed-point arith- metic, quantization error I. I NTRODUCTION N OWADAYS, digital filters are commonplace and an essential element of everyday life devices, such as mobile phones, radios, etc. In this way, digital signal processing systems are of great importance, and in some applications digital filters may provide better results than their counterpart analogue filters. The digital filter is designed to fulfil the required specifications either in the frequency domain or time domain of stationary input signals. Nonetheless, in most cases these input signals do not remain stationary, and it is necessary to consider an adaptive filter, whose coefficients are adjusted according to the variations of the signal and characteristics using an adaptive algorithm. Nevertheless, the design of adaptive filters are more complex than in digital filters with fixed coefficients. This processing need to be in real-time, and the system have to be fast to adapt to the changes of the input signals. Hence the implemented algorithm must be stable and have a minimum convergence time. The filter implementation and the chosen algorithm will determine the performance of the system, implied by the computation time and resolution. Whenever implementing a digital filter with fixed or variable coefficients it is always present quantization errors from either analogue-to-digital conversion or from the arithmetic opera- tions with finite numeric representation. Since the adaptive algorithm has more arithmetic operations than a digital filter with fixed coefficients, there will be more sources of quanti- zation error and will reduce more drastically the performance of the adaptive filter. The easiest solution to reduce the quantization errors is to increase the resolution in the converter or in the arithmetic operations, but this will also imply in a more expensive system. Thus, the objective of this work is to study and envisage efficient implementations for systems with adaptive filters in order to reduce the effects of finite precision arithmetic. The concept of efficient implementation imply a fast and flexible implementation in low resolution with fixed-point representation. This article is divided into six parts, where initially is described the basic notions of digital filters and the effects of finite word-length arithmetic. Then this analysis is transferred to adaptive filters, with a section exclusively for the LMS algorithm and other to the effects of finite precision arithmetic in adaptive filters. After, it is proposed solutions to reduce the quantization error, which are tested and whose results are presented in the sixth section. In the last section is presented some considerations of the implementation of adaptive systems in integrated circuits. II. DIGITAL FILTERS Digital filters with fixed coefficients are divided into two classes: recursive and non-recursive. A recursive filter output, y(n), depends on past input and output samples, defined as: y(n)= N X k=0 a k x(n - k)+ M X k=1 b k y(n - k) , n =0, 1, ... , (1) where x(n - k) and y(n - k) represents both input and output delayed samples, respectively, and a k and b k the filter coefficients. To note that M N in order to the filter be causal. On other hand, a non-recursive filter output only depends on delayed input samples, as: y(n)= N X k=0 a k x(n - k) , n =0, 1, ... . (2) The impulse response of a non-recursive filter always has finite duration, therefore these filters are usually referred as finite impulse response (FIR) filters [1]. Most of recursive filters have an impulse response with infinite duration, and by this reason are usually referred as infinite impulse response (IIR) filters [1], although sometimes they may have a finite impulse response.

Transcript of MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015...

Page 1: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1

Efficient Implementationof Systems With Adaptive Filters

Marta FreireDepartment of Electrical and Computer Engineering

Instituto Superior TecnicoAv. Rovisco Pais, 1049-001 Lisboa, Portugal

email: [email protected]

Abstract—The implementation of a digital signal processingsystem is always with a finite number of bits and will beintroduced errors due to quantization, since the quantized valuesare basically approximations of values with higher precision. Thesources of these errors can be the analogue-to-digital convertersand the arithmetic operations performed. If the system imple-mented has a very large number of arithmetic operations, as anadaptive system, these errors increase further more. Nevertheless,the quantization errors can be reduced if increased the resolutionused in the conversion and in the arithmetic operations. However,in some cases this is not the best solution to use, mostly because itincreases the price of the system and does not reduce significantlythe error. Thus it is presented solutions to reduce the quantizationerror from the arithmetic operations of an adaptive filter withoutthe need to increase the resolution.

Index Terms—adaptive filter, LMS algorithm, fixed-point arith-metic, quantization error

I. INTRODUCTION

NOWADAYS, digital filters are commonplace and anessential element of everyday life devices, such as mobile

phones, radios, etc. In this way, digital signal processingsystems are of great importance, and in some applicationsdigital filters may provide better results than their counterpartanalogue filters. The digital filter is designed to fulfil therequired specifications either in the frequency domain ortime domain of stationary input signals. Nonetheless, in mostcases these input signals do not remain stationary, and it isnecessary to consider an adaptive filter, whose coefficientsare adjusted according to the variations of the signal andcharacteristics using an adaptive algorithm. Nevertheless, thedesign of adaptive filters are more complex than in digitalfilters with fixed coefficients. This processing need to be inreal-time, and the system have to be fast to adapt to thechanges of the input signals. Hence the implemented algorithmmust be stable and have a minimum convergence time. Thefilter implementation and the chosen algorithm will determinethe performance of the system, implied by the computationtime and resolution.

Whenever implementing a digital filter with fixed or variablecoefficients it is always present quantization errors from eitheranalogue-to-digital conversion or from the arithmetic opera-tions with finite numeric representation. Since the adaptivealgorithm has more arithmetic operations than a digital filterwith fixed coefficients, there will be more sources of quanti-zation error and will reduce more drastically the performance

of the adaptive filter. The easiest solution to reduce thequantization errors is to increase the resolution in the converteror in the arithmetic operations, but this will also imply in amore expensive system. Thus, the objective of this work isto study and envisage efficient implementations for systemswith adaptive filters in order to reduce the effects of finiteprecision arithmetic. The concept of efficient implementationimply a fast and flexible implementation in low resolution withfixed-point representation.

This article is divided into six parts, where initially isdescribed the basic notions of digital filters and the effects offinite word-length arithmetic. Then this analysis is transferredto adaptive filters, with a section exclusively for the LMSalgorithm and other to the effects of finite precision arithmeticin adaptive filters. After, it is proposed solutions to reducethe quantization error, which are tested and whose results arepresented in the sixth section. In the last section is presentedsome considerations of the implementation of adaptive systemsin integrated circuits.

II. DIGITAL FILTERS

Digital filters with fixed coefficients are divided into twoclasses: recursive and non-recursive. A recursive filter output,y(n), depends on past input and output samples, defined as:

y(n) =

N∑k=0

akx(n− k)+

M∑k=1

bky(n− k) , n = 0, 1, ... , (1)

where x(n − k) and y(n − k) represents both input andoutput delayed samples, respectively, and ak and bk the filtercoefficients. To note that M ≥ N in order to the filterbe causal. On other hand, a non-recursive filter output onlydepends on delayed input samples, as:

y(n) =

N∑k=0

akx(n− k) , n = 0, 1, ... . (2)

The impulse response of a non-recursive filter always has finiteduration, therefore these filters are usually referred as finiteimpulse response (FIR) filters [1]. Most of recursive filtershave an impulse response with infinite duration, and by thisreason are usually referred as infinite impulse response (IIR)filters [1], although sometimes they may have a finite impulseresponse.

Page 2: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

2 MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015

A digital filter to be stable must have all the poles insidethe unit circle in z domain (|z| = 1), and since the IIR filterhas a recurring structure with output feedback it may lead toinstability if the filter poles lie outside the unit circle, howeverthe FIR filter has N poles at the origin (z = 0) thus isalways stable. Thus, hereafter will be only considered FIRfilters, since in a following section will be discussed adaptivefilters wherein stability is a key aspect. To implement FIRfilters is most common to use the structure of direct form [1],however there is also possible to have a direct form transposedor cascade structure [1].

A. Digital Signal Processing System of a Digital Filter

To implement a digital filter in a digital signal processingsystem it is needed an analogue-to-digital converter (ADC)to convert the input analogue signals into the digital domain[2]. The following step it is performed all the computationsnecessary to the filtering process, and, when available, the filteroutput can be transmitted again to the analogue domain by andigital-to-analogue converter (DAC) [2].

In the digital domain all values are represented by a finitenumber of bits, which will always translate in approximationsof the real values, however a higher number of bits willoriginate less difference between the digital representationand the value [1]. Every computation, as in a digital filterimplementation, will not have infinite precision, thereforewill introduce noise or error through the digital system. Thefirst source of error is the converters from the analogue todigital domain, moreover, arithmetic operations can generatemore errors, which consequently can cause [1]: (1) changesin the filter frequency response because the coefficients arequantized; (2) noise in the filter output due to the quantizationin multiplications, and (3) accumulator overflow.

Any quantization, either from converters or arithmetic op-erations, introduces an error to the signal, and the process canbe seen as an addition of noise or error to the real numberor a number with higher precision, as illustrated in Figure 1,defined as:

Q [a] = a+ ε∆= a . (3)

This quantization noise affects the digital signal qualitywhen compared with the original analogue signal from asimilar analogue system. The signal-to-quantization-noise ratio(SQNR) provides information to analyse the effects of thequantization noise in the performance of the digital system.The signal-to-quantization-noise ratio is defined as [3]:

SQNR = 10 log

(PS

PQ

), (4)

(a)(b)

Fig. 1: Simplified models of a quantizer (adapted from [1]):(a) block diagram; (b) statistical additive model.

where PS is the power of the input signal and PQ the power ofthe quantization noise. If focusing only in the ADC conversion,and considered a ideal converter performing rounding whenmapping the input samples into the quantization levels, thepower of the quantization error is defined by [3] as:

PQ =∆2

12, (5)

where ∆ is the quantization step of the converter, defined forB bits as:

∆ = 2−B , (6)

which if replaced in (4), the SQNR becomes:

SQNR = 4.77 + 6.02B + 10 logPS [ dB] , (7)

for normalized input signals. With this definition it is easilyconcluded that for each one more bit in the converter resolutionadds approximately 6 dB to the signal-to-quantization-noiseratio.

B. Finite Number Representation

In the digital domain, data is usually represented with eitherfixed-point or floating-point representation. The differencesbetween these two representations rely on cost and precisionof the system. The fixed-point representation is cheaper thanthe floating-point, however this one have more precision,dynamic range and development time [2]. Hereafter it willonly be consider fixed-point representation due to the lowcost implementation, however its low precision will be debatedlater. A real number represented in two’s complement fixed-point with I and F bits for both integer and fractional part,respectively, is defined as:

x = bI−1...b1b0 . b−1b−2...b−F , (8)

where the most significant bit bI−1 corresponds to the signof the number and . represents the fixed binary point. Inmost digital filter implementations, coefficients and signals arescaled to the range [−1, 1[, and it can be used a fixed-pointfractional format with (B + 1) bits, QB-format, where B bitsare for the fractional part and the bit b0 is the sign bit.

Besides the converter quantization, while performing arith-metic operations the result may have to be quantized to theresolution of the hardware, using a round-off operation whichcan be either truncation or rounding, where rounding willtranslate in a lower quantization error [4].

C. Finite Precision Arithmetic

As already referred, besides the problem of quantization inthe ADC, every arithmetic operation in a digital system willproduce quantization errors. The second source of error whenimplementing a digital filter is the coefficient quantization. Thefilter is designed according to desired specifications with thecoefficients hk, as represented in (9), and then are quantizedto a finite number representation, hk. This imply that thecoefficients are now different, corresponding in a frequency

Page 3: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

FREIRE: EFFICIENT IMPLEMENTATION OF SYSTEMS WITH ADAPTIVE FILTERS 3

response different from the one designed, even before takenplace any computation of signals.

H(z) =

N∑k=0

hkz−k =

N∑k=0

(hk + εk)z−k (9)

The third source of quantization error is the product op-eration. When multiplying two numbers in fixed-point rep-resentation, the word-length of the result corresponds to thesum of the word-length of each operand, and it must bequantized again to the resolution of the hardware, introducinga quantization error [1]. For example, consider a multiplicationof two constants, a and b:

c = a× b , (10)

and since each operand is quantized and have a quantizationerror, the result of the multiplication is:

c = ab+ εc

= ab+ aεb + bεa + εaεb + εc ,(11)

leading to a total quantization error for the multiplication:

εM = aεb + bεa + εaεb + εc . (12)

This quantization error not only depends on number of bits andround-off operation used but it also depends on the value ofthe operands, meaning that small operands can lead to biggererrors than larger operands.

The forth source of quantization error is overflow thatcan occur during computations, however since in most casesthe values dealt in digital filter processing are small, it isconsidered that it never occurs overflow of the range of repre-sentation. All the quantization errors combined can jeopardizethe performance of the filter.

III. ADAPTIVE FILTERS

In signal processing applications digital filters are designedaccordingly to a desired output and the input signal character-istics do not change in time and the parameters of the filterremain unaltered during time. However if the characteristicsof the input signal change the digital filter cease to becomeeffective because its parameters do not correspond to theattributes of the input signal. In these cases it is necessaryto use a digital filter that readjusts its parameters at eachtime instant based on the input signal. These filters are calledadaptive filters, in which the digital filter produces an outcomerelative to an input signal and an adaptive algorithm adjust thecoefficients of the filter [5].

One of the most used adaptive algorithm is the Least MeanSquares (LMS) due to its computational simplicity, which isdefined for n = 0, 1, ... as [2]:

y(n) = WT (n)X(n) , (13)

e(n) = d(n)− y(n) , (14)

W (n+ 1) = W (n) + µX(n)e(n) , (15)

where W (n) represents the vector of coefficients of theadaptive filter, X(n) the vector of input samples, d(n) the

desired signal, y(n) the adaptive filter output, e(n) the errorsignal or system output and µ the step size of the adaptivealgorithm. In Figure 2 is presented a block diagram of an ex-ample of adaptive system. In the perspective of computationalcomplexity and according to (13)-(15), a generic adaptive filterof N th-order using the LMS algorithm need space memory for(N+1) coefficients, which are constantly updated, for (N+1)input samples, for the filter output sample y(n) and for theerror sample e(n), and compute (2N + 3) multiplications and(2N + 2) additions of two values.

The applications of adaptive filters can be divided into fourclasses: system identification, inverse system identification,prediction of signals and interference cancellation.

IV. FINITE PRECISION ARITHMETIC IN ADAPTIVE FILTERS

The quantization errors may originate from the ADC con-version, after acquiring the input samples of the system, for thecoefficient quantizations or from multiplications, consideringthat overflows in the accumulator never occurs since valuesare scaled. All these effects combined can jeopardize theperformance of a simple digital filter with fixed coefficients,mostly due to the filtering operation. However, if implementingan adaptive filter, besides the issues in the filtering operation,more quantization noise will be generated when updatingcoefficients, since is based in multiplications.

Analysing now the expressions of the LMS algorithm, in(13) is necessary to perform (N + 1) quantizations after eachmultiplication, and in turn it will be performed (N + 2)quantizations when updating the coefficients in (15). It is alsoimportant to remark that each coefficient is recalculated witherror and then it is used in the filtering process. Moreover, thecoefficients of the next iteration are adjusted according to theadaptive filter output. Therefore, these quantization errors willform a recursive nature through all the steps of the algorithm.Hence, in this type of filter the quantization errors are affectedby more factors, which can jeopardize deeply the performanceof the adaptive filter. In this manner, it is important to addressto this problem and try to find solutions to reduce it.

V. SOLUTIONS TO REDUCE QUANTIZATION NOISE

The simple way to reduce the quantization noise fromarithmetic operations is increasing resolution, however it willprobably imply in a more expensive hardware. Thus, it canbe used a different implementation to reduce the quantizationerrors such as: accumulation with extended resolution, usingscaled coefficients or a step size as a power-of-two.

Fig. 2: Block diagram of an system with an adaptive filterW (n), adjusted by the error signal e(n) (adapted from [2]).

Page 4: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

4 MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015

A. Accumulation with Extended ResolutionNowadays there is available some models of micropro-

cessors, such as micro-controllers (MCU) or digital signalprocessors (DSP), that have a built-in multiplier and accu-mulator with extended resolution, allowing to accumulate theresults of the multiplications with double precision, and onlyafter finished the accumulation quantize the result for thehardware resolution. Using this type of implementation willenable a reduction of the quantization error in one of themost used operations in signal processing, filtering. As referredbefore, after each multiplication is necessary to perform aquantization, and the quantized filter output, according to (13)is defined for n = 0, 1, ... as:

y(n) =

N−1∑k=0

Q [wk(n)x(n− k)] , (16)

where Q[ ] denotes the quantization operation, wk(n) andx(n−k) the quantized coefficient and quantized input sample,respectively. However if using hardware with accumulator withextended resolution, the quantized filter output is defined forn = 0, 1, ... as:

y(n) = Q

[N−1∑k=0

wk(n)x(n− k)

]. (17)

B. Power-of-two Step SizeOne of the sources of noise introduction in the LMS

algorithm, when implemented with fixed-point arithmetic, isits need for a double multiplication for the coefficients update.An intermediate result of the step size multiplication by theerror sample should be stored and then used for the subsequentmultiplication by each signal sample. One way to avoid this isto consider a step size whose value is a power-of-two, becausein that case there is no need for the first multiplication becauseit can be substituted by an accumulation with a proper left shiftof the result of the multiplication:

wk(n+ 1) = wk(n) + 2−b(e(n)x(n− k)) ,

k = 0, 1, ..., N , n = 0, 1, ... .(18)

Although this avoids a multiplication, which is a time con-suming operation, the most important is to avoid a multipli-cation quantization. Of course the efficiency of this form ofimplementation depends on the desired step size value and theimplementation resolution (8, 16 or 32 bits).

It can also be consider the representation based on twopower-of-two parcels when possible (meaning two shiftedaccumulations of the multiplication output). Depending onthe specific hardware available, this concept of power-of-two, or several power-of-two parcels constituting the quantizedstep size may take advantage of a processor particular ALUstructure. These solutions will then be hardware dependent butmay help to improve an adaptive system performance.

C. Scaled CoefficientsAs analysed before, besides the filtering process the update

of the coefficients is also a source of quantization errors. Op-posing to a digital filter with fixed coefficients, the quantization

noise relative to the coefficients of an adaptive filter not onlydepend on the round-off operation it is also influenced bythe arithmetic operations of the LMS algorithm. One of theproblems in updating the coefficients is that the step size isusually a small number and the result of the multiplicationsmay be truncated or rounded to zero after quantized. Thiswould imply in not updating the coefficients and contributingto the algorithm not converging or even became unstable. Inmost digital filters implementations it is used scaled signalsto prevent quantization errors, thus this technique can beapplied to the coefficients of the adaptive filters [6]. If dividingboth sides of (15) by the step size, it is then consideredscaled coefficients referred as w′k(n) = wk(n)/µ, with largeramplitude than the coefficients wk(n), for k = 0, 1, ..., N .However, these scaled coefficients do not correspond to thereal coefficients of the filter and consequently the filter outputwill not be the same as in (13), thus the step size must beincluded in the calculation of the filter output, becoming theLMS algorithm defined for n = 0, 1, ... as:

y′(n) =

N∑k=0

wk′(n)x(n− k) , (19)

y(n) = µ y′(n) , (20)

e(n) = d(n)− y(n) , (21)

w′k(n+ 1) = w′k(n) + x(n− k)e(n) ,

k = 0, 1, ..., N .(22)

Now, since the scaled coefficients are larger numbers than theoriginal coefficients, it produces smaller quantization error inthe LMS algorithm. If implementing this solution, the scaledcoefficients can no longer be represented in QB-format sincetheir amplitude is larger than 1, thus it is necessary to assurethat all fixed-point arithmetic operations are performed cor-rectly between different types of formats. Besides the benefitsof largely reducing the quantization error, this implementationalso saves one multiplication per coefficient when updating,saving then computation time.

VI. IMPROVED IMPLEMENTATION OF ADAPTIVE SYSTEMS

The cost of an implementation of an adaptive system isaffected by the type of processor chosen, which then implythe type of hardware available. In that way, the choice mustbe careful in order to not jeopardize the performance of theimplemented system. Aspects as resolution, which derive fromthe hardware of the processor, is an important point to take intoconsideration when choosing the processor, as seen before.The objective is to have an efficient system with an adaptivefilter, combining good performance and low cost. In digitalsignal processing a way to reduce the cost of the system is touse a processor with a minimum number of bits necessary.

Nevertheless, the number of bits chosen should not com-promise the performance of the algorithm, and with less bitsmore error will be introduced in the algorithm and it can leadto instability. Most adaptive systems are based in the LMSalgorithm and its structure imply a significant introductionof quantization errors, specially for low resolution. However,

Page 5: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

FREIRE: EFFICIENT IMPLEMENTATION OF SYSTEMS WITH ADAPTIVE FILTERS 5

these quantization errors can be reduced if using differentimplementations of the original LMS algorithm. Thus, itwas performed a study to inquire the effect of the solutionspresented in the previous section in the performance of twoadaptive systems: noise cancellation and system identification.The reason to choose these two applications is due to thefact that for the first case the error signal supposedly tendto a desired signal without any noise, which again in notpredictable but most definitely not zero (considering thenobjectively large values), and for the second case the errorsignal supposedly tend to zero if the adaptive filter is equal tothe unknown plant (considering then very small values).

Every simulation was performed in MATLAB environmentfor 8, 16 and 32 bits of resolution (fixed-point in QB-formatfor words of (B + 1) bits), since these are the most commonresolutions used in processors and for terms of comparison,despite for example in a FPGA it can be chosen any number ofbits as word-length. For each type of adaptive system it is usedas full precision result a simulation with 64 bits using floating-point, due to insignificant quantization errors, to compare withthe simulations in fixed-point. It is also used the denominationof implementation A, B, C and D, corresponding to the originalimplementation, with an extended resolution accumulator, withscaled coefficients and a combined implementation of bothproposed solutions, respectively.

A. Adaptive Noise CancellationOne of the applications of adaptive filters is noise can-

cellation, where it is possible to remove noise embedded ina signal. The system implemented for noise cancellation isillustrated by a block diagram in Figure 3. In most cases thereis only available the signal corrupted with noise, d(n) andthe noise signal, x(n). However, since this implementation isperformed in a computational environment for simulation, itwas created both signal and noise sources. Thus, the signald(n) is compressed by the signal m(n) and the noise signalx′(n), as:

d(n) = m(n) + x′(n), n = 0, 1, ... . (23)

The input signal of the adaptive filter, whose frequencyresponse is represented as W (z), is the noise signal x(n).The noise signal x′(n) is not the same as x(n), but they arecorrelated since they are both generated by the same source,having the following relation:

x′(n) = 0.85× x(n− 20) , n = 0, 1, ... , (24)

which translates to the noise signal x′(n) being attenuated anddelayed by 0.45 ms (20 samples) relatively to the noise signalx(n). The signal source generates a square wave at a samplingfrequency of FS = 44.1 kHz, defined as:

m(n) = 0.8 square(2π × (85/FS)× n) ,

n = 1, 2, ... .(25)

The noise signal x(n) is generated by the noise source asa sinusoidal wave where at at a time instant it changes itsfrequency, from 1676 Hz to 2875 Hz::

x(n) =

{0.2 sin(2π × (1676/FS)× n), 0 ≤ n ≤ α

0.2 sin(2π × (2875/FS)× n), n > α, (26)

Fig. 3: Block diagram of the noise cancellation system imple-mented.

where α = 212 = 4096 samples, in order to see the reaction ofthe LMS algorithm to a change in the noise signal. It is impor-tant to note that the characteristics of the noise signal changeonly after the LMS algorithm have converged. The order ofthe adaptive filter and the step size of the algorithm, µ, haveto be chosen appropriately with the application requirements,which will allow the convergence of the system, adapting tothe variations of the input signal. Therefore, according to thisspecific application of noise cancellation and input signals,was chosen a 31th-order FIR filter (N = 31) as the adaptivefilter, whose coefficients were initialized at zero, and a stepsize as µ = 0.01.

In Figure 4 is illustrated the results for each implementation,where each sub-plot from top to bottom correspond to 8,16 and 32 bits resolution. Using the original implementationof the LMS algorithm for adaptive noise cancellation andhardware with 8 bits resolution the adaptive system will not beable to adapt and converge, as seen in the example, where mostof the noise signal is still present in the error signal, eA8 (n).However, the performance of the adaptive system increasessignificantly if using 16 or 32 bits resolution. These differencesof performances are related to the quantization errors producedduring the signal processing.

If considered the first solution proposed here, implementingthe noise cancellation system with accumulation with extendedresolution, at first sight, there is no major difference fromthe original implementation. This imply that using extendedresolution accumulator does not reduce significantly the quan-tization error, as usually does in an implementation of digitalfilter with fixed coefficients [2]. Thus, with this type ofimplementation the minimum resolution needed for a goodperformance is 16 bits.

As referred before scaled coefficients have larger amplitudeand the quantization error from multiplication of larger valuesmay be smaller than using smaller values. This statement isproved in the implementation of scaled coefficients. Whereasbefore with 8 bits resolution, in either implementations, thesystem cannot converge, using this proposed solution the 8bits resolution implementation already becomes viable and ef-fective, since there is a significant reduction of the quantizationerrors. Despite the performance boost for 8 bits, this resolutionstill represents the lower performance of the three resolutionimplementations, as expected. Even though for both 16 and32 bits resolution the quantization errors from the originalimplementation are very small, with this implementation these

Page 6: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

6 MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015

(a) (b)

(c) (d)

Fig. 4: Fixed-point implementations of adaptive noise cancellation: (a) original; (b) using extended resolution accumulator; (c)using scaled coefficients, (d) using extended resolution accumulator and scaled coefficients.

TABLE I: Signal-to-quantization-noise ratio ( dB) in eachimplementation and resolution in adaptive noise cancellationsystem.

B + 1 NC A NC B NC C NC D

8 17.0 17.0 34.4 38.916 73.2 73.6 81.1 87.732 172.7 173.1 176.6 181.2

errors decrease even more, thus reflecting in a very effectivesolution to reduce quantization errors.

Although using accumulation with extended resolution didnot bring meaningful changes to the performance of thesystem, if combined with scaled coefficients it is possibleto reduce the quantization errors further more in any reso-lution. In Table I is presented the SQNR in decibel for eachimplementation shown in Figure 4 according to (4), wherethe quantization error is defined as the difference betweenthe implementation presented and the full precision result inMATLAB with 64 bits floating-point. The SQNR also provesthe efficiency of the solutions to reduce the quantization errors,where for 8 bits resolution there is an increase around 22 dB,for 16 bits an increase around 15 dB and for 32 bits resolutionan increase around 8 dB from implementation A to D.

B. Adaptive System Identification

The application of system identification with adaptive fil-ter is used when there is a unknown system without any

information of its characteristics, having only available itsinput and output signals. Using these signals and with theLMS algorithm, the adaptive filter will try to converge to atransfer function that can be equivalent to the unknown system.This means, the relation between the output and input signalthat the unknown system imposes must be replicated in theadaptive filter. In Figure 5 it is shown the block diagram ofthis application, and since this implementation is performedin a computational environment, as the unknown system itwas chosen a lowpass IIR filter of 4th-order, whose frequencyresponse is represented as P (z). When the adaptive filteridentifies the unknown system, the error signal e(n) is zero,since both filter output y(n) and the output of the unknownsystem d(n) are equal.

The lowpass IIR filter chosen to represent the unknownsystem in simulation, has its frequency response in z domain

Fig. 5: Block diagram of the system identification applicationimplemented.

Page 7: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

FREIRE: EFFICIENT IMPLEMENTATION OF SYSTEMS WITH ADAPTIVE FILTERS 7

(a) (b)

(c) (d)

Fig. 6: Fixed-point implementations of adaptive system identification: (a) original; (b) using extended resolution accumulator;(c) using scaled coefficients, (d) using extended resolution accumulator and scaled coefficients.

defined as:

P (z) =a0 + a1z

−1 + a2z−2 + a3z

−3 + a4z−4

1− b1z−1 − b2z−2 − b3z−3 − b4z−4, (27)

where each coefficient is defined as:a0 = 0.0013 , a1 = 0.0051 , a2 = 0.0076 ,

a3 = 0.0051 , a4 = 0.0013 , b1 = 2.8869 ,

b2 = −3.2397 , b3 = 1.6565 , b4 = −0.3240 .

To find the transfer function of the unknown system, it isnecessary to put as the input signal of the adaptive filterthe same as the input signal of the unknown system, x(n).The signal source generates random samples at a samplingfrequency of 44.1 kHz, originating in a random signal, withamplitude inside the range of fixed-point representation, i.e.between [−0.9, 0.9]. The unknown system output signal isdefined by the following recurrent equation:

d(n) =4∑

k=0

akx(n− k) +4∑

k=1

bky(n− k) ,

n = 0, 1, ... .

(28)

The adaptive filter is once again of 31th-order (N = 31), whosecoefficients were initialized at zero, and the step size used itµ = 0.01.

In Figure 6 it is illustrated the results for each implementa-tion of the adaptive system identification, where each sub-plotfrom top to bottom correspond to 8, 16 and 32 bits resolution.As happen with noise cancellation, the original implementationwith 8 bits resolution is not efficient, where the adaptive filteris not able to identify the unknown system, since virtually

the input signal is still present at the output signal or errorsignal, eA8 (n). If using more bits, the quantization errors aremuch smaller defining a much better performance than theimplementation of 8 bits.

If using hardware with extended resolution accumulator, thequantization errors decrease very slightly however not enoughto have an efficient adaptive system for 8 bits resolution. Forthis case, the LMS algorithm is not able to converge andthe adaptive filter cannot identify the unknown system. Onceagain, for this type of implementation the minimum resolutionneeded to ensure a good performance of the LMS algorithmis 16 bits.

Nevertheless, implementing this adaptive system with scaledcoefficients and 8 bits resolution already guarantee the con-vergence of the algorithm and the system is efficient. In thisconditions, it is possible to see that the error signal, eC8 (n),tends to zero which means that the adaptive system was ableto identify the unknown system. For 16 and 32 bits resolutionthe quantization errors also decreased considerably, despite notperfectly seen in the figure.

Combining both solutions, in this type of adaptive system ispossible to reduce further more the quantization errors and thusimproving the effectiveness and performance of the system.Even though these reductions of errors cannot be very visiblein Figure 6, the differences are shown in Table II, whereis presented the SQNR for each implementation illustratedin the sub-plots in decibel calculated according to (4). Thequantization error is defined as the difference between the errorsignal of each implementation and the error signal in the full

Page 8: MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER …MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015 1 Efficient Implementation of Systems With Adaptive Filters Marta Freire Department

8 MSC DISSERTATION, EXTENDED ABSTRACT, NOVEMBER 2015

TABLE II: Signal-to-quantization-noise ratio ( dB) in each im-plementation and resolution for adaptive system identification.

B + 1 SI A SI B SI C SI D

8 10.8 11.0 31.7 37.616 63.7 63.8 77.5 86.032 157.8 158.0 173.2 179.1

precision implementation in floating-point 64 bits. Comparingthe original implementation (A) and the combined solutionsimplementation (D) there an increasing around 21 and 27 dBfor the different resolutions tested.

VII. INTEGRATED CIRCUITS FOR IMPLEMENTATION

There is available various types of integrated circuits (IC)to implement digital systems. The specifications of these ICdiffer from each other, which will translate then in differentperformances of the systems implemented. Between multipletypes of IC, is worth mention the micro-controller (MCU), thedigital signal processor (DSP) and field programmable gatearray (FPGA). In this group MCUs are the most limited interms of hardware, thus being known for having a very smallarea, low cost and lower central processing unit (CPU) clockfrequency [7]. The DSP is designed specially for digital signalprocessing, and has specific blocks to reduce computation timeand quantization errors of the filtering process, as one of themthe accumulator with extended resolution [8]. Comparativelywith the MCU, the DSP has larger area, higher cost andhigher CPU clock frequency. The big advantage of a FPGAtowards any kind of microprocessor is the functionality andflexibility to program all the hardware of the circuit to beimplemented, which if combining with parallel computingarchitecture, as pipeline architecture or multiple multipliers,it is possible to achieve higher CPU clock frequency than aDSP [9]. Besides these techniques there is already availablesome models of FPGA with DSP blocks integrated allowing abetter performance in signal processing. However, comparingto a DSP or MCU the price of a FPGA is higher and can,according to the system implemented, consume more power.

Nowadays, there are models of MCU which support reso-lutions of 8, 16 and 32 bits, whereas the DSP only support 16and 32 bits. Since FPGA is completely reprogrammable it cansupport any number of bits as resolution, however since itsprice is usually high, it is more considered for high resolutionimplementations. It is not common to implement an algorithmin such limited IC as a MCU with 8 bits resolution, since isnot possible to have an effective system. However, with thesolution proposed with scaled coefficients it is already possibleto implement an efficient adaptive system in a MCU with 8bits resolution, having then an small and low cost system,which can be beneficial for some end-user applications, wherethe performance does not need to be outstanding. Relativelyto the other resolutions tested, it was visible a very goodperformance of the systems in any type of implementations.Thus the criteria to choose the IC to implement the systemare left to the manufacturer of the system, which should meet

the specifications of either having a very good performancewith the lowest quantization errors possible and not rigorouswith price and area, or limited area or price but also withgood performance. The solution of scaled coefficients can beused in either IC or resolution since it does not depend onthe available hardware as the solution of accumulation withextended resolution. Either way, if chosen an IC with availableextended resolution accumulator is very beneficial to use thecombined solution, D, so to have smaller quantization errors.

VIII. CONCLUSION

With the simulations performed it was possible to under-stand the limitations in the performance of adaptive systemsaccording to finite precision arithmetic. To surpass these prob-lems, it is presented three solutions to reduce the quantizationerrors that are generated in a digital signal processing system,using an accumulator with extended resolution for the filteringprocess, power-of-two step size, and using scaled coefficients.

This work showed that with these solutions it is possible toimplement an efficient adaptive system with good performancewith a reduced resolution in terms of number of bits word-length in order to achieve a cheaper system. If the projectdemands an outstanding performance it is usually chosenhardware with more resolution and without any more improve-ments in the hardware, however the considered solutions canalso be used in this case, reducing even more the quantizationerrors effect, thus improving system efficiency.

REFERENCES

[1] E. C. Ifeachor and B. W. Jervis, Digital Signal Processing: A PracticalApproach. Pearson Education, 2002.

[2] T. Bose, Digital Signal and Image Processing. John Wiley & Sons, Inc,2004.

[3] S. K. Mitra, Digital Signal Processing. McGraw-Hill series in electricaland computer engineering, 1998.

[4] A. Antoniou, Digital Filters: Analysis, Design and Applications.McGraw-Hill International Editions, 1993.

[5] S. Haykin, Adaptive Filter Theory. Prentice-Hall International, 2002.[6] C.-Y. Chang and S.-T. Li, “Active Noise Control in Headsets by Using a

Low-Cost Microcontroller,” IEEE Transactions on Industrial Electronics,vol. 58, no. 5, pp. 1936–1942, 2011.

[7] L. S. de Sousa and F. Alegria, Sebenta de Electronica de Computadores,2012.

[8] S. W. Smith, The Scientist & Engineer’s Guide to Digital Signal Pro-cessing, first edit ed. California Technical Pub, 1997.

[9] U. Farooq, Z. Marrakchi, and H. Mehrez, Tree-based HeterogeneousFPGA Architectures. Springer New York, 2012.