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.

C2000芯片浮点运算效率IQ和float那个高?

Other Parts Discussed in Thread: TMS320F28335

与TMS320F28335芯片类似的含有FLoat运算模块的芯片中,使用IQ格式数和直接使用float格式数相比,在计算乘除法运算过程中,哪个速度更快呢?

  • Eric,我看了一下你的测试代码,我觉得你的测试还是有点偏向float计算了。

     // fpu test
       Uint32 temp = 0;
       float result =0;
       _iq result1 ;
       _iq temp1;            //断点  clock 清零
       result = 0.12*0.12;
       result = 0.12*0.12;
       result = 0.12*0.12;
       result = 0.12*0.12;
       result = 0.12*0.12;
       temp = 1;           // 断点 clock = 12; 所以使用FPU单元,计算5条乘法指令为12个系统时钟; clock 清零
      temp1=_IQ(0.12);  // gloable IQ = 24
      result1 = _IQmpy(temp1,temp1);
      result1 = _IQmpy(temp1,temp1);
      result1 = _IQmpy(temp1,temp1);
      result1 = _IQmpy(temp1,temp1);
      result1 = _IQmpy(temp1,temp1);
       temp = 2;    // 断点  clock = 28 ; 使用IQmath库进行运算,使用28个时钟; clock清零

       result = 0.125*0.12;
         result = 0.125*0.12;
         result = 0.125*0.12;
         result = 0.125*0.12;
         result = 0.125*0.12;
         temp = 1;      // 断点 clock = 12;clock 清零
        temp1=_IQ(0.12);
        result1 = temp1>>3;
        result1 = temp1>>3;
        result1 = temp1>>3;
        result1 = temp1>>3;
        result1 = temp1>>3;
         temp = 2;    // 断点 移3位时clock = 17; 若只移1位 clock =9;

     

    float计算你是直接使用0.12*0.12,而测试IQ则是_IQmpy(temp1,temp1);

    如果float计算你也是通过变量tempf=0.12 ,result=tempf * tempf 我想结果就不会是这样了