AnsweredAssumed Answered

Question about the "CopyFloat2Fix" and the "CopyFix2Float" function

Question asked by liangbread on Feb 4, 2015
Latest reply on Feb 23, 2015 by JJoseph

Hi everyone,


I am now got a few questions about the two function of "CopyFix2Float" and "CopyFix2Float" in the application code.This two function are written in assembly and invoked by C languange.After reading the assembly source code,I am puzzled with the logically shifting and the scaling operation in the two functions,which you can see in the following snippets.





  r4=lshift r2 by 8;

  f8= FLOAT r4 BY r1,r2=dm(i5,m4);





  b12 = r10; /* b4 is a scratch register */





  lcntr=r12, do (pc,CopyFloat2Fix_loop_end) until lce;

  r2=trunc f8 by r1;

  r4=clip r2 by r10, r8=dm(i5,m4);

  comp(r4,r2), dm(i4,m3)=r4;



1)Does the operation have relation to the data format communicating with ADC and DAC,such as the right justified and left justified of 24bits significant data per word?


2)What is the main purpose to take the logically shifting and scaling as you can see in the former "CopyFix2Float" function snippet?


3)I just consider the "r4=lshift r2 by 8;" is redundant,the function may be  more simply realized as you can see below.Is it right?




f8= FLOAT r2 BY r1,r2=dm(i5,m4);


4) From the two functions,I think audio data format processed in Sharc is Q23 format.The fixed point data incoming from the ADC is converted to float point data with scaled  by 2^-23,and after processed,data get transfered out with fixed-point processed and scaled by  2^23.Is it right?


Best Regards,