Main Content

cgsl_0204: Vector and bus signals crossing into atomic subsystems or Model blocks

ID: Titlecgsl_0204: Vector and bus signals crossing into atomic subsystems or Model blocks
Description

When working with vector or buses and some of the signal elements are in a referenced model, use the following information to determine how to select signal elements to minimize memory usage.

 Signals selected outside Model block results in...Signal selected inside Model block results in...
Virtual BusNo data copies. Only selected signals are passed to the function.

If Inport block parameter Output as nonvirtual bus is selected, then there are no data copies. Only the selected signals are passed to the function.

If Inport block parameter Output as nonvirtual bus is cleared, then a copy of the whole bus is passed to the function.

Nonvirtual BusNo data copies. Only the selected signals are passed to the function.

If Inport block parameter Output as nonvirtual bus is selected, then there are no data copies. Only the selected signals are passed to the function.

If Inport block parameter Output as nonvirtual bus is cleared, then a copy of the whole bus is passed to the function. See example 2.

VectorA copy of the selected signals in a local variable that is passed to the function.No data copies. The whole vector is passed to the function.
Notes
  • Depending on Embedded Coder® settings (e.g. optimizations), predecessor blocks and signal storage classes, actual results might differ from the tables.

  • Virtual buses do not support global data.

  • If the subsystem is set to Inline, data copies do not occur.

RationaleMinimize RAM, ROM, and stack usage
Last ChangedR2023b
Examples

Nonvirtual bus entering a model block:

  • The Total number of instances allowed per top model is Multiple

  • Subsignal is selected inside the referenced model

There are no data copies in the code for the main model. The whole bus is passed to the model reference function.

Code for the model reference function: