Pass fixed-size scalar root inputs by value for code generation
Description
Specify whether a model that references this model passes its scalar inputs to this model by value.
Category: Model Referencing
Settings
Default: Off (GUI), 'on'
(command-line)
On
A model that references this model passes scalar inputs to this model by value.
Off
The parent model passes the inputs by reference (it passes the addresses of the inputs rather than the input values).
Tips
This option is ignored in either of these two cases:
The C function prototype control is not the default.
The C++ encapsulation interface is not the default.
Passing root inputs by value allows this model to read its scalar inputs from register or local memory, which is faster than reading the inputs from their original locations.
Enabling this parameter can result in the simulation behavior differing from the generated code behavior under certain modeling semantics. Simulink® reports cases where the modeling semantics may result in inconsistent behaviors for simulation and for generated code. If the diagnostic identifies an issue, latch the function-call subsystem inputs. For more information about latching function-call subsystems, see Context-dependent inputs.
If the Context-dependent inputs diagnostic reports no issues for a model, consider enabling the Pass fixed-size scalar root inputs by value for code generation parameter, which usually generates more efficient code for such a model.
If you have a Simulink Coder™ license, selecting this option can affect reuse of code generated for subsystems. See Generate Reentrant Code from Subsystems (Simulink Coder) for more information.
For SIM targets, a model that references this model passes inputs by reference, regardless of how you set the Pass fixed-size scalar root inputs by value for code generation parameter.
Command-Line Information
Parameter:ModelReferencePassRootInputsByReference |
Value:
'on' | 'off' |
Default:
'on' |
Note
The command-line values are reverse of the settings values. Therefore,
'on'
in the command line corresponds to the description
of “Off” in the settings section, and 'off'
in
the command line corresponds to the description of “On” in the
settings section.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No recommendation For the diagnostic action to take when the software has to compute the input to a function-call subsystem, see Context-dependent inputs. |