Timer Bug

For general discussion related FlowStone
User avatar
HughBanton
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire
Contact:

Re: Timer Bug

Post by HughBanton »

In this instance, in the line "levelOut = 0 + (levelIn > threshold & 1);", you don't need the '0'.

Declared streamins, streamouts and floats are all treated as variables, and are initialised to 0 unless you specify otherwise, as you have done here with "float _F_1=1".

In ASM watch out that you don't send a previously uninitialised xmm register to a streamout. It's OK here because of "movaps xmm0,levelIn;", which ensures that xmm0 always gets a value, 0 or otherise, before the cmmps comparison.

So:

streamin levelIn; //<------ DSP code
streamin threshold;
streamout levelOut;
levelOut = levelIn > threshold & 1;

streamin levelIn, threshold; //<------ ASM converted
streamout levelOut;
float _F_1=1;
movaps xmm0,levelIn;
cmpps xmm0,threshold,6;
andps xmm0,_F_1;
movaps levelOut,xmm0;

Every prune helps!

H
Post Reply