AnsweredAssumed Answered

ADSP-21489 Fixed to Float asm code mistake

Question asked by Nico on Feb 9, 2017
Latest reply on Feb 16, 2017 by Hfuhrhurr

Hello,

I tried to write a peace of asm code using Fn = Rx FLOAT by Ry function and only scratch registers  in order to convert Fixed point data block  to floating point data block quickly than this C code without save registers:

--------------------------------------------------------------------------------------------------------------------------------------------------------------

HERE C CODE OK

void    Block_Fixed_To_Float_IIR( int * Fixed_In, float * Float_Out_L, float * Float_Out_R )

{

    int i;

    for (i=0;i<AUDIO_BLOCK_SIZE;i++)

    {

        Float_Out_L[i]  = ((float) (Fixed_In[2*i]))   * (1.0/2147483648.0);

        Float_Out_R[i]  = ((float) (Fixed_In[2*i+1])) * (1.0/2147483648.0);

    }

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

 

My asm code is the following but when I compiled it, I have an error message  corresponding to line :

dm(i12,m4) = f4;        // store Float_L + inc

dm(i13,m4) = f4;        // store Float_R + inc

 

and... I couldn't see what's wrong.

Thanks for your help.

Nicolas

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

HERE ASM CODE DOESN'T WORK

// Assembly Routines  _block_fix_float
// void block_fix_float (int block_Lenght, int Fixed_in, float Float_out_L , float Float_out_R);
//An assembly language subroutine to convert fixed data block to Float L and R channels

 

#include <asm_sprt.h>
.section/pm seg_pmco;
.global _block_fix_float;

_block_fix_float:

leaf_entry;

 

// the calling routine passes the first three parameters in registers
// r4, r8, r12

 

r4=r4-1;               // Load    Block_Lenght -1 in r4
b4  = r8;               // Load adress vector fixed_int
b12 = r12;            // Load adress vector float_out_L
r8  = reads(1);      // Put  adress vector float_out_R in r8
b13 = r8;               // Load adress vector float_out_R
i4=0;
i12=0;
i13=0;
m4 = 1;

r0 = -31;

nop;

lcntr=r4, do dot_loop until lce;
                        r1 = dm(i4,m4);            // load fixed_L + inc
                        f4 = FLOAT r1 by r0;    // conv fixed_L to Float_L
                        dm(i12,m4) = f4;        // store Float_L + inc
                        r1 = dm(i4,m4);            // load fixed_R + inc
                        f4 = FLOAT r1 by r0;    // conv fixed_R to Float_R
dot_loop:         dm(i13,m4) = f4;        // store Float_R + inc

 

leaf_exit;

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Outcomes