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

📄 conv_gsm_1by3_5.asm

📁 ADSP-BLACKFIN533 平台上实现卷积编码
💻 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_gsm_1by3_5.asm
Label name      : __conv_gsm_1by3_5
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         01/22/2002  Swarnalatha     Modified to match
                                                        silicon cycle count
                1.0         02/14/2001  Swarnalatha     Original 

Description     : This function performs convolution coding for GSM(1/3,5) for
                  the generator polynomials G1 = 33 ,G2 = 25, G3 = 37 in octal
                  form. 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 Cmn,d,m,o,a.

                  Cmn = Start address of the coefficients of the generator
                         polynomials
                  d   = the message data which has to be encoded
                  m   = length of the encoder (Number of stages in the shift 
                        register)
                  o   = Start address of the output of the encoder
                  a   = number of bits in the message data.

Assumptions     : Number of bits in the message data should be a multiple of 16
                  bits.

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,c3 are generated
                  using given coefficients of the other generator polynomials.
                  So for each message bit 3 coded bits  are generated.

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

Registers used  : A0, A1, R0-R3, R5-R7, I0-I3, B1-B3, L0-L3, P0-P2, LC0, LC1.

Performance    :
                Code size           : 386 Bytes

                If number of message bits = a
                Kernel cycle count  : (4*7)+[(a/16)*(5+16*7)]
                Total Cycle Count   : 378 cycles (for a = 32)
*******************************************************************************/
.section  L1_code;
.global __conv_gsm_1by3_5;
.align 8;

__conv_gsm_1by3_5:
	
    [--SP] = (R7:5);        //Push the call save registers  R7,R6 and R5
    L0 = 0;
    L1 = 0;
    L2 = 0;
    L3 = 0;
    
    P0 = -248;
    SP = SP + P0;
    I1 = SP;                //Start address of the buffer corresponding to 1st
                            //polynomial
    I0 = R0;                //Start address of the message data
    I3 = I1;
    P0 = 16;
/*********PUSH THE COEFFICIENTS OF THE POLYNOMIALS INTO THE STACK POINTER******/
/*****************************FIRST POLYNOMIAL*********************************/
    R7 = 0x1b;              //Coefficients of the first polynomial
    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;
POLY1_ST_END:
        [I3++] = R7 || R7 = R7 << 1;
    I2 = I3;                //Start address of the buffer corresponding to 2nd
                            //polynomial
/************************SECOND POLYNOMIAL*************************************/
    R7 = 0x15;              //Coefficients of the second polynomial
    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;
POLY2_ST_END:
        [I3++] = R7 || R7 = R7 << 1;

        
    P1 = I3;                //Start address of the buffer corresponding to 3rd 
                            //polynomial
/************************THIRD POLYNOMIAL**************************************/
    R7 = 0x1f;              //Coefficients of the third polynomial
    R3 = R7 >> 4;
    [I3++] = R3 || R3 = R7 >> 3;
    [I3++] = R3 || R3 = R7 >> 2;
    [I3++] = R3 || R3 = R7 >> 1;
    [I3++] = R3;
     

    LSETUP(POLY3_ST_END,POLY3_ST_END)LC0 = P0;
POLY3_ST_END:
        [I3++] = R7 || R7 = R7 << 1;
    I3 = P1;
    P0 = R1;                //Address of output
    A1 = A0 = 0  || R1 = [i0++];    
                            //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 = 4;                 //Length of the encoder-1
    R7 = [I3++] || A0 = R1; //R7 contains the coeff of 3rd polynomial
                            //A0 contains the input message data
    R3.L = CC = BXOR(A0,R7) || R6 = [I2++];
                            //R3 contains the 3rd  coded bit
                            //R6 contains the coeff of 2nd polynomial
    R2.L = CC = BXOR(A0,R6) || R5 = [I1++];
                            //R2 contains the second coded bit
                            //R5 contains the coeff of 1st polynomial
    R1.L = CC = BXOR(A0,R5);//R1 contains the 1st coded bit
    LSETUP(CODE1_START,CODE1_END)LC0 = p1;
                            //Initialize a loop for Length of the encoder-1 
CODE1_START:
        R2 = R2 << 1 || R7 = [I3++];
        R0 = R2|R1;       
        R6 = [I2++] || R3 = R3 << 2;
        R0 = R0 | R3;       //R0 contains the code word
        R3.L = CC = BXOR(A0,R7) || B[P0++] = R0;
        R2.L = CC = BXOR(A0,R6) || R5 = [I1++];
CODE1_END:
        R1.L = CC = BXOR(A0,R5);
    P1 = 16;
    R7 = [I3--] || I2 -= 4; 
    B3 = I3;                //Base address of the buffer for coeff of 3rd 
                            //polynomial
    R7 = [I3++] || I1 -= 4;
    L1 = 68;                //Length of the circular buffer for coeff of 1st 
                            //polynomial
    L2 = 68;                //Length of the circular buffer for coeff of 2nd 
                            //polynomial
    L3 = 68;                //Length of the circular buffer for coeff of 3rd 
                            //polynomial
    B2 = I2;                //Base address of the buffer for coeff of 2nd 
                            //polynomial
    B1 = I1;                //Base address of the 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:
        R3.L = CC = BXOR(A0,R7) || R6 = [I2++];
                            //R3 contains the first coded bit
                            //R6 contains the coeff of 2nd polynomial
        R2.L = CC = BXOR(A0,R6) || R5 = [I1++];
                            //R2 contains the second coded bit
                            //R5 contains the coeff of 1st polynomial
        R1.L = CC = BXOR(A0,R5);
                            //R1 contains the third coded bit
        LSETUP(CODE_START,CODE_END)LC1 = p1;
                            //Initialize a loop for 16 message bits
CODE_START:
            R7 = [I3++] || R2 = R2 << 1;
            R0 = R2 | R1;       
            R6 = [I2++] || R3 = R3 << 2;
            R0 = R0|R3;     //R0 contains the code word
            R3.L = CC = BXOR(A0,R7) || B[P0++] = R0;
            R2.L = CC = BXOR(A0,R6) || R5 = [I1++];
CODE_END:
            R1.L = CC = BXOR(A0,R5);
        R1.L = W[I0++];     //Fetch the next data
CONV_END:
        R1 = PACK(R1.L,R1.H) || R7 = [I3++];
    P0 = 248;
    SP = SP+P0;
    (R7:5) = [SP++];        //Pop the call save registers  R7,R6 and R5
    RTS;
    NOP;                    //to avoid one stall if LINK or UNLINK happens to be
                            //the next instruction after RTS in the memory.
                            

__conv_gsm_1by3_5.end:                            

⌨️ 快捷键说明

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