You are on page 1of 4

7 Adaptive Filtering

95

7 Adaptive Filtering
In this section we will implement some simple adaptive signal processing. In
particular, issues related to implementation in FPGAs are considered. In the first
exercises we will design a fully parallel adaptive FIR filter. In particular we will
take note of the feedback that is present and how this means that there is a large
critical path.
Exercise
7.1 Standard Parallel Adaptive LMS Filter
Open the system:
\adaptive\lms1\lms1.mdl
This system implements the update equation for the complete adaptive
structure

w0 ( k )

w0 ( k 1 )

x(k)
w1 ( k )
w1 ( k 1 )
=
+ 2e ( k ) x ( k 1 )
x(k 2)
w2 ( k )
w2 ( k 1 )
x(k 3)
w3 ( k )
w3 ( k 1 )
The implementation maps the structure shown below:

x(k)

z-1

z-1

z-1

w0(k-1)

w1(k-1)

w2(k-1)

w3(k-1)

y(k)

d(k)

z-1

z-1

z-1

z-1

e(k)
2

x(k)

z-1

z-1

z-1

96

(a) Run the simulation and confirm the filter weights converge to the desired
solution for this system identification.
(b) Change the set of weights in the unknown system and run the simulation.
Does the filter still converge?
ANSWER:
(c) Reduce the step size by a factor of 10 and run the simulation again, what
can you observe? Do the weights converge? You may want to increase
the number of samples in this simulation.
Answer:

(d) In the above LMS signal flow graph indicate the critical path.
(e) Using System Generator, target the XC2VP30 device (available on the
board used in this course). Note that the XC2V40 only has 4 multipliers
and hence is not big enough for this design. Once the HDL has been
generated, synthesise and implement the design using the usual
procedure with the ISE tools. This may take several minutes to complete
so be patient!
(f) Complete the table below.
Report

Result

Value

Number of BUFGXMUXs
Place and Route
Report

Number of External IOBs


Number of 18 x 18 multipliers
Number of SLICEs

Post place & route


static timing report

Minimum Period
Maximum Frequency

Exercise
7.2 Non canonical LMS implementation
Open the system:
\adaptive\LMS_transpose\LMS_transpose.mdl
This system implements the non canonical LMS structure. Remember that the
reason for using the transpose FIR is because it presented some advantages
when implemented in FPGAs in terms of critical path. However most
importantly note that the integrity of the algorithm has been slightly changed
and is NOT identical to the standard LMS (in fact it is sub-optimal).
In this example we present an LMS implementation in which we have
introduced the transpose FIR structure instead of the canonical. The resulting
implementation of the LMS is called the non-canonical LMS and is shown in
the figure below.

7 Adaptive Filtering

97

transpose FIR structure

x(k)

y(k)

d(k)

w0(k-1)

w1(k-1)

w2(k-1)

z-1

z-1

z-1

w3(k-1)

z-1

z-1

z-1

z-1

e(k)
2

x(k)

z-1

z-1

z-1

(a) Check the configuration in the provided System Generator file and confirm
it implements the structure shown above.
(b) Run the simulation and confirm the filter weights converge to the desired
solution.
(c) Using the ISE tools, complete the table below taking particular note of the
Maximum clock frequency which should be higher than the previous design
due to the reduced critical path.
Report

Result

Value

Number of BUFGXMUXs
Place and Route
Report

Number of External IOBs


Number of 18 x 18 multipliers
Number of SLICEs

Post place & route


static timing report

Minimum Period
Maximum Frequency

Exercise
7.3 LMS Audio Using Configurable LMS Block
In this exercise a configurable LMS block is presented. The block is then tested
by using it in an audio example to filter out a sine wave.

98

Open the system:


\adaptive\LMS_audio\adaptive_lms2.mdl
Intsead of using discrete blocks to build an LMS filter, a configurable subsystem has been created. This block can be found in the Simulink library
browser within the Adaptive Blockset.
(a) Explore the parameters of the LMS block. Each parameter is used to set
the structure of the design. The figure at the bottom the page shows how
the parameters are used to set the width of the data paths.
(b) Run the system. Note that this will take a little time to run through the full
15 seconds of audio. During this time feel free to alter the Manual Switch
so that you alter between filtered and non-filtered audio capture.
(c) Once the simulation has finished play back the captured audio file at:
\adaptive\LMS_audio\audio.wav
(d) You should be able to hear the filter adapt as the tone slowly disappears.
Also, look at the scope output which will show the filter adapting.
(e) To view the inside of the LMS block, right click on the block and then select
Look Under Mask. To look within each coefficient block of the design just
repeat this process. By doing this, confirm that the LMS structure is the
same as the one built from discrete tokens in Exercise 7.1. Feel free to
alter the parameters of the LMS block and then check to see if the changes
have been made automatically.

Input Width
Adders grow to
accommodate
integer bit growth

z-1

z-1

Input + Coeff. Width

y(k)

d(k)

Coefficient Width
Error Width

z-1

z-1

z-1

Step Width

Error
-1 + Input Width
-1
z

You might also like