National-instruments AutoCode NI MATRIX Manual de usuario Pagina 140

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 250
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 139
Chapter 5 Generated Code Architecture
AutoCode Reference 5-32 ni.com
FOR Loop—Can generate either a rolled or unrolled loop depending
upon the range of the loop subscript and whether or not scalar code is
generated.
Examples of Rolled and Unrolled Loops
Example 5-12 Unrolled Loop from Example 5-9
/***** Output Update. *****/
/* ---------------------------- BlockScript Block */
/* {bsb..2} */
bsb_1 = indata_1 * 2;
bsb_2 = indata_2 * 4;
bsb_3 = indata_3 * 6;
bsb_4 = indata_4 * 8;
bsb_5 = indata_5 * 10;
Example 5-13 Rolled Loop from Example 5-10, Using Vectorized Code
/***** Output Update. *****/
/* ---------------------------- BlockScript Block */
/* {bsb..4} */
for(j=1; j <= indata[0]; j++) {
bsb[-1+j] = indata[-1+j] + j;
Table 5-4. Scalar Code Semantics for the Loop Types
Loop Type Soft-Subscript Rolled Loop
WHILE
Not for inputs,
outputs, or
states
Always
FOR
Not for inputs,
outputs, or
states
No, unless the bounds of the loop are
known and only local variables are
used in the loop body
Table 5-5. Vectorized Code Semantics for the Loop Types
Loop Type Soft-Subscript Rolled Loop
WHILE
Not for inputs,
outputs, or states
Always
FOR
Yes Yes
Vista de pagina 139
1 2 ... 135 136 137 138 139 140 141 142 143 144 145 ... 249 250

Comentarios a estos manuales

Sin comentarios