Main Content

Generate separate internal data per entry-point function

Description

Generate a model block signals (block I/O) and discrete states (DWork) acting at the same rate into the same data structure. Depending on how many rates a model has, these structures contain the prefixes FuncInternalData0, FunctionInternalData1, and so on.

Category: Code Generation > Interface

Settings

Default: off

On

Store global block signal data (block I/O) and global state data (DWork vectors) operating at the same rate in one data structure in the generated code.

Off

Do not store global block signal data (block I/O) and global state data (DWork vectors) operating at the same rate in one data structure in the generated code

Tips

Setting this parameter to On improves cache performance when deploying a model to a multicore hardware environment that meets these requirements:

  • The model has multiple rates and has the Treat each discrete rate as a separate task parameter set to on.

  • The model contains multiple exported functions that run at different rates.

The previous models have separate entry-point functions that different cores can call. A core has its own data cache. Placing data for a single entry-point function in the same core data cache improves execution efficiency because the cache accesses are contiguous rather than spread out over multiple cores.

Example

For a model that generates this code:

/* Block signals and states (default storage) for system '<Root>' */
typedef struct {
  real_T RTBS2F;                       /* '<Root>/RTBS2F' */
  real_T UDS;                          /* '<Root>/UDS' */
  real_T Sum3;                         /* '<Root>/Sum3' */
  real_T Sum1;                         /* '<Root>/Sum1' */
  real_T UDF_DSTATE;                   /* '<Root>/UDF' */
  real_T UDS_DSTATE;                   /* '<Root>/UDS' */
  real_T RTBS2F_Buffer0;               /* '<Root>/RTBS2F' */
  real_T MIXEDDSM;                     /* '<Root>/DSMM' */
  real_T SLOWDSM;                      /* '<Root>/DSMS' */
} DW_demo1_T;

If you select Generate separate internal data per entry-point function, the generated code now looks like this code:

/* Block signals and states (default storage) for system '<Root>' */
typedef struct {
  real_T RTBS2F_Buffer0;               /* '<Root>/RTBS2F' */
  real_T MIXEDDSM;                     /* '<Root>/DSMM' */
} DW_demo1_T;

/* Internal Data Grouped For Same Function, for system '<Root>' */
typedef struct {
  real_T RTBS2F;                       /* '<Root>/RTBS2F' */
  real_T Sum3;                         /* '<Root>/Sum3' */
  real_T UDF_DSTATE;                   /* '<Root>/UDF' */
} FuncInternalData0_demo1_T;

/* Internal Data Grouped For Same Function, for system '<Root>' */
typedef struct {
  real_T UDS;                          /* '<Root>/UDS' */
  real_T Sum1;                         /* '<Root>/Sum1' */
  real_T UDS_DSTATE;                   /* '<Root>/UDS' */
  real_T SLOWDSM;                      /* '<Root>/DSMS' */
} FuncInternalData1_demo1_T;

Dependencies

  • This parameter requires an Embedded Coder® license when generating code.

  • This parameter is enabled by selecting the Combine signal/state structures parameter.

Command-Line Information

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

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Related Topics