Page 1 of 1

Bool Help Please

Posted: Wed Sep 23, 2015 8:43 pm
by BobF
Bool Help.fsm
(51.64 KiB) Downloaded 769 times

Hello Gang,

Again I need a little help! Why does the 7 input (or lower) AND gate work, but 8 or more inputs do NOT. This is probably something really simple , yes?

At this time I need the 8 input AND gate to work for me.

Many thanks in advance!

Later then, BobF.....

Re: Bool Help Please

Posted: Wed Sep 23, 2015 9:00 pm
by KG_is_back
It is a limitation of the DSP code - you can't have more than 8 operations in the same line. It is explained in the manual... Just put few parentheses between the and statements.

Re: Bool Help Please

Posted: Wed Sep 23, 2015 10:16 pm
by Nubeat7
the reason for it is that the dsp code gets translated to assembler code where it produces a lot of (often unneeded) register movings

Code: Select all

movaps xmmB,xmmA
, after you only have 8 registers it gets fucked up when you do more then 8 operations in a row..

connect a text primitive to the "c" output of the dsp code primitive and you will find

Code: Select all

xmm999
which shows you that you are out of the valid registers 0-7

make the parentheses KG assumed and watch again, now only the registers from xmm0-xmm7 are used and it works

further you can copy the text code into an assembler code primitive and optimize it, there you can get rid of the most movaps and end up like this

Code: Select all

streamin in1;streamin in2;
streamin in3;streamin in4;
streamin in5;streamin in6;
streamin in7;streamin in8;

streamout out;

float F1=1;

movaps xmm0,in1;
andps xmm0,in2;
andps xmm0,in3;
andps xmm0,in4;
andps xmm0,in5;
andps xmm0,in6;
andps xmm0,in7;
andps xmm0,in8;
cmpps xmm0,F1,0;
movaps xmm1,F1;
andps xmm1,xmm0;
movaps out,xmm1;


with this version of the code you can add as many inputs you want with just appending the

Code: Select all

streamin inX;
and

Code: Select all

andps xmm0,inX;
before the cmpps...

if the chain is very long it maybe would make sense to use more registers to check up to 7 groups in parallel for faster processing.