Kilohercas

CrossCore Embedded Studio vs. VisualDSP++ Compiler Efficiency

Discussion created by Kilohercas on Aug 3, 2013
Latest reply on Aug 14, 2013 by CraigG
Branched from an earlier discussion

Just wondering, does VisualDSP++ and CrossCode have same compiler efficiency ? (or i miss some compiler options to enable)

 

Same code for VisualDSP++ runs at 900KHz  but compiled on CrossCode with same optimization runs just over 530KHz. Also VisualDSP++ code runs with no glitches, but CrossCode have some strange behavior

 

     int i = 0;

    asm("bit set FLAGS FLG1O;");

    asm("bit set FLAGS FLG0O;");

    while(i<128)

    {

        sinusas[i]=sinf(0.4908738521f*i);

        cosinus[i]=cosf(0.4908738521f*i);

        i++;

    }

    i=0;

    while(i<256)

    {

        adc[i]=(int)(32767.0f+32765.0f*cosf(0.4908738521f*i));

        i++;

    }

    while(1)

    {

        i=0;

        real = imag = 0;

        while(i<128)

        {

            real+=adc[i+offset]*cosinus[i];

            imag-=adc[i+offset]*sinusas[i];

            i++;

        }

        if(Faze(imag,real)>0)

        {

            asm("bit clr FLAGS FLG0;");

        }

        else

        {

            asm("bit set FLAGS FLG0;");

        }

        asm("bit tgl FLAGS FLG1;");

        if(offset>13)

            offset=0;

        else

            offset++;

    }

This should give square wave in FLG0 because of linear phase shift (made by offset, it gives 2pi phase shift) in single point DFT calculation, but it produces many glitches

Outcomes