Skip to content Skip to navigation


You are here: Home » Content » Lab 2: FIR Filtering


Recently Viewed

This feature requires Javascript to be enabled.

Lab 2: FIR Filtering

Module by: Ricardo Radaelli-Sanchez. E-mail the author

Summary: This lab exercise introduces the design and implementation of FIR filters on the 56002.

Note: You are viewing an old version of this document. The latest version is available here.

FIR filter implementation

Review the crucial 4 instructions that actually implement an FIR filter. Explain, in your own words, what each of these instructions does, and how they together implement an FIR filter. Explain also any necessary initializations for this segment of code.

  • clr a x0,x:(r0)+ y:(r4)+,y0
  • rep #ntaps-1
  • mac x0,y0,a x:(r0)+,x0 y:(r4)+,y0
  • macr x0,y0,a (r0)-

Implement an FIR filter by modifying the program shell.asm. The routine should take in samples from the A/D converter at 16kHz, filter them using an FIR filter, and play the result back through the D/A. Your modifications to shell.asm will include the following three additions:

  1. Assembler directives that reserve and initialize memory space for filter coefficients and filter states. For this implementation, use the filter coefficients found in the text file fircoefs.txt.
  2. The crucial 4 instructions that actually implement the FIR filter.
  3. Code to properly initialize the address registers before filtering begins.

Assemble this program, load it into the EVM, and execute the program. By changing the frequency of the sinewave input to the EVM, you can measure the magnitude frequency response of the FIR filter implemented. Do this, making sure that you have a sufficient number of measurements around the regions of interest, such as the band edges. As part of your report for this lab, compute the frequency response of this filter (from the coefficients) using Matlab and compare with the measured frequency response. What happens to the frequency response if you change the sampling frequency of the program?

Attempt to induce overflow by rescaling the coefficients of your filter. Can you observe evidence of overflow on the oscilloscope?

For an FIR filter of N taps, how many instructions does it take to filter one sample? The 56002EVM operates with a clock rate of 24.576MHz, and most instructions take two clock cycles to execute. At a sampling rate of 16kHz, how many instructions can be performed per sample? Can you suggest a better way to organize the program so that unused processor time can be applied to other tasks?

FIR filter design

Some speech has been recorded in the presence of a loud, annoying, high frequency hum. Measurements have indicated that the noise energy is isolated to frequencies in the range of 2850Hz to 2950Hz. Your job is to remove as much of this unwanted noise as possible without affecting the speech any more than necessary.

Use Matlab to design an FIR notch filter to remove these unwanted components. Design the filter for a sampling rate of 16kHz. Implement this filter on the 56002 and verify its operation using the oscilloscope. You will have to change the sampling rate of the DSP to 16kHz inside the file ada_init.asm. Once you are confident in its operation, demonstrate for the instructor its operation on some of the recorded speech.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens


A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks