Main Content

Check data types for blocks with index signals

mathworks.hism.hisl_0022

Dependencies: Simulink® Check™

Usage: High-Integrity System Modeling

Guideline: hisl_0022: Data type selection for index signals

Description

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

This check applies to these target components in Simulink:

This check allows these data types for indexing:

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • int64

  • uint64

  • enumerated type an integer base type

Note

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

This check applies to states and transitions target components in Stateflow.

For Multiport Switch blocks, the maximum expected number of data ports for the check and data type correspond to these block settings:

  • Data port for default case is set to Last data port and Data port order is set to Zero-based contiguous. The maximum expected number of data ports for the check is DATA_TYPE_MAX + 2 and the data type is of the index signal.

  • Data port for default case is set to Last data port and Data port order is set to One-based contiguous. The maximum expected number of data ports for the check is DATA_TYPE_MAX + 2 and the data type is of the index signal.

  • Data port for default case is set to Additional data port and Data port order is set to Zero-based contiguous. The maximum expected number of data ports for the check is DATA_TYPE_MAX + 1 and the data type is of the index signal.

  • Data port for default case is set to Additional data port and Data port order is set to One-based contiguous. The maximum expected number of data ports for the check is DATA_TYPE_MAX and the data type is of the index signal.

Check Parameters

Use the Model Advisor Configuration Editor to define the scope of the analysis by specifying the input parameters.

ParameterDescription
Check .m files referenced in the model

Specify whether to run on referenced MATLAB® files in the model.

on (default) | off

Follow links

Specify whether to include content of library-linked blocks in the analysis.

on (default) | off

Look under masks

Specify whether to include masked model elements in the analysis.

all (default) | none | graphical | functional

  • all — Check analysis includes all masked model elements.

  • none — Check analysis excludes masked model elements.

  • graphical — Check analysis includes only the graphical masked model elements.

  • functional — Check analysis includes only the functional masked model elements.

Recommended Actions and Results

Review the violations that are flagged by the check and the recommended action for fixing the issue. After applying the changes, save the model and rerun the check analysis.

Modeling ConditionRecommended Action
One or more Simulink blocks in the model have index signals that have data types other than integer type or enumerated type.Change the data type of block index signals to an integer or enumerated 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 enumerated 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 type or enumerated type.Change the data type of index signals of the blocks to an integer or enumerated data type that covers the range of indexed values.

Note

In some cases, the check is unable to determine the data type of the index signal. These cases are flagged as information.

Capabilities and Limitations

  • Does not support indices specified explicitly by setting Data port order to Specify indices

  • Performs model compilation

  • Analyzes only active variant choices

  • Allows exclusions of blocks and charts

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

Version History

Introduced in R2018b