Documentation

Pass fixed-size scalar root inputs by value for code generation

Description

Specify whether a model that calls (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 calls (references) this model passes scalar inputs to this model by value.

Off

The calling 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. If you use the default setting ofEnable all as errorsfor theConfiguration Parameters>Diagnostics>Connectivity>Context-dependent inputsparameter, then 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, seeContext-dependent inputs.

  • If the Context-dependent inputs diagnostic reports no issues for a model, consider enabling thePass fixed-size scalar root inputs by value for code generationparameter, which usually generates more efficient code for such a model.

  • If you have aSimulink Coder™license, selecting this option can affect reuse of code generated for subsystems. SeeGenerate 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 thePass fixed-size scalar root inputs by value for code generationparameter.

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, seeContext-dependent inputs.

Related Topics

Was this topic helpful?