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 - many dsp applications must perform convolution operations or other http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
      Many DSP applications must perform convolution operations or other
      operations similar in form. These operations require data to be
      shifted or delayed. The DMOV, LTD, and MACD instructions can perform
      the needed data moves for convolution.

      The data move function allows a word to be copied from the currently
      addressed data memory location in on-chip RAM to the next higher
      location while the data from the addressed location is being
      operated upon (e.g., by the CALU) The data move and the CALU
      operation are performed in the same cycle. In addition, an ARAU
      operation may also be performed in the same cycle when using the
      indirect addressing mode. The data move function is useful in
      implementing algorithms, such as convolutions and digital filtering,
      where data is being passed through a time window. It models the
      z^-1 delay operation encountered in those applications. The data
      move function is continuous across the boundary of on-chip data
      memory blocks B0, B1, and B2; however, the data move function cannot
      be used if off-chip memory is referenced.

      In the following example,
                          2
                         ----
                  Y(n) = \    H(k) * X(n - k)
                         /
                         ----
                        k = 0
      is implemented; the H values stay the same and the X values are
      shifted each time the microprocessor performs one of the following
      series of multiplications (similar to operations performed in FIR
      filters):

        First series:   Y(2) = H(0)*X(2) + H(1)*X(1) + H(2)*X(0)
        Second series:  Y(3) = H(0)*X(3) + H(1)*X(2) + H(2)*X(1)
        Third series:   Y(4) = H(0)*X(4) + H(1)*X(3) + H(2)*X(2)

      The MACD instruction, which combines accumulate and multiply
      operations with a data move, is tailored to the above calculation.
      In order to use MACD, the H values have been stored in block B0,
      configured as program RAM, and the X values have been read into
      block B1 of data RAM. The summation is performed in the reverse
      order, i.e., from k = 2 to 0, due to the operation of the data move
      function. This results in the oldest X value being used and
      discarded first. If the MACD instruction is replaced with the
      following two instructions, then the MAC instruction can be utilized
      with the same results: MAC  * <CR> DMOV  *-. In cases where there
      are many more than three MACD instructions required, the RPT or RPTK
      instructions may be used with MACD, yielding the same computational
      results but using less assembly code.

*  THIS ROUTINE IMPLEMENTS A SINGLE PASS OF A THIRD ORDER FIR
*  FILTER. IT IS ASSUMED THAT THE H AND X VALUES HAVE ALREADY
*  BEEN LOADED INTO THEIR RESPECTIVE MEMORY LOCATIONS, THAT
*  THE ACCUMULATOR AND P REGISTER ARE BOTH RESET TO ZERO, AND
*  THAT AR1 IS POINTING TO X0. NOTE THAT THE macd INSTRUCTION
*  MAY BE USED IN THE REPEAT MODE, BUT IT IS NOT IMPLEMENTED
*  HERE.
*
FIR   CNFP              ; CONFIGURE BLOCK B0 AS PROGRAM MEMORY.
      LARP  1           ; AR1 SHOULD POINT AT THE X VALUES.
      MAC   >FF00,*-    ; P = (X0)(H2)
      MACD  >FF01,*-    ; ACC = (X0)(H2)
      MACD  >FF02,*     ; ACC = (X0)(H2) + (X1)(H1)
      APAC              ; ACC = (X0)(H2) + (X1)(H1) + (X2)(H0)
      CNFD              ; CONFIGURE BLOCK B0 AS DATA MEMORY.
      RET               ; RETURN TO MAIN PROGRAM.

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