beautypg.com

Global variable block and %var equivalence, Optimization for read-from variable blocks, Global scope signal capability – National Instruments AutoCode NI MATRIX User Manual

Page 112: Global scope signal capability -4

background image

Chapter 5

Generated Code Architecture

AutoCode Reference

5-4

ni.com

Write-To Variable Block (ALL Addressing mode)—These blocks
execute after all other types of blocks within the subsystem, procedure
or sequence frame.

Read-From/Write-To Variable Block (Element/Bit Addressing
modes)
—These variants to access variable block information are
sequenced just like any other block; that is, it is sequenced after its
inputs have been computed.

Global Variable Block and %var Equivalence

If a Global Variable Block and a %var use the same name, only one
variable is generated and that variable will be used for all instances of the
%var and Variable Block.

Optimization for Read-From Variable Blocks

AutoCode supports an optimization for Read-From Variable Blocks
(Global and Local) that eliminates the copy and directly accesses the local
or global variable. This optimization is optional and the optimization of
global and local variable blocks can be separately controlled. Global
variable block optimization works only if variable blocks are not shared
between multiple subsystems and when the

-vbco

option is not used.

Global Scope Signal Capability

The memory and performance requirements of real-time production code
force the issue of global variables. AutoCode does not generally use global
variables; rather, it creates and uses stack variables and explicit interfaces.
While that architecture is perfectly sound, it does cause overhead in a
production system. Therefore, AutoCode supports direct use of global
variables for local block outputs within a subsystem. Extending that
concept allows global variable(s) to be used as the inputs and outputs of a
procedure.

Chapter 9,

Global Scope Signals and Parameterless Procedures

, provides

information about using global scope signals and using global variables as
the input(s) and output(s) of a procedure. Such a procedure is called a
parameterless procedure.