Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-7 AutoCode Reference/* ---------------------------- Gain Block *//* {gain..2} */Y->gain_2_1[0] = 1.2*U->gain_1[0];Y->gain_2_1[1] = 2.3*U->gain_1[2];Y->gain_2_1[2] = 3.4*U->gain_1[3];Y->gain_2_1[3] = 4.5*U->gain_1[5];Y->gain_2_1[4] = 5.6*U->gain_1[6];This example shows that the penalty for poor connectivity can be great.In this case, the vectorized code is not an improvement over scalar code.Vectorization ModesAutoCode supports two vectorization modes in addition to the defaultscalar code generation. All three modes are controlled by onecommand-line option, -Ovn, wheren is the mode. The vectorizationmodes allow the same model to be code generated in several ways to suiteyour particular goals. The following sections briefly describe each mode.Maximal VectorizationMaximal vectorization (mode -Ov 2) is one of two vectorization modessupported by AutoCode. Maximal vectorization is defined by placing all ofthe outputs of a block into one or more arrays. For most blocks, only onearray is needed because the block can only have one output data type. Forblocks with more than one output data type, more than one array is used.External inputs also are formed into arrays and like the basic block, ifmixed data types are used, multiple arrays are generated.The names of the arrays are taken from the label/name of the first signalbundled into the array. As a result, maximal vectorization might notproduce generated code that is very traceable back to the diagram. Thisvectorization mode is to provide a quick way to get vectorized code withouthaving to examine your model’s design and tune it for efficient code.Mixed VectorizationThis vectorization mode (mode -Ov 1) allows for both scalar and vectorcode generation within the same system. This mode also is calledvector-by-label because the labels/names of the signals determine if avector is generated.