⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autocor.asm

📁 davinci技术 源码 视频监控汇编源码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
*========================================================================== *
*   NAME                                                                    *
*       autocor -- Autocorrelation                                          *
*                                                                           *
*   REVISION DATE                                                           *
*       25-May-2005                                                         *
*                                                                           *
*    USAGE                                                                  *
*         This routine has the following C prototype:                       *
*                                                                           *
*         void autocor                                                      *
*         (                                                                 *
*             short *restrict r,                                            *
*             const short *restrict x,                                      *
*             int          nx,                                              *
*             int          nr                                               *
*          );                                                               *
*                                                                           *
*         r[nr]   : Output array                                            *
*         x[nr+nx]: Input array. The first nr elements are assumed to be 0. *
*         nx      : Length of autocorrelation                               *
*         nr      : Number of lags                                          *
*                                                                           *
*                                                                           *
*      DESCRIPTION                                                          *
*         This routine performs an autocorrelation of an input vector       *
*         x. The length of the autocorrelation is nx samples. Since nr      *
*         such autocorrelations are performed, input vector x needs to be   *
*         of length nx + nr. This produces nr output results which are      *
*         stored in an output array r.                                      *
*                                                                           *
*         The following diagram illustrates how the correlations are        *
*         obtained.                                                         *
*                                                                           *
*         Example for nr=8, nx=24:                                          *
*         0       nr                  nx+nr-1                               *
*         |-------|----------------------|  <- x[]                          *
*         |       |----------------------|  -> r[0]                         *
*         |      |----------------------|   -> r[1]                         *
*         |     |----------------------|    -> r[2]                         *
*         |    |----------------------|     -> r[3]                         *
*         |   |----------------------|      -> r[4]                         *
*         |  |----------------------|       -> r[5]                         *
*         | |----------------------|        -> r[6]                         *
*                                                                           *
*         Note that x[0] is never used, but is required for padding to make *
*         x[nr] double-word aligned.                                        *
*                                                                           *
*    ASSUMPTIONS                                                            *
*         The first nr elements are assumed to be 0.                        *
*         nx is a multiple of 8                                             *
*         nr is a multiple of 4                                             *
*         x[] is double-word aligned                                        *
*         r[] is double-word aligned                                        *
*                                                                           *
*                                                                           *
*     TECHNIQUES                                                            *
*         Routine is organized as a nested SPLOOP.  The SPLOOP executes     *
*         nx/8 iterations and calculates 4 values to the output array.      *
*         The outer loop packs the 4 output values and stores them to       *
*         the output array r[].  The SPLOOP is reloaded to calculate        *
*         the next four output values.  Double word wide loads and          *
*         stores are used on the input and output data  arrays.             *
*                                                                           *
*    C CODE                                                                 *
*                                                                           *
*    void autocor_cn(short *restrict       r,                               *
*                    const short *restrict x,                               *
*                    int                   nx,                              *
*                    int                   nr)                              *
*    {                                                                      *
*       int i, k;                                                           *
*       int sum;                                                            *
*                                                                           *
*       for (i = 0; i < nr; i++)                                            *
*      {                                                                    *
*          sum = 0;                                                         *
*                                                                           *
*          for (k = nr; k < nx + nr; k++)                                   *
*          {                                                                *
*              sum += x[k] * x[k-i];                                        *
*          }                                                                *
*                                                                           *
*      r[i] = sum  >> 15;                                                   *
*      }                                                                    *
*   }                                                                       *
*                                                                           *
*    MEMORY NOTE                                                            *
*      This code is a LITTLE ENDIAN implementation.                         *
*                                                                           *
*   NOTES                                                                   *
*                                                                           *
*                                                                           *
*   CYCLES                                                                  *
*                                                                           *
*         Nx <  40:  20 + (6 * Nr)                                          *
*         Nx >= 40:  20 + (2 * Nr) + (Nx * Nr)/8                            *
*                                                                           *
*                                                                           *
*       For nr = 32, nx = 160: cycles = 725                                 *
*                                                                           *
*   CODESIZE                                                                *
*         304 bytes                                                         *
*                                                                           *
* ------------------------------------------------------------------------- *
*             Copyright (c) 2005 Texas Instruments, Incorporated.           *
*                            All Rights Reserved.                           *
* ========================================================================= *
;* Date/Time created: Tue Apr 12 14:53:21 2005                              *
;****************************************************************************
     .compiler_opts --endian=little --hll_source=on --mem_model:code=far --mem_model:data=far --predefine_memory_model_macros --silicon_version=6500 --symdebug:skeletal

;******************************************************************************
;* GLOBAL FILE PARAMETERS                                                     *
;*                                                                            *
;*   Architecture      : TMS320C64x+                                          *
;*   Optimization      : Enabled at level 3                                   *
;*   Optimizing for    : Speed                                                *
;*                       Based on options: -o3, no -ms                        *
;*   Endian            : Little                                               *
;*   Interrupt Thrshld : Disabled                                             *
;*   Data Access Model : Far                                                  *
;*   Pipelining        : Enabled                                              *
;*   Speculate Loads   : Disabled                                             *
;*   Memory Aliases    : Presume are aliases (pessimistic)                    *
;*   Debug Info        : DWARF Debug for Program Analysis w/Optimization      *
;*                                                                            *
;******************************************************************************

     .asg A15, FP
     .asg B14, DP
     .asg B15, SP



        .text        .global _autocor_autocor:;******************************************************************************
;* FUNCTION NAME: autocor_nsa                                                 *
;*                                                                            *
;*   Regs Modified     : A0,A1,A3,A8,A9,A10,A16,A17,A18,A19,A20,A21,A22,A23   *
;*                       A24,A25,A26,A27,A28,A29,A30,A31                      *
;*                       B1,B2,B3,B4,B5,B6,B7,B8,B9,B16,B17,B18,B19,B20,B21   *
;*                       B22,B23,B24,B25,B26,B27,B28,B29,B30,B31              *
;*   Regs Used         : A0,A1,A3,A4,A6,A8,A9,A10,A16,A17,A18,A19,A20,A21,    *
;*                       A22,A23,A24,A25,A26,A27,A28,A29,A30,A31              *
;*                       B1,B2,B3,B4,B5,B6,B7,B8,B9,B16,B17,B18,B19,B20,B21   *
;*                       B22,B23,B24,B25,B26,B27,B28,B29,B30,B31              *
;******************************************************************************

;             Input Parameters
          .asg            A4,         A_r
          .asg            B4,         B_x
          .asg            A6,         A_nx
          .asg            B6,         B_nr

;             Outer Loop Parameters
          .asg            A0,         A_i

          .asg            B28,        B_ik_rst
          .asg            A1,         A_yptr_rst
          .asg            B29,        B_yptr_rst
          .asg            B2,         B_xptr_rst

          .asg            B5,         B_pack_0
          .asg            B4,         B_pack_1

          .asg            A3,         A_yptr
          .asg            B1,         B_rptr

;         ;   Inner Loop Parameters
          .asg            B7,         B_xptr
          .asg            B25,        B_x3x2
          .asg            B24,        B_x1x0
          .asg            A27,        A_x7x6
          .asg            A26,        A_x5x4
          .asg            A16,        A_yptr
          .asg            B27,        B_y3y2
          .asg            B26,        B_y1y0
          .asg            A23,        A_y7y6
          .asg            A22,        A_y5y4
          .asg            A23,        A_z0z1
          .asg            A22,        A_z2z3
          .asg            B19,        Bt_y1y0
          .asg            B18,        Bt_z0z1
          .asg            A29,        At_y5y4
          .asg            A28,        At_y3y2

          .asg            B29,        B_prod1
          .asg            B28,        B_prod5

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -