Specify whether to combine global block signals and global state data into one data structure in the generated code
Category: Code Generation > Interface
Default: Off
Combine global block signal data (block I/O) and global state data (DWork vectors) into one data structure in the generated code.
Store global block signals and global states in separate data structures, block I/O and DWork vectors, in the generated code.
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
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;
This parameter:
Appears only for ERT-based targets.
Requires an Embedded Coder® license when generating code.
Parameter:
CombineSignalStateStructs |
Type: character vector |
Value:
'on' | 'off' |
Default:
off |
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On |
Safety precaution | No impact |