National-instruments AutoCode NI MATRIX Manuel d'utilisateur Page 188

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 250
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 187
Chapter 6 Vectorized Code Generation
© National Instruments Corporation 6-25 AutoCode Reference
top[-1+i] = R_P[-1+i]*U->gain_1[-1+i];
}
/* ---------------------------- Procedure Super Block */
/* {vecproc.3} */
vecproc(&top[0], &Y->vecproc_3_1[0], &vecproc_3_i);
iinfo[0] = vecproc_3_i.iinfo[0];
if( iinfo[0] != 0 ) {
vecproc_3_i.iinfo[0] = 0; goto EXEC_ERROR;
}
A vectorized procedure interface suffers from a form of the copy-back
problem. When using the vectorized interface, each time the procedure is
called, the inputs and outputs must be an array. Therefore, if an array is not
connected as the input or output, AutoCode must generate code to copy
data into a temporary array and then pass that array. In other words, if the
inputs and/or outputs are not connected to naturally conform to a vector
interface, the copies required might add significant overhead to the
procedure call, eliminating the benefits of the vectorized interface.
Ada Array Aggregates and Slices
All of the examples presented include generated C code. AutoCode will
generate the equivalent Ada code, except that use of array aggregation and
slices are used when possible. Example 6-11 is the equivalent Ada code for
a diagram previously shown in Figure 6-2.
Note Only the relevant subsystem code is listed.
Example 6-11 Ada Generated Code (for Figure 6-2)
procedure subsys_1 is
------ Local Block Outputs. ------
Throttle : RT_FLOAT_AY(0..4);
------ Algorithmic Local Variables. ------
i_1 : RT_INTEGER;
j : RT_INTEGER;
k_1 : RT_INTEGER;
begin
-------- Initialization. --------
if SUBSYS_PREINIT(1) then
iinfo(0..3) := (0,1,1,1);
Vue de la page 187
1 2 ... 183 184 185 186 187 188 189 190 191 192 193 ... 249 250

Commentaires sur ces manuels

Pas de commentaire