Main Content

Check data types for blocks with index signals

Check ID: mathworks.hism.hisl_0022

Description

This check identifies the blocks with index signals that have data types other than integers or enum and are within the range of indexed values.

This check applies to the following target components in Simulink:

This check allows the following data types for indexing:

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • int64

  • uint64

  • enum (with base type same as data types state earlier)

Note

Maximum size for an Index vector cannot exceed int32 bytes. For more information, see Maximum Size Limits of Simulink Models.

This check applies to the following target components in Stateflow:

  • States and transitions

You can consider the following cases for multiport switches:

  1. 'Data Port for Default Case' is set to 'Last data port' and 'Data port order' set to 'Zero-based contiguous'. The maximum expected number of data ports for the check is "DATATYPE_MAX+2" and the data type is of the index signal.

  2. 'Data Port for Default Case' is set to 'Last data port' and 'Data port order' set to 'One-based contiguous'. The maximum expected number of data ports for the check is "DATATYPE_MAX+1" and the data type is of the index signal.

  3. 'Data Port for Default Case' is set to 'Additional data port' and 'Data port order' set to 'Zero-based contiguous'. The maximum expected number of data ports for the check is "DATATYPE_MAX+1" and the data type is of the index signal.

  4. 'Data Port for Default Case' is set to 'Additional data port' and 'Data port order' set to 'One-based contiguous'. The maximum expected number of data ports for the check is "DATATYPE_MAX" and the data type is of the index signal.

Available with Simulink® Check™.

Check Parameterization

You can use Model Advisor Configuration Editor to configure this check to include files with a .m extension in the analysis. To enable this feature, in the Input Parameters section, select Check external .m files referenced in the model.

Results and Recommended Actions

ConditionRecommended Action
One or more Simulink blocks in the model have index signals that have data types other than integer or enum.Change the data type of block index signals to an integer or enum data type that covers the range of indexed values.
One or more MATLAB Function blocks have index variables with inappropriate data types.Change the data type of index variables to an integer or enum data type that covers the range of indexed values.
One or more Stateflow charts in the model have index variables that have data types other than integer or enum.Change the data type of index signals of the blocks to an integer or enum data type that covers the range of indexed values.

Note

In certain cases, the check might be unable to determine the data type of the index signal. These cases will be flagged as information.

Capabilities and Limitations

  • This check does not support dialog set indices.

  • Analyzes content in masked subsystems. By default, the input parameter Look under masks is set to graphical.

  • Analyzes content of library-linked blocks. By default, the input parameter Follow links is set to on.

  • Allows exclusions of blocks and charts.

  • Flags vector indexing even if the vector contains integer or enum data types.

See Also