External Outputs; Copy-Back - National Instruments AutoCode NI MATRIX Reference

National instruments ni matrixx reference manual
Table of Contents

Advertisement

External Outputs

© National Instruments Corporation
You should notice two things in the code shown in Example 6-8. First,
the gain block added to merge the data is generated as copies from the
respective inputs into the single array. Second, the integrator block is
tightly rolled. If the merge was not present, the Integrator would have been
unrolled, causing a 6-fold increase in the amount of code for that block.
The only reason to introduce a merge block (unit gain block) is when the
cost of unrolling the algorithm of your block—in this case the integrator
block—is more expensive then the merge block. It can be seen from the
code that the cost of a merge block is a copy in a local array. Because the
integrator algorithm is complicated, it is necessary to have the merge so that
the integrator is rolled.
AutoCode will not automatically introduce the merge (copy) just to
improve vectorization. The reason is that traceability from the code to
model is reduced anytime extra code other than the block algorithm is
generated. Also, AutoCode is not able to evaluate the design decision to
make one block rolled at the expense of another. Therefore, for optimal
vectorization, you might need to change your model.
Another variation of the split-merge problem appears with external outputs.
External outputs are represented by the
signals marked as external outputs. For scalar code generation, AutoCode
directly uses the symbol in the
However, when the output of a block is a vector and only a subset of the
outputs are connected to external outputs, a conflict of requirements
appears between storing the block output into an array and optimizing
access to external output.

Copy-Back

When a split-merge occurs with external outputs, AutoCode must act to
preserve the semantics of the model. AutoCode has been designed to
preserve the array, and therefore the block vectorization and copy-back
those external outputs from the array into the
shown in Figure 6-6, a simple gain block has only two of its five outputs
connected to the external output. AutoCode preserves the array for the gain
block, but copies the pieces of the array that are external output into the
-structure.
Y
Chapter 6
-structure. It contains only those
Y
-structure instead of using local storage.
Y
6-21
Vectorized Code Generation
-structure. In the example
Y
AutoCode Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AutoCode NI MATRIX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Autocode ni matrixx

Table of Contents