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

📄 conv_cdma2000_1by2_9.asm

📁 ADI DSP CDMA多项式码表转换源码
💻 ASM
字号:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs  ( Micro Signal Architecture 1.0 specification).

By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software. 
********************************************************************************
Module name     : conv_cdma2000_1by2_9.asm
Label name      : __conv_cdma2000_1by2_9
Version         : 1.3

Change History  :

                Version     Date        Author          Comments
                1.3         11/18/2002  Swarnalatha     Tested with VDSP++ 3.0
                                                        compiler 6.2.2 on 
                                                        ADSP-21535 Rev.0.2
                1.2         11/13/2002  Swarnalatha     Tested with VDSP++ 3.0
                                                        on ADSP-21535 Rev. 0.2
                1.1         03/13/2002  Srinivas        Modified to match
                                                        silicon cycle count
                1.0         03/15/2001  Swarnalatha     Original 

Description     : This function performs convolution coding for the 
                  polynomials G0 = 753 and G1 = 561, used in CDMA-2000.
                  The function produces the coded output for a given input 
                  message data. The result is stored in the output buffer. The 
                  parameters passed should be in the order d,o,a.

                   d = Start address of the message data which has to be encoded
                   o = Pointer to the output of the encoder
                   a = Number of  bits in the input message data

Assumptions     : The number of bits must be a multiple of 16.

Implementation  : The coded bits for each message bit are generated by 
                    c1 = D1 EXOR D2 EXOR D3..........   
                  Where D1,D2 and D3 are the states of the shift register. 
                  The combination of D1,D2....is determined by the coefficients 
                  of the generator polynomial. Similarly c2 is generated  using 
                  given coefficients of the other generator polynomial. So for 
                  each message bit two coded bits are generated. The output of 
                  the encoder is unpacked.

Prototype       :
                void _conv_cdma2000_1by2_9
                        ( 
                        fract16 * ,     // Start address of message data 'd' 
                        char *,         //Pointer To The output 'o' 
                        int             //Number of message bits
                        );

Registers used  : A0, A1, R0-R3, R7, I0-I3, B0, B2, M0, L0-L3, P0-P2, LC0, LC1.

Performance     : 
                Code Size           : 360 Bytes

                If number of message bits  =  a
                Kernel cycle count  : (8*4)+ [(a/16)*(6+16*4)]

                Total Cycle Count   : 263 Cycles (for a = 32) 
*******************************************************************************/
.section  L1_code;
.global __conv_cdma2000_1by2_9;
.align 8;

__conv_cdma2000_1by2_9:

    L0 = 0;
    L1 = 0;
    L2 = 0;
    L3 = 0;
    [--SP] = R7;            //Push the call save register  R7
    P0 = -192;
    SP = SP + P0;
    I2 = SP;                //Start address of the buffer corresponding to 1st 
                            //polynomial
    I1 = R0;                //Start address of the message data
    I3 = I2;
    P0 = 16;                //Number of shifted versions for each polynomial
/*********PUSH THE COEFFICIENTS OF THE POLYNOMIALS INTO THE STACK POINTER******/
/*****************************FIRST POLYNOMIAL*********************************/       

    R7 = 0x1eb;             //Coefficients of the first polynomial
    R3 = R7 >> 8;
    [I3++] = R3 || R3 = R7 >> 7;
    [I3++] = R3 || R3 = R7 >> 6;
    [I3++] = R3 || R3 = R7 >> 5;
    [I3++] = R3 || R3 = R7 >> 4;
    [I3++] = R3 || R3 = R7 >> 3;
    [I3++] = R3 || R3 = R7 >> 2;
    [I3++] = R3 || R3 = R7 >> 1;
    [I3++] = R3;

    LSETUP(POLY1_ST_END,POLY1_ST_END)LC0 = P0;
                            //Initializing a loop for Number of shifted versions
                            //for 1st polynomial
POLY1_ST_END:
        [I3++] = R7 || R7 = R7 << 1;

    I0 = I3;                //Start address of the buffer corresponding to 2nd 
                            //polynomial
/***********SECOND POLYNOMIAL************************************************/
    R7 = 0x171;             //Coefficients of the second polynomial
    R3 = R7 >> 8;
    [I3++] = R3 || R3 = R7 >> 7;
    [I3++] = R3 || R3 = R7 >> 6;
    [I3++] = R3 || R3 = R7 >> 5;
    [I3++] = R3 || R3 = R7 >> 4;
    [I3++] = R3 || R3 = R7 >> 3;
    [I3++] = R3 || R3 = R7 >> 2;
    [I3++] = R3 || R3 = R7 >> 1;
    [I3++] = R3;

     LSETUP(POLY2_ST_END,POLY2_ST_END)LC0 = P0;
                            //Initializing a loop for Number of shifted versions
                            //for 2nd polynomial
POLY2_ST_END:
        [I3++] = R7 || R7 = R7 << 1;
        
    P0 = R1;                //Address of output;
    M0 = -8(x);
    A1 = A0 = 0  || R1 = [I1++];    
                            //Message data which has to be encoded;
    R2 = R2 >> 4;           //R2 contains the Number of bits in the message data
    P2 = R2;                //Number of bits in the message data/16
    P1 = 8;                 //Length of the encoder-1

    R7 = [I0++] || A0 = R1;
                            //R7 contains the coefficients of the 2nd polynomial
    R2.L = CC = BXOR(A0,R7) || R3 = [I2++];
                            //R2 contains the second  coded bit
                            //R3 contains the coefficients of the 1st polynomial
    R0.L = CC = BXOR(A0,R3) || R7 = [I0++];
                            //R0 contains the first  coded bit

    LSETUP(CODE1_START,CODE1_END)LC0 = P1;
                            //Initialize a loop for Length of the encoder-1
            
CODE1_START:    
        R3 = [I2++] || R2 = R2 << 1;
        R0 = R2|R0;         //R0 contains the code word
        R2.L = CC = BXOR(A0,R7) || B[P0++] = R0;
CODE1_END:
        R0.L = CC = BXOR(A0,R3) || R7 = [I0++];

    P1 = 16;                //For setting the loop counter for number of message
                            //bits
    R3 = [I0++M0];
    R7 = [I2--];
    L0 = 72;                //Length of the circular buffer for coeff of 2nd 
                            //polynomial
    L2 = 68;                //Length of the circular buffer for coeff of 1st 
                            //polynomial
    B0 = I0;                //Base address of buffer for coeff of 2nd polynomial
    B2 = I2;                //Base address of buffer for coeff of 1st polynomial

    LSETUP(CONV_START,CONV_END)LC0 = P2;
                            //Initialize a loop for number of 16 bit message 
                            //frames
CONV_START: 
        R7 = [I0++] || A0 = R1;
                            //R7 contains the coeff of the 2nd polynomial
                            //A0 contains the input message data
        R2.L = CC = BXOR(A0,R7) || R3 = [I2++];
                            //R2 contains the 2nd coded bit
                            //R3 contains the coeff of the 1st polynomial
        R0.L = CC = BXOR(A0,R3)  ||  R7 = [I0++];
                            //R2 contains the 1st coded bit
        LSETUP(CODE_START,CODE_END)LC1 = P1;
                            //Initialize a loop for 16 message bits
CODE_START: R3 = [I2++] || R2 = R2 << 1;
            R0 = R2 | R0;     //R0 contains the code word
            R2.L = CC = BXOR(A0,R7) || B[P0++] = R0;
CODE_END:   R0.L = CC = BXOR(A0,R3) || R7 = [I0++];
        
        R1.L = W[I1++];     //Fetch the data
CONV_END:
        R1 = PACK(R1.l,R1.h);
    P0  =  192;
    SP = SP+P0;
    R7 = [SP++];            //Pop the call save register R7
    RTS;
    NOP;                    //to avoid one stall if LINK or UNLINK happens to be
                            //the next instruction after RTS in the memory.


⌨️ 快捷键说明

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