User Guide
DSP Code Component
%
Calculates the remainder after dividing the left-hand side by the
right-hand side
>
>=
<
<=
Comparison operators
These generate a mask based on the result of the comparison
&
Bitwise AND operator. Use this to apply a mask
One limitation of the code component is that you can only have 8 successive operations in an expression. For example, the expression:
a = 0+1+2+3+4+5+6+7+9+10;
is not allowed because there are 9 addition operations in a row. You can easily get round this by splitting the expression up into smaller
sections using brackets ‘(‘ and ‘)’. For example:
a = (0+1+2+3+4)+(5+6+7+9+10);
Conditional Statements
Because FlowBotics Studio uses SSE to process four channels at a time, conditional statements can't be implemented in the traditional way.
However, you can achieve the effect of a conditional statement by using a mask.
A mask can be applied to all four channels at the same time. Each channel is affected differently. FlowBotics Studio includes conditional
operators that generate exactly these kind of masks.
For example, the following FlowBotics Studio code:
x = x - (x >= 1) & 1.0;
is equivalent to the following C/C++ code:
if( x >= 1 ) x = x – 1.0;
The >= operator creates a mask. The mask will effectively be true for each channel that meets the condition and false for each one that
doesn't. The bitwise & will return a value of 1.0 or 0.0 for each SSE channel based on the mask.
Comments
You can leave comments in your code. These are just snippets of text that remind you of what a particular part is doing. Comments take up
no processing time. They can be put at the end of a line or they can have a whole line to themselves
For example:
index = index + 1; //Increment index
//Increment index
index = index + 1;
177 of 212