Combine signal/state structures

Description

Specify whether to combine global block signals and global state data into one data structure in the generated code

Category: Code Generation > Interface

Settings

Default: Off

On

Combine global block signal data (block I/O) and global state data (DWork vectors) into one data structure in the generated code.

Off

Store global block signals and global states in separate data structures, block I/O and DWork vectors, in the generated code.

Tips

The benefits to setting this parameter to On are:

  • Enables tighter memory representation through fewer bitfields, which reduces RAM usage

  • Enables better alignment of data structure elements, which reduces RAM usage

  • Reduces the number of arguments to reusable subsystem and model reference block functions, which reduces stack usage

  • Better readable data structures with more consistent element sorting

Example

For a model that generates the following code:

/* Block signals (auto storage) */
typedef struct {
  struct {
    uint_T LogicalOperator:1;
    uint_T UnitDelay1:1;
  } bitsForTID0;
} BlockIO;
/* Block states (auto storage) */
typedef struct {
  struct {
    uint_T UnitDelay_DSTATE:1
    uint_T UnitDelay1_DSTATE:1
  } bitsForTID0;
} D_Work;

If you select Combine signal/state structures, the generated code now looks like this:

/* Block signals and states (auto storage)
   for system */
typedef struct {
  struct {
    uint_T LogicalOperator:1;
    uint_T UnitDelay1:1;
    uint_T UnitDelay_DSTATE:1;
    uint_T UnitDelay1_DSTATE:1;
  } bitsForTID0;
} D_Work;

Dependencies

This parameter:

  • Appears only for ERT-based targets.

  • Requires an Embedded Coder® license when generating code.

Command-Line Information

Parameter: CombineSignalStateStructs
Type: character vector
Value: 'on' | 'off'
Default: off

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Related Topics