Chapter 6 Vectorized Code Generation
AutoCode Reference 6-22 ni.com
Figure 6-6. Copy-Back Example
Example 6-9 Generated Code (for Figure6-6)
void subsys_1(U, Y)
struct _Sys_ExtIn *U;
struct _Subsys_1_out *Y;
{
/****
some code deleted
****/
/***** Output Update. *****/
/* ---------------------------- Gain Block */
/* {gain.top.2} */
for (i=1; i<=5; i++) {
top[-1+i] = R_P[-1+i]*U->gain_1[-1+i];
}
/* Copy back(s) and/or duplicate(s) */
{
RT_INTEGER k=0;
for( k=0;k<2;k++ ) {
Y->top[k] = top[(k*3)+1];
}
}
Copy-backs are coupled with handling duplicate external outputs, meaning that a block output is connected to more than one external output pin. The example in Figure6 -6 just contains a copy-back. The copy-back/duplicate copies, if needed, will appear at the very end of the subsystem.