This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Modifying RFFT_f32 mag and RFFT_f32_phase functions on F28335

Hi all,

I'm doing a project that use FFT. I have been working with the example from FPU library ("2833x_RFFT_ADC_f32") and the results are very good with 128 samples.  In order to minimize computational load and storage, I think I could modify RFFT_f32_mag and RFFT_f32_phase funtions due to I don't need all N/2 values that come from them and I only need the first 32 (N/4) values. Unfortunately, I dont know asembly lenguage and I dont know how do it. Could anyone help me out? 

This is the soude codes.

RFFT_f32_phase.asm

RFFT_f32_mag.asm

  • Hello,

    Our team’s expert on the FPU Library is currently on vacation. He can give better answers on questions specific to the FFT functionality when he's back in the office.

    As far as learning Assembly language, I recommend reading the C28x Assembly User’s Guide found at: www.ti.com/.../spru513k.pdf
    and finding online resources on programming in Assembly.

    To do a divide by 4, you would shift right by 2. For a divide by 2, it is a right shift of 1.

    Elizabeth

  • For the mag function change the loop count to FFTSize/8

    ;--- Calculate main loop count
            MOV      AL, *+XAR4[0]        ; AL = FFTSize
            LSR      AL, #3               ; AL = FFTSize/8
            SUBB     AL, #2               ; mag[0:1] handled seperately, and "N-1" 
                                          ; loop count so subtract 2

    you will also need to comment out the portion that computes mag[N/2+1] as the pointer will be incorrect

    ;--- Mag[N/2+1] is handled special since no Im part
            MOV32    R0H, *XAR6++         ; R0H  = Re[N/2+1]
            ABSF32   R0H, R0H             ; R0H  = abs(Re[N/2+1])
            MOV32    *XAR5++, R0H         ; Store mag[N/2+1]

    For phase you need to change the loop count as follows

    ;--- Calculate main loop count
            MOV      AL, *+XAR4[2]          ; AL = FFTSize
            LSR      AL, #2                 ; AL = FFTSize/4
            SUBB     AL, #2                 ; phase[0] handled separately (subtract 1)
                                            ; loop counter is "N-1" (subtract 1)
            MOV      AR4, AL                ; AR4 = calc_phase counter