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

📄 cfft_rad4_ns_nbrev.asm

📁 ADI BF DSP的FFT汇编优化后的代码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
                            // (number of stages - 2)
    P2 += 1;                // Butterfly counter is incremented
    P2 = P2 << 2;           // Number of butterflies is multiplied by 4.
    P2 += -1;               // Loop counter is decremented as first butterfly is
                            // done outside.
    R0 = P0;                // Let P0 = a
    M0 = P0;                // Modifier of input for butterfly, M0 = a
    R1 = R0 << 2;
    P0 = R1;                // a is multiplied by four
    R1 = R0 - R1;
    R1 += 4;
    M3 = R1;                // M3 = -3a + 4 (a before modification)
    
    R2 = R2 >> 2;           // R2 is initialized to N and is divided by four 
                            // after each stage.
    M1 = R2;                // For restoring twiddle factor pointer
    
    P1 = P1 >> 2;           // P1 initialized to N/4 and is divided by four 
                            // after each stage
    CC = P1 == 1;           // Check whether loop has been executed (no: of 
                            // stages - 2) times
    IF CC JUMP FINISH;      // If true, jump to finish
    
    LSETUP(GROUP_ST,GROUP_END) LC0 = P1;
                            // Executed for all groups in the stage
GROUP_ST:
                            // First butterfly is done outside as the twiddle 
                            // factors are one in this butterfly.
        R4 = PACK(R2.H,R2.L) || R7 = [I1++M0] || I2 -= M2;
                            // R4 = R2 , Fetch x0 , Modify I2
        R6 = [I1++M0] || I2 -= M2;
                            // Fetch x2 ,  Modify I2 
        M2 = R4;            // Modifier for twiddle factor array
        R7 = R7 +|+ R6 , R1 = R7 -|- R6(ASR) || R0 = [I1++M0];
                            // A = x0 +|+ x2, B = x0 -|- x2, Fetch x1
        R6 = [I1++M3];      // Fetch x3
        R5 = R0 +|+ R6 , R3 = R0 -|- R6(ASR,CO) ||  R0 = [I1++M0];
                            // C = x1 +|+ x3, D = x1 -|- x3(CO), Fetch x0 of 
                            // next butterfly
        R5 = R7 +|+ R5 , R6 = R7 -|- R5(ASR) || R7 = [I1++M0] || I2 += M2;
                            // y0 = A +|+ C, y2 = A -|- C, Fetch x2 of next 
                            // butterfly, Skip W0
        R3 = R1 +|- R3 , R1 = R1 -|+ R3(ASR) || [I3++M0] = R5 || R5 = [I2++M2];
                            // y3 = B +|- D, y1 = B -|+ D, Store y0 of this 
                            // butterfly, Fetch W1
        R4 = R4 + R2(S)  ||  [I3++M0] = R1 || R1 = [I2++M2];
                            // R2 is added to R4 , Store y1 of this butterfly, 
                            // fetch W2
    
        LSETUP(INTER_STG_BFLY_ST,INTER_STG_BFLY_END) LC1 = P2;
                            // Loop for (butterflies-1) in the group
INTER_STG_BFLY_ST:
            A0=R7.L*R1.L, A1=R7.L*R1.H || [I3++M0] = R6;
                            // Complex mul. of x2 and W2, Store y2 of previous 
                            // butterfly
            R1.L=(A0-=R7.H*R1.H), R1.H=(A1+=R7.H*R1.L) || R7 = [I1++M0];
                            // C2 = x2 * W2, Fetch x1
    
            A0=R7.L*R5.L, A1=R7.L*R5.H    ||  [I3++M3] = R3 || R3 = [I2];
                            // Complex mul. of x1 and W1, Fetch W3
            R7.L=(A0-=R7.H*R5.H), R7.H=(A1+=R7.H*R5.L)    ||   R6 = [I1++M3] 
            || I2 -= M2;
                            // C1 = x1 * W1, Fetch x3, Modify I1, I2
    
            A0=R6.L*R3.L, A1=R6.L*R3.H   || I2 -= M2;
                            // Complex mul. of x3 and W3, Modify I2
            M2=R4;          // Modifier of I2 is updated
            R6.L=(A0-=R6.H*R3.H), R6.H=(A1+=R6.H*R3.L) || I2 += M1;
                            // C3 = x3 * W3, Restore I2
    
            R5 = R7 +|+ R6, R3 = R7 -|- R6(ASR,CO);
                            // C = C1 +|+ C3, D = C1 -|- C3(CO)
            R7 = R0 +|+ R1, R1 = R0 -|- R1(ASR) || R0 = [I1++M0];
                            // A = x0 +|+ C2, B = x0 -|- C2, Fetch x0 of next 
                            // butterfly
            R5 = R7+|+R5 , R6 = R7-|-R5(ASR) || R7 = [I1++M0];
                            // y0 = A +|+ C, y2 = A -|- C, Fetch x2 of next 
                            // butterfly
            R3 = R1+|-R3 , R1 = R1-|+R3(ASR) || [I3++M0] = R5 || R5 = [I2++M2];
                            // y3 = B +|- D, y1 = B -|+ D, Store y0 of this 
                            // butterfly, Fetch W1
INTER_STG_BFLY_END:
            R4 = R4 + R2(S)  ||  [I3++M0] = R1 || R1 = [I2++M2];
                            // R4(copy of M2) is modified, Store y1, Fetch W2
    
        A0=R6.L*R6.L, A1=R6.L*R6.H ||  [I3++M0] = R6 || I2 -= M2;
                            // Store y2 of last butterfly, Modify I2
GROUP_END:      
        [I3++] = R3 || I1 += M0;
                            // Store y3 of last butterfly, Modify I0 
    
JUMP INTER_STG;
    
FINISH:
    R4 = PACK(R2.H,R2.L) || I2 -= M2 || R7 = [I1++M0];
                            // R4 = R2 , Modify twiddle factor array pointer ,
                            // Fetch x0
    R6 = [I1++M0] || I2 -= M2;
                            // Modify twiddle factor array pointer ,Fetch x2 
    M2 = R4;                // Modifier for twiddle factor array
    R7 = R7 +|+ R6 , R1 = R7 -|- R6 || R0 = [I1++M0];
                            // A = x0 +|+ x2, B = x0 -|- x2, Fetch x1
    R6 = [I1++M3];          // Fetch x3
    R5 = R0 +|+ R6 , R3 = R0 -|- R6(CO) ||  R0 = [I1++M0];
                            // C = x1 +|+ x3, D = x1 -|- x3(CO), Fetch x0 of 
                            // next butterfly
    R5 = R7 +|+ R5 , R6 = R7 -|- R5 || R7 = [I1++M0] || I2 += M2;
                            // y0 = A +|+ C, y2 = A -|- C, Fetch x2 of next 
                            // butterfly, Skip W0
    R3 = R1 +|- R3 , R1 = R1 -|+ R3 || [I3++M0] = R5 || R5 = [I2++M2];
                            // y3 = B +|- D, y1 = B -|+ D, Store y0 of this 
                            // butterfly, Fetch W1
    R4 = R4 + R2(S)  || [I3++M0] = R1 || R1 = [I2++M2];
                            // R2 is added to R4 , Store y1 of this butterfly, 
                            // fetch W2
    
    LSETUP(BUTTERFLY2_ST,BUTTERFLY2_END) LC1 = P2;
BUTTERFLY2_ST:
        A0=R7.L*R1.L, A1=R7.L*R1.H || [I3++M0] = R6;
                            // Complex mul. of x2 and W2, Store y2 of previous 
                            // butterfly
        R1.L=(A0-=R7.H*R1.H), R1.H=(A1+=R7.H*R1.L) || R7 = [I1++M0];
                            // C2 = x2 * W2, Fetch x1
    
        A0=R7.L*R5.L, A1=R7.L*R5.H    ||  [I3++M3] = R3 || R3 = [I2];
                            // Complex mul. of x1 and W1, Fetch W3
        R7.L=(A0-=R7.H*R5.H), R7.H=(A1+=R7.H*R5.L)    ||   R6 = [I1++M3] 
        || I2 -= M2;
                            // C1 = x1 * W1, Fetch x3, Modify I1, I2
    
        A0=R6.L*R3.L, A1=R6.L*R3.H   || I2 -= M2;
                            // Complex mul. of x3 and W3, Modify I2
        M2=R4;              // Modifier of I2 is updated
        R6.L=(A0-=R6.H*R3.H), R6.H=(A1+=R6.H*R3.L) || I2 += M1;
                            // C3 = x3 * W3, Restore I2
    
        R5 = R7 +|+ R6, R3 = R7 -|- R6(CO);
                            // C = C1 +|+ C3, D = C1 -|- C3(CO)
        R7 = R0 +|+ R1, R1 = R0 -|- R1 || R0 = [I1++M0];
                            // A = x0 +|+ C2, B = x0 -|- C2, Fetch x0 of next 
                            // butterfly
        R5 = R7+|+R5 , R6 = R7-|-R5 || R7 = [I1++M0];
                            // y0 = A +|+ C, y2 = A -|- C, Fetch x2 of next 
                            // butterfly
        R3 = R1+|-R3 , R1 = R1-|+R3 || [I3++M0] = R5 ||  R5 = [I2++M2];
                            // y3 = B +|- D, y1 = B -|+ D, Store y0 of this 
                            // butterfly, Fetch W1
BUTTERFLY2_END:
        R4 = R4 + R2(S) ||  [I3++M0] = R1 || R1 = [I2++M2];
                            // R4(copy of M2) is modified, Store y1, Fetch W2
    [I3++M0] = R6;          // Store y2 of last butterfly
    [I3++M3] = R3;          // Store y3 of last butterfly
    
    (R7:4) = [SP++];        // Restore all registers that were saved
    RTS;
    NOP;                    // If link or unlink happens to be the next 
                            // instruction after RTS in memory, RTS takes one 
                            // extra cycle than expected. NOP is put to avoid 
                            // this.

⌨️ 快捷键说明

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