Chapter 6
Vectorized Code Generation
©
National Instruments Corporation
6-15
Note
The examples within this section assume maximal vectorization unless otherwise
noted.
Multiple Arrays within a Block
All blocks support multiple vectors (arrays) as both outputs and inputs.
However, depending on exactly how the signals are connected and the
algorithm, loops might not be generated as expected. Generally speaking,
as long as multiple arrays are connected contiguously to the inputs of the
block, loops are possible. For example, examine the model in Figure 6-3
and the generated code in Example 6-6.
Figure 6-3.
Multiple Array Mode
Example 6-6
Multiple Array Code (for Figure 6-3)
void subsys_1(U, Y)
struct _Sys_ExtIn *U;
struct _Subsys_1_out *Y;
{
static RT_INTEGER iinfo[4];
/***** Parameters. *****/
static RT_FLOAT R_P[20];
RT_INTEGER cnt;
static const RT_FLOAT _R_P[20] = {1.2, 2.3, 3.4, 4.5, 5.6,
1.2, 2.3, 3.4, 4.5, 5.6,