beautypg.com

Chapter 6 vectorized code generation, Introduction, How code is generated – National Instruments AutoCode NI MATRIX User Manual

Page 164: Introduction -1, How code is generated -1, Er 6, Vectorized code generation, Vectorized, Code generation

background image

© 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.