Chapter 5
Generated Code Architecture
5-2
ni.com
Signal Naming
A signal in the diagram is represented as a variable in the generated code.
Within the diagram, signals can have two names: a
label
and a
name
. The
signal’s label can appear in the diagram while a signal’s name does not
appear. If a signal has both a label and a name, AutoCode uses the name to
generate the symbolic name in the generated code. If there is only a label
or a name, AutoCode uses whichever one is specified. If you specify
neither a label nor a name, then AutoCode uses a default name.
Duplicate Names
There is no restriction in the model diagram about reusing the same names
over and over again. However, AutoCode must make sure that the symbolic
names in the generated code are unique. AutoCode solves this problem by
mangling the name of duplicates, that is, appending a suffix to the original
name to preserve uniqueness.
Selection of a Signal Name
In a model diagram, there might be many levels of hierarchy represented as
nested SuperBlocks. SuperBlocks of the same rate are combined into
subsystems and thus are effectively optimized away. Refer to the
section for more information. Given that, the labels specified at
the boundary of SuperBlocks are not used. If they were, there would be
extra copies of data because of a name change, which would not represent
optimal code generation. Therefore, within a hierarchy of SuperBlocks, the
label/name from the block that computes the signal is used as the symbolic
name of the variable.
Subsystem and Procedure Boundaries
There are times when the names at the SuperBlock boundary are used. The
names are used only when a definitive interface is created by a SuperBlock.
This occurs when the SuperBlock represents a subsystem boundary or a
Procedure SuperBlock.
Typecheck Feature and Data Types
The Typecheck feature of the SystemBuild Analyzer directly impacts the
data types for signals generated by AutoCode. When the feature is enabled,
data types that are specified in the model diagram will be used in the
generated code. If the feature is disabled, all data types will be considered
float.