NI MATRIXx Reference Manual

© National Instruments Corporation 6-1 AutoCode Reference
6
Vectorized Code Generation
This chapter discusses various ways to generate vectorized code.
This includes describing the options available, design guidelines,
and implementation details about the vectorized code.
Introduction
AutoCode has the capability to generate vectorized code. The default code
generation style, however, remains to be all scalars. Vectorized code has
two attributes:
Signals are represented as arrays instead of scalars in the generated
code
Algorithms use loops to roll the code into a compact algorithm
Some of the benefits of vectorized code generation include:
Smaller source size
Smaller object code size
Efficient implementation of large systems
Loops with general BlockScript blocks
Mixed scalar and vectorized code within the same model
You do not have to change your pre-release 7.x SystemBuild models to get
the benefits of vectorization. AutoCode implements all of the standard
block algorithms in a vectorized way that can be realized in MATRIXx 7.x
and later. Of course, a model designed specifically to take advantage of
vectorized code will perform better than one designed for scalar code.
How Code Is Generated
This section introduces the look of vectorized code by comparing the
code to the equivalent scalar code. The gain block illustrates most of the
concepts of vectorized code generation. For this example, assume a
10 input/output gain block with various gain parameters connected directly
to the subsystem external input and output.