Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TMS320C2x DSP - digital filters are a common requirement for digital signal http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
      Digital filters are a common requirement for digital signal
      processing systems. The filters fall into two basic categories:
      Finite Impulse Response (FIR) and Infinite Impulse Response (IIR).
      For either category of filter, the coefficients of the filter
      (weighting factors) may be fixed or adapted during the course of the
      signal processing. The theory and implementation of digital filters
      is presented and discussed in a TI application report in their book
      "Digital Signal Applications with the TMS320 Family".

      IIR filters benefit from the 100 ns instruction cycle time on the
      TMS320C25. IIR filters typically require fewer multiply-accumulates.
      Correspondingly, the amount of data memory for samples and
      coefficients is not usually the limitingfactor. Because of
      sensitivity to quantatization of the coefficients themselves, IIR
      filters are usually implemented in cascaded second-order sections.
      This translates  to instruction code consisting of LTD-MPY
      instruction pairs rather than MACD's. The following illustrates a
      second-order IIR filter:

*
*  THE FOLLOWING EQUATIONS ARE USED TO IMPLEMENT A IIR FILTER:
*
*     d(n) = x(n)    + d(n-1)*a1 + d(n-2)*a2
*     y(n) = d(n)*b0 + d(n-1)*b1 + d(n-2)*b2
*
START IN    XN,PA0      ; INPUT NEW VALUE XN.
      LAC   XN,15       ; LOAD ACCUMULATOR WITH XN.
*
      LT    DNM1
      MPY   A1
*
      LTD   DNM2
      MPY   A2
*
      APAC
      SACH  DN,1        ; d(n) = x(n) + d(n-1)*a1 + d(n-2)*a2
      ZAC
      MPY   B2
*
      LTD   DNM1
      MPY   B1
*
      LTD   DN
      MPY   B0
*
      APAC
      SACH  YN,1        ; y(n) = d(n)*b0 + d(n-1)*b1 + d(n-2)*b2
      OUT   YN,PA1      ; YN IS THE OUTPUT OF THE FILTER.

      FIR filters require many more multiply-accumulates than does a IIR
      filter with equivalent sharpness at the cutoff frequencies,
      distortion, and attenuation in the passbands and stopbands. Longer
      filters are made more feasible by allowing the coefficients to be
      fetched from program memory at the same time as a sample is being
      fetched from data memory. The simple implementation of the process
      uses the MACD instruction with the RPT/RPTK instruction:

            RPTK  255
            MACD  COEFFP,*-

      The coefficients on the TMS32020 may be stored anywhere in on-chip
      RAM. Filters of up to 256 taps can be implemented at an execution
      speed of 200 ns per tap. The coefficients on the TMS320C25 may be
      stored anywhere in program memory (reconfigurable on-chip RAM, on-
      chip ROM, or external memories). When the coefficients are stored
      in on-chip ROM or externally, the entire on-chip data RAM may be
      used to store the sample sequence. Ultimately, this allows filters
      of up to 512 taps to be implemented on the TMS320C25. The filter
      executes at full speed or 100 ns per tap as long as the memory
      supports full-speed execution.

See Also: adaptive filtering

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson