Vector labels and names, Example, Vector labels and names -8 – National Instruments AutoCode NI MATRIX User Manual

Page 171: Example -8

Advertising
background image

Chapter 6

Vectorized Code Generation

AutoCode Reference

6-8

ni.com

Vector Labels and Names

The SuperBlock Editor lets you give a name to a range of signals using a
special notation. The Editor then repeatedly applies that name to the range.
AutoCode interprets this type of labeling as a definition of which pins are
to be an array. For more information about vector labeling, refer to the
SystemBuild User Guide.

The editor lets you use a vector label more liberally than what makes sense
for code generation. The following restrictions apply to a vector label when
being translated into code. If the labeling of the diagram does not conform,
AutoCode creates the arrays as best it can by mangling the name where it
sees fit.

A vector must start at index 1.

A vector cannot span different data types.

A vector must be a range of contiguous pins.

A vector can only be defined from one block, either a basic block’s
outputs, top-level SuperBlock inputs, or subsystem/procedure
boundary.

A signal with an empty label/name is generated as a scalar.

Example

Figure 6-2 shows a good example of a vectorized algorithm, although it
does not do anything significant. Both the maximal and mixed-mode code
generation also is provided in Example 6-4 and Example 6-5, respectively.
Notice that the diagram is shown with all labels shown for each pin—even
those pins with a vector label—so you can trace the signals within the code.

In the model, notice that the outputs of the gain block are using scalar
labels. Therefore, when generated for maximal Vectorization, the array will
be named Throttle. When generated in mixed mode, you will see all five
distinct outputs of that block. Notice how that choice prevents the gain
block and time delay block from vectorizing. Notice that in either mode,
block states are always a vector.

Advertising