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

📄 maxval.asm

📁 davinci技术 源码 视频监控汇编源码
💻 ASM
字号:
* ======================================================================== *
*  TEXAS INSTRUMENTS, INC.                                                 *
*                                                                          *
*  NAME                                                                    *
*      maxval -- maxval                                                    *
*                                                                          *
*                                                                          *
*  REVISION DATE                                                           *
*      14-Apr-2005                                                         *
*                                                                          *
*   USAGE                                                                   *
*                                                                           *
*       This routine is C-callable and can be called as:                    *
*                                                                           *
*       short maxval                                                        *
*       (                                                                   *
*           const short *x,                                                 *
*           int nx                                                          *
*       );                                                                  *
*                                                                           *
*       x : address to array of values                                      *
*       nx: number of values in array                                       *
*                                                                           *
*                                                                           *
*   DESCRIPTION                                                             *
*                                                                           *
*       This routine finds the maximum value of a vector and returns        *
*       the value.                                                          *
*                                                                           *
*                                                                           *
*   TECHNIQUES                                                              *
*                                                                           *
*                                                                           *
*   ASSUMPTIONS                                                             *
*                                                                           *
*   1. nx must be a mulitple of 8 and >= 40.                                *
*   2. x should be double word aligned.                                     *
*                                                                           *
*                                                                           *
*                                                                           *
*                                                                           *
*   C CODE                                                                  *
*                                                                           *
*       This is the C equivalent of the routine without any restrictions:   *
*                                                                           *
*       short maxval(const short *x, int nx)                                *
*       {                                                                   *
*           int i;                                                          *
*           short max = -32768;                                             *
*                                                                           *
*           for (i=0;i<nx;i++)                                              *
*               if (x[i] > max)                                             *
*                   max = x[i];                                             *
*                                                                           *
*           return max;                                                     *
*       }                                                                   *
*                                                                           *
*                                                                           *
*   NOTES                                                                   *
*                                                                           *
*                                                                           *
*   CYCLES                                                                  *
*                                                                           *
*       cycles = nx/8 + 13                                                  *
*       For nx = 256, cycles = 45                                           *
*                                                                           *
*                                                                           *
*   CODE SIZE                                                               *
*                                                                           *
*       50 bytes                                                            *
* ------------------------------------------------------------------------- *
*             Copyright (c) 2005 Texas Instruments, Incorporated.           *
*                            All Rights Reserved.                           *
* ========================================================================= *


* ======================================================================== *
* ======================================================================== *
************************ SYMBOLIC REGISTER ASSIGNMENTS ***********************
        .asg            A4,         A_Input
        .asg            B2,         B_Input
        .asg            B4,         B_nInputs

        .asg            A2,         A_m1m0
        .asg            A3,         A_m3m2

        .asg            B1,         B_m7m6
        .asg            B0,         B_m5m4

        .asg            A1,         A_d3d2
        .asg            A0,         A_d1d0
        .asg            B7,         B_d7d6
        .asg            B6,         B_d5d4

        .asg            A2,         A_d0d1

        .asg            A5,         A_p0p0

        .asg            A4,         A_max
* ========================================================================= *

        .text        .global _maxval_maxval:
* ======================================================================== *
* ======================================================================== *
          SHR       .S2     B_nInputs,  3,  B_nInputs   ; N/8

          LDDW   .D1T1 *A_Input[0],        A_m3m2:A_m1m0 ;
||        SUB       .S2     B_nInputs,  5,  B_nInputs

          SPLOOPD      1                                 ;
||        ADD    .L2X  A_Input,   8,       B_Input       ;
||        MVC    .S2   B_nInputs, ILC                    ;
||        LDDW   .D1T2 *A_Input[1],        B_m7m6:B_m5m4 ;
* =========================== PIPE LOOP KERNEL ============================ *
          LDDW   .D2T2 *++B_Input[2],      B_d7d6:B_d5d4 ;
||        LDDW   .D1T1 *++A_Input[2],      A_d3d2:A_d1d0 ;

          NOP          4                                 ;

          SPKERNEL 5,0
||        MAX2   .L2   B_d7d6,    B_m7m6,  B_m7m6        ;
||        MAX2   .S2   B_d5d4,    B_m5m4,  B_m5m4        ;
||        MAX2   .L1   A_d3d2,    A_m3m2,  A_m3m2
||        MAX2   .S1   A_d1d0,    A_m1m0,  A_m1m0        ;
* =========================== PIPE LOOP EPILOG ============================ *
**** E4 - D1, D2, M1, M2
**** Loop complete
        BNOP    B3


          MAX2   .L1   A_m1m0,    A_m3m2,  A_d1d0        ;
||        MAX2   .L2   B_m7m6,    B_m5m4,  B_d5d4        ;

          MAX2   .L1X  A_d1d0,    B_d5d4,  A_d1d0        ;

          PACKLH2.L1   A_d1d0,    A_d1d0,  A_d0d1        ;

          MAX2   .L1   A_d1d0,    A_d0d1,  A_p0p0        ;

          SHRU   .S1   A_p0p0,    16,      A_max

* ========================================================================== *
******************************************************************************

                .end

* ======================================================================== *
*  End of file: maxval.asm                                                 *
* ------------------------------------------------------------------------ *
*          Copyright (C) 2005 Texas Instruments, Incorporated.             *
*                          All Rights Reserved.                            *
* ======================================================================== *

⌨️ 快捷键说明

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