ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
18 апреля
768682 Топик полностью
USSR (14.07.2017 13:37, просмотров: 1) ответил USSR на Тоже дополню:
Итого, 130 строк:  __cfftN: B0 = R0; //Pointer of Input buffer B2 = R1; //Pointer of output buffer B3 = R2; //Address of Twiddle factor M3 = B2; P1 = [SP+12]; //The value of wst. wst = 512/n. R2 = [SP+16]; //length of input array [--SP] = (R7:4, P5:3); CC = R2 <= 4 (IU); //Come out of the program if the size of input data If CC Jump Terminate; //is less than equal to 4. P4 = R2; I0 = B0; //Address of Input array I2 = B2; //Address of Output array R3 = R2 << 1 || nop || nop; M0 = R3; //M0 stores the offset required for bit reversing P5 = P4 >> 2; //P5 is equal to number of butterflies at Stage 2 P0 = P5 >> 1; //P0 is half of th enumber of butterflies at stage 2. P0 += -1; //P0 is one less than 1/2 of butterfly at stage 2. I0 += M0 (BREV) || R2 = [I0]; //R2 reads the data I0 += M0 (BREV) || R3 = [I0]; I0 += M0 (BREV) || R4 = [I0]; CC = P0 <= 0 (IU); If CC Jump ESC_12; lsetup(Stage12_strt, Stage12_end) LC0 = P0; Stage12_strt: R2 = R2 +|+ R3, R3 = R2 -|- R3 (ASR) || I0 += M0 (BREV) || R5 = [I0]; R4 = R4 +|+ R5, R5 = R4 -|- R5 (ASR, CO) || I0 += M0 (BREV) || R0 = [I0]; R2 = R2 +|+ R4, R4 = R2 -|- R4 (ASR) || I0 += M0 (BREV) || R1 = [I0]; R5 = R3 +|- R5, R3 = R3 -|+ R5 (ASR) || I0 += M0 (BREV) || R6 = [I0]; R0 = R0 +|+ R1, R1 = R0 -|- R1 (ASR) || R7 = [I0] || [I2++] = R2; R6 = R6 +|+ R7, R7 = R6 -|- R7 (ASR, CO) || I0 += M0 (BREV) || [I2++] = R3; R0 = R0 +|+ R6, R6 = R0 -|- R6 (ASR) || R2 = [I0] || [I2++] = R4; R7 = R1 +|- R7, R1 = R1 -|+ R7 (ASR) || I0 += M0 (BREV) || [I2++] = R5; R3 = [I0] || [I2++] = R0; I0 += M0 (BREV) || [I2++] = R1; R4 = [I0] || [I2++] = R6; Stage12_end:I0 += M0 (BREV) || [I2++] = R7; ESC_12: R2 = R2 +|+ R3, R3 = R2 -|- R3 (ASR) || I0 += M0 (BREV) || R5 = [I0]; R4 = R4 +|+ R5, R5 = R4 -|- R5 (ASR, CO) || I0 += M0 (BREV) || R0 = [I0]; R2 = R2 +|+ R4, R4 = R2 -|- R4 (ASR) || I0 += M0 (BREV) || R1 = [I0]; R5 = R3 +|- R5, R3 = R3 -|+ R5 (ASR) || I0 += M0 (BREV) || R6 = [I0]; R0 = R0 +|+ R1, R1 = R0 -|- R1 (ASR) || [I2++] = R2 || R7 = [I0]; R6 = R6 +|+ R7, R7 = R6 -|- R7 (ASR, CO) || [I2++] = R3 || NOP; R0 = R0 +|+ R6, R6 = R0 -|- R6 (ASR) || [I2++] = R4 || NOP; R7 = R1 +|- R7, R1 = R1 -|+ R7 (ASR) || [I2++] = R5 || NOP; [I2++] = R0; [I2++] = R1; [I2++] = R6; [I2++] = R7; R1 = P1; //R1 = wst. R1 = R1 << 2; //R1 = wst * 4 P3 = 4; //P3 holds the number of lines in each butterfly at stage 3. R7 = P5; R7.L = R1.L * R7.L (IS); //R7 = wst * 4 * twiddle offset R2 = P4; R3 = 8; CC = R2 == R3; //If input array size is equal to 8, then go to last stage, because If CC Jump Esc_mid; //middle stages does n't occur. R0 = 0; //Counter for number of stages. Find_m: //The computation of number of stages is done here. R2 >>= 1; R0 += 1; CC = R2 == R3; If !CC Jump Find_m; //R0 holds the value of m-3 and is never free Loopfor_m: I0 = B0; I2 = B2; I3 = B2; //Address of output array. P0 = P3 << 2; M2 = P0; //M2 holds the offset of counterpart line. P0 += -4; M0 = P0; P5 = P5 >> 1; R7 = R7 >>> 1 || I3 += M2 || NOP; M1 = R7; P3 += -1; lsetup(Loop1_strt, Loop1_end) LC0 = P5; //Loop is set for number of the butterfly Loop1_strt: I1 = B3; //Address of twiddle factor. R2 = [I2++]; R3 = [I1++M1] || R4 = [I3++]; lsetup(Loop2_strt, Loop2_end) LC1 = P3; //Loop is set for the number of lines Loop2_strt: R5 = R2 +|+ R4, R6 = R2 -|- R4 (ASR) || R3 = [I1++M1] || R4 = [I3++]; //R3 = [P0++P2]; A1 = R3.L * R4.H, A0 = R3.L * R4.L || [I0++M2] = R5 || R2 = [I2++]; Loop2_end:R4.H = (A1 += R3.H * R4.L), R4.L = ( A0 -= R3.H * R4.H) || I0 -= M0 || [I0] = R6; R5 = R2 +|+ R4, R6 = R2 -|- R4 (ASR) || I2 += M2 || NOP; I3 += M2 || [I0++M2] = R5; Loop1_end: [I0++] = R6; P3 += 1; P3 = P3 << 1; R0 += -1; B1 = B0; B0 = B2; B2 = B1; CC = R0 == 0; If !CC Jump Loopfor_m; //Loop for m. Esc_mid:I0 = B0; I2 = B2; I3 = B2; //Address of output array. P0 = P3 << 2; M2 = P0; //M2 holds the offset of counterpart line. P0 += -4; M0 = P0; R7 = R7 >>> 1 || I3 += M2 || NOP; M1 = R7; P3 += -1; I1 = B3; //Address of twiddle factor. R2 = [I2++]; R3 = [I1++M1] || R4 = [I3++]; lsetup(Last_strt, Last_end) LC1 = P3; //Loop is set for the number of lines Last_strt: R5 = R2 +|+ R4, R6 = R2 -|- R4 (ASR) || R3 = [I1++M1] || R4 = [I3++]; A1 = R3.L * R4.H, A0 = R3.L * R4.L || [I0++M2] = R5 || R2 = [I2++]; Last_end:R4.H = (A1 += R3.H * R4.L), R4.L = ( A0 -= R3.H * R4.H) || I0 -= M0 || [I0] = R6; R5 = R2 +|+ R4, R6 = R2 -|- R4 (ASR) || NOP || NOP; [I0++M2] = R5; [I0] = R6; R0 = B0; R1 = M3; CC = R0 == R1; If CC Jump Terminate; I0 = B0; I1 = M3; R0 = [I0++]; lsetup(Copy_strt, Copy_strt) LC0 = P4; Copy_strt: [I1++] = R0 || R0 = [I0++]; (R7:4, P5:3) = [SP++]; //Pop the registers before returning. RTS; //Return.