Chapter 9
Global Scope Signals and Parameterless Procedures
©
National Instruments Corporation
9-7
Condition Block Code Generation
The Condition Block supports the use of parameterless procedures. In the
nodefault and sequential modes, the Condition Block will not buffer the
global outputs of the procedure into the
R_P
(real parameter) array. For
information about Condition Blocks, refer to the
section
of Chapter 5,
Reusing a Parameterless Procedure
A parameterless procedure is a procedure that uses a set of global variables
as its interface rather then a formal argument list. Therefore, you can
reuse—that is, use the procedure in more than one place—but you must
make sure that source blocks for the Global Scope inputs use the correct
global variable. When you reuse a parameterless procedure, there now are
multiple writers to the same global variable and, therefore, the sequencing
of the blocks can unexpectedly affect the value of the global variable.
Note
If you intend to reuse a parameterless procedure, make sure that the sequencing of
the blocks that write into the global variables is correct. Also, keep in mind the same
problem with using the global outputs of the procedure as well.
Generating Code for Parameterless Procedures
The only difference between the code of a parameterless procedure and one
that does not use this feature is that not all of the inputs and outputs of the
procedure will be formal arguments of the procedure. Global variables are
generated when referring to a procedure’s inputs and/or outputs. As global
variables used for a parameterless procedure require visibility over all
subsystems and procedures, these variables are associated with the whole
model. The set of TPL tokens to access this information is therefore within
the SYSTEM scope. Refer to the
Template Programming Language User
Guide
for more information about these tokens.
The default template uses the following tokens to declare the variables.
sgtype_nmembers_i
sgtype_b
sgtype_members_ls
sgtype_members_size_li
sgtype_members_typ_pfix_ls
sgtype_members_typ_li
sgtype_members_memaddr_ls
sgtype_blk_channel_list_li
sgtype_blk_list_li
sgtype_blk_list_idx_li