Use Simulink® Code Inspector™ Model Advisor checks to configure your model for code inspection.
Simulink Coder Checks (Simulink Coder)
Simulink Check Checks (Simulink Check)
Check ID:
mathworks.slci.CodeGenerationSettings
Check code generation settings in the model configuration that might impact compatibility with Simulink Code Inspector.
This check verifies that code generation settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify 'Language' setting | The model is configured to generate C++
(Encapsulated) files. | In the Configuration Parameters dialog box, on the Code
Generation pane, set Language (Simulink Coder) to
C or C++ . |
Verify 'Code interface packaging’ setting | The model is not configured to use Nonreusable
function or Reusable function interface
packaging. | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Code interface
packaging (Simulink Coder) to Nonreusable function
or Reusable function . |
Verify 'Use dynamic memory allocation for model initialization' setting | The model is configured to dynamically allocate memory. | In the Configuration Parameters dialog box, clear the Use dynamic memory allocation for model initialization (Simulink Coder) field. |
Verify 'Shared code placement' setting | The model is not configured to generate shared utility code to a shared
location. If shared utility code is generated into
, the Simulink
Code Inspector reports the code as unverified. | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Shared code placement (Simulink Coder)
to Shared location . Using a
shared location for utility functions, macros, and user-defined data types
promotes debugging and traceability of generated code. |
Verify 'Source file' setting | Custom code is configured to appear near the top of the generated model source file. | In the Configuration Parameters dialog box, on the Code Generation > Custom Code pane, clear the Source file (Simulink Coder) field. |
Verify 'Header file' setting | Custom code is configured to appear near the top of the generated model header file. | In the Configuration Parameters dialog box, on the Code Generation > Custom Code pane, clear the Header file (Simulink Coder) field. |
Verify 'Initialize function' setting | Custom code is configured to appear in the generated model initialize function. | In the Configuration Parameters dialog box, on theCode Generation > Custom Code pane, clear the Initialize function (Simulink Coder) field. |
Verify 'Terminate function' setting | Custom code is configured to appear in the generated model terminate function. | In the Configuration Parameters dialog box, on the Code Generation > Custom Code and clear the Terminate function (Simulink Coder) field. |
Verify 'Disable incompatible optimizations' setting | The model is not configured to disable optimizations that are incompatible with Simulink Code Inspector. | In the MATLAB® Command Window, set the model parameter
AdvancedOptControl to -SLCI . For example,
set_param(gcs, 'AdvancedOptControl', '-SLCI') . |
Verify 'Combine signal/state structures' setting | The model is configured to combine global block signals and global state data into one data structure in the generated code. This is not supported for code inspection. | In the Configuration Parameters dialog box, clear the Combine signal/state structures (Embedded Coder) parameter. |
Verify 'Array layout' setting | This model is configured to generate code in row-major layout. This is not supported for code inspection. | In the Configuration Parameters dialog box, set the Array
layout (Simulink Coder) parameter to column-major . |
Verify 'Remove code from floating-point to integer conversions that wraps out-of-range values' setting | The model is configured not to remove wrapping code that handles out-of-range floating-point to integer conversion results when out-of-range conversions occur. | In the Configuration Parameters dialog box, on the Code Generation > Optimization pane, select Remove code from floating-point to integer conversions that wraps out-of-range values (Simulink Coder). |
Verify 'Remove code from floating-point to integer conversions with saturation that maps NaN to zero' setting | The model is configured to remove code that handles floating-point to integer
conversion results for NaN values when mapping from
NaN to integer zero occurs. | In the Configuration Parameters dialog box, clear the Remove code from floating-point to integer conversions with saturation that maps NaN to zero (Simulink Coder) parameter. |
Verify 'Include comments' setting | The model is configured to omit autogenerated comments from generated code files. The Simulink Code Inspector parses autogenerated comments to obtain traceability information about model data. | In the Configuration Parameters dialog box, on the Code Generation > Comments pane, select Include comments (Simulink Coder). |
Verify 'Generate scalar inlined parameter as' setting | The model is configured to generate scalar inlined parameters as variables
with #define macros, rather than as numeric constants. | In the Configuration Parameters dialog box, on the Code Generation
> Identifiers pane, set Generate scalar inlined parameter as (Embedded Coder) to
Literals . |
Verify 'Preserve condition expression in if statement' setting | The model is configured to optimize empty primary condition expressions in
if statements by negating them, rather than preserving the
empty primary condition expressions. | In the Configuration Parameters dialog box, on the Code Generation > Code Style pane, select Preserve condition expression in if statement (Embedded Coder). |
Verify 'Code replacement library' setting | A code replacement library other than None is
selected for the model. | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Code replacement
library (Simulink Coder) to None . The check does not
pass if you do not select None . However, if you create
your library using Supported Functions and Operations in Code Replacement Libraries,
Simulink
Code Inspector does inspect the generated code. |
Verify 'Standard math library' setting | A standard math library other than C89/C90 (ANSI)
or C99 (ISO) is selected for the model. | In the Configuration Parameters dialog box, set Standard math library (Simulink Coder)
to C89/C90 (ANSI) or C99
(ISO) . |
Verify 'Classic call interface' setting | The model is configured to generate model function calls compatible with the main program module of a pre-R2011a GRT target. The classic call interface is not supported for code inspection. | In the Configuration Parameters dialog box, clear the Classic call interface (Simulink Coder) parameter. |
Verify 'Terminate function required' setting | The model is configured to generate a
function,
potentially containing model termination code to be executed during system
shutdown. This is not supported for code inspection. | In the Configuration Parameters dialog box, clear the Terminate function required (Embedded Coder) parameter. |
Verify 'Remove code that protects against division arithmetic exceptions' setting | The model is configured to remove code that guards against division by zero for fixed-point data. | In the Configuration Parameters dialog box, on the Code Generation > Optimization pane, clear the Remove code that protects against division arithmetic exceptions (Embedded Coder) parameter. |
Verify 'MAT-file logging' setting | The model is configured to log execution data to a MAT-file. This is not supported for code inspection. | In the Configuration Parameters dialog box, clear the MAT-file logging (Simulink Coder) parameter. |
Verify 'Pack Boolean data into bitfields' setting | The model is configured to store Boolean signals as one-bit bitfields. | In the Configuration Parameters dialog box, on the Code Generation > Optimization pane, clear the Pack Boolean data into bitfields (Embedded Coder) parameter. |
Verify ‘Use bitsets for storing state configuration’ setting | The model is configured to reduce the amount of memory required to store state configuration variables. | In the Configuration Parameters dialog box, on the Code Generation > Optimization pane, clear the Use bitsets for storing state configuration (Simulink Coder) parameter. |
Verify 'non-finite numbers' setting | The model is configured to generate nonfinite data (for example,
NaN and Inf ) and related operations. This
is not supported for code inspection. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear the Support: non-finite numbers (Simulink Coder) parameter. |
Verify 'absolute time' setting | The model is configured to generate and maintain integer counters for absolute and elapsed time values. This is not supported for code inspection. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear the Support: absolute time (Embedded Coder) parameter. |
Verify 'Operator to represent Bitwise and Logical Operator blocks' setting | The model is configured to generate code that represents bitwise operators as logical operator. | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Operator to represent Bitwise and Logical Operator
blocks (Embedded Coder) to Same as modeled or
Bitwise operator . |
Verify ‘Default parameter behavior’ setting | The referenced model is configured to use symbolic names for model parameters in generated code. | In the Configuration Parameters dialog box, set Default parameter behavior (Simulink Coder) to
Inlined . |
Verify 'Remove error status field in real-time model data structure' setting | The model is configured to include an error status field in a generated
rtModel data structure. The rtModel data
structure is not supported for code inspection. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, select Remove error status field in real-time model data structure (Embedded Coder). |
Verify 'Create block' setting | The model is configured to generate a SIL or PIL block during code generation. This is not supported for code inspection. | In the Configuration Parameters dialog box, set Create
block (Embedded Coder) to
None . |
Verify 'Measure function execution times' setting | The model is configured to generate code with instrumentation to collect execution times for functions inside the generated code. This is not supported for code inspection. | In the Configuration Parameters dialog box, on the Code Generation > Verification pane, clear the Measure function execution times (Embedded Coder) parameter. |
Verify 'Signal naming' setting | The model is configured to change signal names when creating corresponding identifiers in the generated code. | In the Configuration Parameters dialog box, on the Code Generation
> Identifiers pane, set Signal
naming (Embedded Coder) to
None . |
Verify 'Parameter naming' setting | The model is configured to change parameter names when creating corresponding identifiers in the generated code. | In the Configuration Parameters dialog box, on the Code Generation
> Identifiers pane, set Parameter
naming (Embedded Coder) to
None . |
Verify 'TLC options' setting | The model is configured with TLC options. | In the MATLAB Command Window, set the model configuration parameter
TLCOptions to unspecified or
-aMaxStackVariableSize=inf . For example,
set_param(gcs, 'TLCOptions', ' ') or set_param(gcs,
'TLCOptions', '-aMaxStackVariableSize=inf') . |
Verify ‘variable-size signals’ setting | The model is configured to generate code for models that use variable-size signals. | In the Configuration Parameters dialog box, on the Code Generation pane, clear the Support: variable-size signals (Embedded Coder) field. |
Verify 'Single output/update function' setting | The model is configured to generate code in separate
and
functions, rather
than a function that
combines the two. | In the Configuration Parameters dialog box, select Single output/update function (Simulink Coder). |
Verify ‘Casting Modes’ setting | The model is configured to generate code that casts data type values explicitly. | In the Configuration Parameters dialog box, on the Code Generation
> Code Style pane, set Casting
Modes (Embedded Coder) to Nominal or
Standards . |
Verify 'Suppress generation of default cases for Stateflow switch statements if unreachable' setting | The model is configured to generate default cases for switch-case statements in the code for Stateflow® charts. | In the Configuration Parameters dialog box, on the Code Generation> Code Style pane, clear the Suppress generation of default cases for Stateflow switch statements if unreachable (Embedded Coder) field. |
Verify ‘Optimize using the specified minimum and maximum values’ setting | The model is configured to optimize generated code using range information derived from the minimum and maximum specified values for signals and parameters in the model. | In the Configuration Parameters dialog box, on the Code Generation > Optimization pane, clear the Optimize using the specified minimum and maximum values (Embedded Coder) parameter. |
Verify ‘parameters’ setting | Model is configured to generate a C API interface to global block parameters. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear Generate C API for: parameters (Simulink Coder). |
Verify ‘signals’ setting | Model is configured to generate a C API interface to global block outputs. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear Generate C API for: signals (Simulink Coder). |
Verify ‘states’ setting | Model is configured to generate a C API interface to discrete and continuous states. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear Generate C API for: states (Simulink Coder). |
Verify ‘root-level I/O’ setting | Model is configured to generate a C API interface to root-level inputs and outputs. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear Generate C API for: root-level I/O (Simulink Coder). |
Verify ‘External mode’ setting | Model is configured to generate code for the external mode data interface. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear External mode (Simulink Coder). |
Verify ‘ASAP2 interface’ setting | Model is configured to generate code for the ASAP2 data interface. | In the Configuration Parameters dialog box, on the Code Generation > Interface pane, clear ASAP2 interface (Simulink Coder). |
Verify 'Generate an example main program' setting | Model is not configured to generate an example main program. | In the Configuration Parameters dialog box, on the Code Generation > Templates pane, select Generate an example main program (Embedded Coder). |
Verify ‘Use bitsets for storing Boolean data’ setting | The model is configured to use bitsets for storing Boolean data. | In the Configuration Parameters dialog box, on the Code Generation > Optimization pane, clear the Use bitsets for storing Boolean data (Simulink Coder) parameter. |
Verify 'Simplify array indexing' setting | The model is configured to generate code that replaces multiply operations with add operations in array indices when accessing arrays in a loop. | In the Configuration Parameters dialog box, clear the Simplify array indexing (Embedded Coder) parameter. |
Verify 'Rate Transition block code' setting | The model is configured to separate Rate Transition block code and data from the model code and data. | In the Configuration Parameters dialog box, on the Code Generation
> Code Placement pane, set Rate
Transition block code (Embedded Coder) to
Inline . |
Check ID:
mathworks.slci.DataImportSettings
Check data import/export settings in the model configuration that might impact compatibility with Simulink Code Inspector.
This check verifies that data import/export settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify 'Initial state' setting | The model is configured to load initial states from a workspace, which is not compatible with code inspection. | In the Configuration Parameters dialog box, on the Data Import/Export pane, clear the Initial state parameter. |
Check ID:
mathworks.slci.DiagnosticsSettings
Check diagnostic settings in the model configuration that might impact compatibility with Simulink Code Inspector.
This check verifies that diagnostic settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify ‘Multitask data store’ setting | The model is not configured to generate an error when one task reads data from a Data Store Memory block to which another task writes data. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity pane, set Multitask data store to
error . |
Verify ‘Multitask rate transition’ setting | The model is not configured to generate an error when an invalid rate transition occurred between two blocks operating in multitasking mode. | In the Configuration Parameters dialog box, on the Diagnostics >
Sample Time pane, set Multitask rate transition to
error . |
Verify ‘Multitask conditionally executed subsystem’ setting | The model is not configured to generate an error when the Simulink software detects a subsystem that may cause data corruption or non-deterministic behavior. | In the Configuration Parameters dialog box, on the Diagnostics >
Sample Time pane, set Multitask
conditionally executed subsystem to
error . |
Verify 'Underspecified initialization detection' setting | The model is not configured to initialize block initial conditions using simplified behavior. The simplified behavior can improve the consistency of model results. | In the Configuration Parameters dialog box, set Underspecified
initialization detection to
Simplified . |
Verify 'Non-bus signals treated as bus signals' setting | The model is not configured to generate an error when Simulink software implicitly converts a non-bus signal to a bus signal to support connecting the signal to a Bus Assignment or Bus Selector block. | In the Configuration Parameters dialog box, on the Diagnostics >
Connectivity pane, set Non-bus signals treated
as bus signals to error . |
Verify 'Detect downcast' setting | The model is not configured to generate an error when a parameter downcast occurs during simulation. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity pane, set Detect
downcast to error . |
Verify 'Detect overflow' setting | The model is not configured to generate an error when a parameter overflow occurs during simulation. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity > Parameters pane, set Detect
overflow to error . |
Verify 'Detect overflow' setting | The model is not configured to generate an error when a signal overflow occurs during simulation. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity > Signals pane, set Wrap on
overflow to error . |
Verify 'Saturate on overflow' setting | The model is not configured to generate an error when the value of a signal is too large to be represented by the signal data type, resulting in a saturation. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity > Signals pane, set Saturate on overflow to
error . |
Verify 'Detect underflow' setting | The model is not configured to generate an error when a parameter underflow occurs during simulation. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity pane, set Detect
underflow to error . |
Verify 'Detect loss of tunability' setting | The model is not configured to generate an error when an expression with tunable variables is reduced to its numerical equivalent. | In the Configuration Parameters dialog box, on the Diagnostics >
Data Validity pane, set Detect loss of tunability to
error . |
Verify 'Unexpected backtracking' setting | The model is not configured to generate an error when a chart junction:
| In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set Unexpected backtracking to
error . |
Verify 'Invalid input data access in chart initialization' setting | The model is not configured to generate an error when a chart:
| In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set Invalid input
data access in chart initialization to
error . |
Verify 'No unconditional default transitions' setting | The model is not configured to generate an error when a chart does not have an unconditional default transition to a state or a junction. | In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set No unconditional default
transitions to error . |
Verify 'Transition outside natural parent' setting | The model is not configured to generate an error when a chart contains a transition that loops outside the parent state or junction. | In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set Transition outside natural parent to
error . |
Verify ‘Unreachable execution path’ setting | The model is not configured to generate an error when a chart construct is not on a valid execution path. | In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set Unreachable execution path to
error . |
Verify 'Undirected event broadcasts' setting | The model is not configured to generate an error when a chart contains undirected local event broadcasts. | In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set Undirected event broadcasts to
error . |
Verify 'Transition action specified before condition action' setting | The model is not configured to generate an error when a transition action executes before a condition action in a transition path with multiple transition segments. | In the Configuration Parameters dialog box, on the Diagnostics >
Stateflow pane, set Transition
action specified before condition action to
error . |
Verify Bus signal treated as vector setting | The model is not configured to generate an error when Simulink software detects a virtual bus signal that is used as a mux signal. Strict bus behavior is not enforced. | In the Configuration Parameters dialog box, on the Diagnostics >
Connectivity pane, set Bus signal treated as vector to
error . |
Verify 'Allow symbolic dimension specification' settings | The model is configured to allow symbolic dimension specification. | In the Configuration Parameter dialog box, clear the Allow symbolic dimension specification field. |
Check ID:
mathworks.slci.HardwareImplementationSettings
Check hardware implementation settings in the model configuration that might impact compatibility with Simulink Code Inspector.
This check verifies that hardware implementation settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify 'char' setting | The bit length of character data for the production hardware does not equal
8 . | In the Configuration Parameters dialog box, on the Hardware Implementation pane, select a production hardware Device type that is compatible with the settings in this table. |
Verify 'short' setting | The bit length of short data for the production hardware
does not equal 16 . | |
Verify 'int' setting | The bit length of int data for the production hardware
does not equal 32 . | |
Verify 'long' setting | The bit length of long data for the production hardware
does not equal 32 . | |
Verify 'float' setting | The bit length of floating-point data for the production hardware does not
equal 32 . | |
Verify 'double' setting | The bit length of double data for the production hardware
does not equal 64 . | |
Verify 'pointer' setting | The bit length of pointer data for the production hardware does not equal
32 . | |
Verify 'native' setting | The microprocessor native word size for the production hardware does not
equal 32 bits. | |
Verify 'Signed integer division rounds to' setting | The method of producing a signed integer quotient for the production hardware
is not to choose the integer that is closer to zero
(Zero method). | |
Verify 'Shift right on a signed integer as arithmetic shift' setting | The method by which the compiler implements signed integer right shift for the production hardware is not an arithmetic right shift. | |
Verify ‘Support long long’ setting | The use of C long long data type is enabled. | In the Configuration Parameters dialog box, on the Hardware Implementation pane, do not select Support long long. |
Verify 'Test hardware is the same as production hardware' setting | The test hardware differs from the deployment hardware. | In the Configuration Parameters dialog box, select Test hardware is the same as production hardware. |
Verify 'Device vendor->Device type‘ setting | The device vendor and device type are
ASIC/FPGA . | In the Configuration Parameters dialog box, on the Hardware
Implementation pane, under Test hardware, do
not select Device vendor
|
Check ID:
mathworks.slci.MathandDataTypesSettings
Check math and data type settings in the model configuration that might impact compatibility with Simulink Code Inspector.
This check verifies that math and data type settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify 'Implement logic signals as Boolean data (vs. double)' setting | The model is configured to implement logic signals with the
double data type, rather than with the more memory-efficient
boolean data type. | In the Configuration Parameters dialog box, select Implement logic signals as Boolean data (vs. double). |
Check ID:
mathworks.slci.SolverSettings
Check solver settings in the model configuration that might impact compatibility with Simulink Code Inspector.
This check verifies that solver settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify 'Type' setting | The model is configured with a variable-step solver. | In the Configuration Parameters dialog box, on the
Solver pane, set Type
to Fixed-step . |
Verify 'Solver' setting | The model is configured with a solver other than a fixed-step discrete solver. | In the Configuration Parameters dialog box, on the
Solver pane, set Solver to discrete
(no continuous states)
(equivalent to FixedStepDiscrete specified at the command
line). |
Verify ‘Periodic sample time constraint’ setting | The model sets Periodic sample time constraint to
Specified . | In the Configuration Parameters dialog box, on the
Solver pane, set Periodic sample time constraint to
Unconstrained or Ensure sample time
independent . |
Verify ‘Automatically handle rate transition for data transfer’ setting | The model is configured to insert hidden Rate Transition blocks between blocks when rate transitions are detected. | In the Configuration Parameters dialog box, on the Solver pane, clear the Automatically handle rate transition for data transfer check box. |
Verify ‘Allow tasks to execute concurrently on target’ setting | The model configuration parameter Allow tasks to execute
concurrently on target (ConcurrentTasks ) is
selected. | In the Configuration Parameters dialog box, on the Solver pane, clear the Allow tasks to execute concurrently on target check box. |
Check ID:
mathworks.slci.UnconnectedObjects
Check for unconnected ports and lines in the model.
This check reports unconnected lines, input ports, and output ports in the model or subsystem.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for unconnected objects | One or more lines, input ports, or output ports are not properly connected in the model or subsystem. This can result in dead code or hidden ground blocks. | Connect or remove the affected blocks. |
Check ID:
mathworks.slci.SystemTargetFileSettings
Check for unconnected ports and lines in the model.
Check whether a compatible system target file is selected for the model.
This check verifies that the System target file selected for the
model is ert.tlc
or is derived from ert.tlc
.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify system target file setting | The system target file selected for the model is not
ert.tlc or an ERT-derived target. | In the Configuration Parameters dialog box, on the Code
Generation pane, set System target file (Simulink Coder) to
ert.tlc or an ERT-derived target. |
Check ID:
mathworks.slci.FcnSpecSettings
Check for function specification settings that might impact compatibility with Simulink Code Inspector.
This check verifies that function prototype control settings are compatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check C Step Function Interface setting | The model specifies custom function prototypes for model entry functions. This is not supported for code inspection. | In the Simulink Editor code perspective, in the Code Mapping Editor, select the Functions tab. In the row for the step function, click in the function in the Function Preview column. In the Configure C Step Function Interface dialog box, clear the Configure arguments for Step function prototype setting. |
Check ID:
mathworks.slci.StateflowMachineData
Check the model for Stateflow data of machine scope. Data of machine scope is incompatible with Simulink Code Inspector
This check verifies that the model does not contain Stateflow data of machine scope.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
All Stateflow data must be parented by a Stateflow chart | The model contains Stateflow data of machine scope. | Modify model so that it does not contain Stateflow data of machine scope. |
Data Specification (Stateflow)
Check ID:
mathworks.slci.StateflowMachineEvents
Check the model for Stateflow events of machine scope. Events of machine scope are incompatible with Simulink Code Inspector
This check verifies that the model does not contain Stateflow events of machine scope.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
All Stateflow events must be parented by a Stateflow chart | The model contains Stateflow events of machine scope. | Modify model so that it does not contain Stateflow events of machine scope. |
Events (Stateflow)
Check ID:
mathworks.slci.ConditionallyExecuteInputs
Check for usage of conditional input branch execution that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatible usage of conditional input branch execution.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify conditional input branch execution setting | The model configuration parameter Conditional input branch execution is selected, but Enable local block outputs (Simulink Coder) is not selected. The model must enable local block outputs when using conditional input branch execution. | In the Configuration Parameters dialog box, on the Optimization pane, select Enable local block outputs (Simulink Coder). |
Verify that Reusable or Nonreusable subsystem block outputs are not inputs to Multiport Switch blocks when Conditional input branch execution model configuration parameter is selected | The model uses Reusable or Nonreusable subsystem block outputs as inputs to the Multiport Switch block when the model configuration parameter Conditional input branch execution is selected. | Modify the model so that the Reusable or Nonreusable subsystem block outputs are not inputs to the Multiport Switch block. |
Check ID:
mathworks.slci.InstrumentedSignals
Check for instrumented signals in the model that connect to automatically inserted blocks.
This check verifies that the model does not contain signals that are instrumented, and connect to automatically inserted blocks. Automatically inserted blocks are referred to as hidden blocks.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for instrumented signals in the model that connect to automatically inserted blocks | The model contains instrumented signals that connect to automatically inserted blocks. | Modify the model by deleting the instrumented signals that connect to automatically inserted blocks. |
Check ID:
mathworks.slci.CodeGenFolderStructure
Check for unsupported code generation folder structure for the model.
This check verifies that, in Simulink Preferences, the Code generation
folder structure is set to Model Specific
for the
model.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check the code generation folder structure for the model | The model has an unsupported code generation folder structure. | In Simulink Preferences, on the General pane, set the
Code generation folder structure to Model
Specific . |
Check ID:
mathworks.slci.CodeMappingDefaults
Check for unsupported Code Mapping settings.
This check verifies that the Default
storage class is used for each
model element category on the Data Defaults tab of the Code Mapping
Editor.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for unsupported Code Mapping settings | Model element categories use an unsupported storage class setting on the Data Defaults tab of the Code Mapping Editor. | In the Code Mapping Editor, on the Data Defaults tab
under Code Mappings-C, set the storage class to
Default for each model element category. |
Check ID:
mathworks.slci.StructureStorageClass
Check for model arguments with a storage class.
This check verifies that model arguments do not have a storage class.
Subcheck | Condition | Recommended Action |
---|---|---|
Check model arguments for storage classes | A model argument has a storage class. | Modify the model so that model arguments do not have storage classes. |
Check ID:
mathworks.slci.MATLABFunctionCodeUsage
Identify code in MATLAB functions that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds with code in MATLAB functions.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check non-inlined user defined functions with global variables in MATLAB code | Use of non-inlined user-defined functions with global variables is not supported. |
|
Check that non-inlined user defined functions in MATLAB code contain only one output | Non-inlined functions define more than one output. | Modify the MATLAB code so that non-inlined user defined functions define only one output. |
Check that array subscripting in MATLAB code uses a constant index of 1 for a corresponding dimension of size 1 | Array subscript in MATLAB code uses an index value other than 1 for the corresponding array dimension of size 1. | Modify the MATLAB code so that array subscripting uses a constant index of 1 for a corresponding dimension of size 1. |
Check that array indexing in MATLAB code uses a subscript that is less than or equal to the array base dimension | Array index in MATLAB code uses a subscript that is greater than the array base dimension | Modify the MATLAB code so that array indexing uses a subscript that is less than or equal to the array base dimension. |
Check type argument for cast in MATLAB functions | MATLAB function has unsupported type argument in cast functions. | Modify the cast function to one of the following forms:
|
Check that colon operators in MATLAB code have no more than 3 operands | colon (: ) operator has more than 3
operands. | Modify MATLAB code so that |
Check that colon operators in MATLAB code use only integer and double data | colon (: ) operator uses single or
char data. | Modify MATLAB code so that |
Check that data used in MATLAB function is of a supported data type | Data used in MATLAB function is not of type: boolean ,
int8 , int16 , int32 ,
uint8 , uint16 , uint32 ,
single , double , or scalar bus. | Modify the data to be a supported data type. |
Check that diagonal number used in a diag function in MATLAB code is constant | diag function specifies a diagonal number that is not a
constant. | Modify the diag function to use a constant diagonal
number. |
Check that code in MATLAB function is of a supported dimension |
| Modify the identifiers to be a supported dimension. |
Check that if statements in MATLAB code use conditions that are scalar | if statement uses condition that is not scalar. | Modify MATLAB code so that if statements use conditions that
are scalar. |
Check for nonempty brackets in MATLAB code | MATLAB code contains empty brackets. | Modify MATLAB code so that there are not empty brackets. |
Check that for statements in MATLAB code have index ranges that are mono incremental colon expressions | MATLAB code contains for statements with index ranges
that are not mono incremental colon expressions. | Modify MATLAB code so that for statements have index ranges
that are mono incremental colon expressions. |
Check that for statements in MATLAB code have index range values that are literal const integers | MATLAB code contains for statements with index range
values that are not literal const integers. | Modify MATLAB code so that for statements have index range
values that are literal const integers. |
Check that for statements in MATLAB code have scalar index values | MATLAB code contains for statements with non-scalar
index values. | Modify MATLAB code so that for statements have scalar index
values. |
Check that data defined in MATLAB function is of a double or single data type | Operands of dot power operator are not of type single or double. | Modify the data to a supported data type of single or double. |
For MATLAB root function, do not specify coder.inline directive or set coder.inline directive to 'always'. For user defined MATLAB functions, explicitly set coder.inline directive to 'always' or 'never' | MATLAB function does not use supported coder.inline
directive. | Modify use of For MATLAB root functions, if For
user-defined MATLAB functions, the |
Check that math functions in MATLAB code use only integer and floating-point data | Math functions in MATLAB code are using boolean type data. | Modify MATLAB code so that math functions use only integer or double data. |
Check that no code in MATLAB functions has missing data type information | MATLAB function has missing data type information. | Modify the function to eliminate code with missing data type information. Note If your MATLAB code fails this check, it might be because there is unreachable
code. Fix any |
Check that no code in MATLAB functions has missing dimension information | MATLAB function has missing dimension information. | Modify the function to eliminate code with missing dimension information. Note If your MATLAB code fails this check, it might be because there is unreachable
code. Fix any |
Check that all function calls in MATLAB code resolve to a known function definition | MATLAB function has a function call that does not resolve to a known function definition. | Modify the MATLAB function to eliminate function calls with unknown function resolution. |
Check that operators used in MATLAB function do not have operands with mixed data type | Operator in MATLAB function has operands with mixed data type. | Modify the function to avoid using operators with operands of mixed data type. |
Check that the ‘Loop unrolling threshold’ does not result in partially unrolled loops in the generated code when using matrix operations in MATLAB code | When using matrix operations, the Loop unrolling threshold might result in partially unrolled loops in the generated code. | Modify the Loop unrolling threshold to generate code without partially unrolled loops for matrix operations. |
Check that conditional initialization of persistent variables uses an 'if' statement with a single isempty (persistent) or ~isempty (persistent) condition | Conditional initialization of a persistent variable does not use an
if statement with a single
isempty(persistent) or
~isempty(persistent) condition. | Modify the if statement to use a single
isempty(persistent) or
~isempty(persistent) condition. |
Check that there is only one initialization statement of a persistent variable in ‘if’ statement body | if statement body contains multiple initialization
statements for a persistent variable. | Modify the MATLAB code so that conditional initialization of persistent variables
contains one statement in if statement body. |
Check that switch statements in MATLAB code do not have case expressions containing a cell array | switch statement has a case expression containing a cell
array. | Modify MATLAB code so that switch statements do not have case
expressions containing a cell array. |
Check that switch statements in MATLAB code use the same scalar integer type for all conditions | switch statement does not use the same scalar integer type
for switch and case conditions. | Modify MATLAB code so that switch statements have conditions
that use the same scalar integer type. |
Check that operators and functions in MATLAB code have supported operand dimensions | The colon (: ) function or a division
operation in MATLAB code uses unsupported non-scalar operands. | Modify the function to use scalar operands. |
Check for unsupported MATLAB code in MATLAB functions | MATLAB function contains unsupported MATLAB code. | Modify the function to remove the use of unsupported MATLAB code. |
Check usage of recursive functions in MATLAB code | MATLAB code defines recursive functions. | Modify the MATLAB code so that it does not define recursive functions. |
Check that coder.ceval in MATLAB code does not specify '-global' option | A usage of coder.ceval specifies the
-global option. | Modify coder.ceval to remove the
-global option. |
Check that coder.ceval in MATLAB code does not specify layout option | A usage of coder.ceval specifies the
layout option. | Modify coder.ceval to remove the layout
option. |
Check usage of function call outputs in MATLAB code | Subfunctions in MATLAB code call function call outputs. | Modify the MATLAB code so that only top-level function has function call outputs. |
Check usage of inner functions in MATLAB code | MATLAB code defines inner functions. | Modify the MATLAB code so that it does not define inner functions. |
Check ID:
mathworks.slci.MATLABCodeAnalyzer
Check MATLAB functions for %#codegen
directive, MATLAB Code Analyzer messages, and justification message ID’s.
This check reports on %#codegen
directives, MATLAB Code Analyzer messages, and justification message ID’s found in MATLAB functions and MATLAB Function blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check MATLAB code used in MATLAB Function blocks | Issues in MATLAB Function block. |
|
Check MATLAB functions defined in Stateflow charts | Issues with MATLAB function used in Stateflow charts. |
|
Check called MATLAB functions | Issues in called MATLAB functions. |
|
Check ID:
mathworks.slci.UnsupportedBlocks
Check for blocks that are not supported by Simulink Code Inspector.
This check updates the model diagram and reports blocks that are not supported by Simulink Code Inspector.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for blocks not supported by Simulink Code Inspector | One or more blocks in the model are not supported for code inspection. Note Supported blocks are listed in Supported Blocks — By Category and Supported Mask Blocks, and also can be viewed in the | Possible actions include:
|
You can run this check on your library models.
This check is supported by edit-time checking.
Check ID:
mathworks.slci.WorkspaceVarUsage
Check for workspace variables referenced by the model.
This check reports workspace variables that use unsupported storage classes.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check storage class for workspace variables referenced by the model | Workspace variables referenced by the model are not supported for one of these reasons:
Note In Simulink or module packaging tool (MPT) classes shipped with MathWorks® code, code inspection is supported for the following storage classes:
| Modify the model so that the model does not reference workspace variables or
set the workspace variable custom storage class Type to
Unstructured . |
Check ID:
mathworks.slci.SampleTimesUsage
Check for sample time characteristics that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports instances of variable, continuous, union, exported discrete, or asynchronous sample times.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check sample times | The model is using continuous, asynchronous, explicit discrete partition, data driven, union, exported discrete, or variable sample times. This is not supported for code inspection. | Modify the model to use supported sample times. |
Check for explicit partitions | The model contains explicit partitions. | Modify the model so that it does not contain explicit partitions. |
Check ID:
mathworks.slci.HiddenBufferBlock
Check for hidden Signal Conversion blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports hidden Signal Conversion blocks that have been automatically inserted on signals entering block input ports.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify no unsupported Signal Conversion blocks are automatically inserted on signals entering block inports | A hidden Signal Conversion block has been automatically inserted on a signal entering a block inport. Hidden Signal Conversion blocks are not supported for code inspection. | Manually insert a Signal Conversion block on the signal entering the block inport, and configure the Signal Conversion block to be excluded from block reduction. |
Check ID:
mathworks.slci.MinMaxLogging
Check for usage of fixed-point instrumentation that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports fixed-point instrumentation incompatibilities.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify usage of fixed-point instrumentation | The model configuration parameter Block reduction
(BlockReduction ) is selected, and the fixed point parameter
Fixed-point instrumentation mode
(MinMaxOverflowLogging ) is set to a value other than
Force off . Simultaneous use of block reduction and
fixed-point instrumentation is not supported for code inspection. | Open the Fixed-Point Tool and turn off fixed-point instrumentation for the model. |
Check ID:
mathworks.slci.SynthLocalDSM
Check for signal objects in the model workspace that are referenced as synthesized local data stores by Data Store Read or Data Store Write blocks.
This check updates the model diagram and verifies synthesized local data store usage. If the model workspace has signal objects that are referenced as synthesized local data stores by Data Store Read or Data Store Write blocks, Simulink creates a hidden Data Store Memory block at the root level of the model. This model is incompatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify synthesized local data store usage | Signal objects are referenced as synthesized local data stores by Data Store Read or Data Store Write blocks. | Avoid using signal objects that are referenced as synthesized local data stores by Data Store Read or Data Store Write block. As a possible work around, create graphical Data Store Memory blocks to specify the data stores. |
Check ID:
mathworks.slci.BlockSortedOrder
Checks that the compiled list of model blocks follow graphical sorted order.
This check updates the model diagram and identifies blocks in the compiled block list of a model that do not match graphical block sorted order.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check model for compiled and graphical block sorted order | Blocks in the compiled block list do not follow graphical sorted order in the model. | Contact MathWorks technical support to report this issue. |
Check ID:
mathworks.slci.RollThreshold
Checks that the model does not have a loop unrolling threshold that might result in partially unrolled loops in the generated code.
This check updates the model diagram and verifies that the model does not have a loop unrolling threshold that might result in partially unrolled loops in the generated code.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify loop unrolling threshold setting | The model is configured with aLoop unrolling threshold (Simulink Coder) that might result in partially unrolled loops in the generated code. | In the Configuration Parameters dialog box, on the Optimization pane, set the Loop unrolling threshold (Simulink Coder) to the value in the Recommended Action section of the Model Advisor window. |
Check ID:
mathworks.slci.GlobalDSM
Checks that global Data Store Memory blocks use inlined parameters with non-tunable initial values.
This check updates the model diagram and verifies global data store usage. If your model has global Data Store blocks with parameters that are not inlined or have tunable initial values, it is incompatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify global data store usage | Configuration parameter Default parameter behavior (Simulink Coder)
(DefaultParameterBehavior ) is not set to
Inlined . | Set Default parameter
behavior (Simulink Coder) to Inlined . |
Initial value (InitialValue ) must not
be tunable. | Fix the Initial value setting. |
Check ID:
mathworks.slci.GlobalDSMShadow
Checks that global Data Store Memory blocks are not shadowed by local Data Store Memory blocks.
This check updates the model diagram and verifies the name shadow of a global data store. If you have a global Data Store Memory block that is shadowed by a local Data Store Memory block, it is incompatible with code inspection.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify global data store’s name shadow | Global Data Store Memory block is shadowed by a local Data Store Memory block. | Remove global Data Store Memory blocks that are shadowed by local Data Store Memory blocks. |
Check ID:
mathworks.slci.SeparateOutputAndUpdate
Check usage of If and Switch Case blocks connected to Action subsystems that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and verifies the usage of If and Switch Case blocks connected to Action subsystems.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check destination Action subsystem of If and Switchcase blocks | Action subsystems connected to the same If or Switch Case blocks do not do one of the following:
| Modify the listed Action subsystems so that they all combine their output and code updates. Place a Signal Conversion block on signals leaving the inports within the Action subsystems. Select the Signal Conversion block parameter Exclude this block from ‘Block reduction’ optimization to exclude it from block reduction. |
Check ID:
mathworks.slci.PassReuseOutputArgsAs
Check usage of root outport blocks in referenced model that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and verifies the usage of root outport blocks in referenced models.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify that the storage class of root outports is supported | Pass reusable subsystem outputs as: is not set to
Structure reference when root outports in referenced
models have non-auto storage class. | Set Pass reusable subsystem outputs as: to
Structure reference . |
Check ID:
mathworks.slci.OutportTerminator
Check usage of terminator blocks connected to model reference blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and verifies the usage of terminator blocks connected to model reference blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for Model Reference block connectivity | Every model reference block outport connects to a terminator block. | Consider commenting out the model reference block. |
Check ID:
mathworks.slci.FirstInitICPropagation
Check if any block propagates initial condition during first time initialization.
This check updates the model diagram and verifies that blocks do not propagate initial condition during first time initialization.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for unsupported propagation of initial condition values | Block propagates initial condition during first time initialization. | Modify the model so that block does not propagate initial condition during first time initialization. |
Check ID:
mathworks.slci.DataTypeReplacementName
Check if model uses Simulink.AliasType
types for replacement
names.
Code inspection is supported for models that use only
Simulink.AliasType
types for replacement names.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Identify replacement names that are not of type Simulink.AliasType | In Data Type Replacement table, the model uses
replacement names that are not of type
Simulink.AliasType . | In the Configuration Parameters dialog box, on the Code Generation
> Data Type Replacement pane, set the replacement name to a
Simulink.AliasType type. |
Check ID:
mathworks.slci.RefModelMultirate
This check updates the model diagram and verifies that models used as model reference targets do not have multiple sample times.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for sample times in model used as model reference target | Model used as model reference target has multiple sample times. | Modify the model to have a single sample time. |
Check ID:
mathworks.slci.GetSetVarUsage
This check updates the model diagram and identifies GetSet storage class workspace variables that use unsupported specifications.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check storage class for workspace variables referenced by the model | For a workspace variable that uses a
| Modify GetSet storage class workspace variables to use a
supported storage class specification. |
Check ID:
mathworks.slci.EnableMultiTasking
This check updates the model diagram and verifies that the Treat each discrete rate as a separate task parameter is selected for a model with multiple discrete rates.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify ‘Treat each discrete rate as a separate task’ setting | A multirate model is configured for single-tasking execution. | In the Configuration Parameters dialog box, on the Solver pane, select Treat each discrete rate as a separate task. |
Check ID:
mathworks.slci.CommentedBlocks
This check updates the model diagram and verifies that the model does not contain commented-out blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for commented out blocks in the model | The model contains a block that is commented out. | Modify the model by deleting the commented-out blocks. |
Check ID:
mathworks.slci.VVSubSystemName
This check updates the model diagram and verifies that noninlined subsystems with void-void function call interfaces use unique function names.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check function names used by void_void subsystems in the model | The model contains void_void subsystems that use the same function name. | Modify void_void subsystems in the model to use unique function names. |
Check ID:
mathworks.slci.LookupndBreakpointsDataType
This check updates the model diagram and verifies that the breakpoint data type and the input data type of an n-D Lookup Table block is the same.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check n-D Lookup Table blocks for incompatible breakpoint data type | Breakpoints > Data Type is not using the same data type as the block input. | Modify the data types to match. Or consider setting Breakpoints >
Data Type to Inherit: Same as corresponding
input . |
Check ID:
mathworks.slci.ReuseSubSystemLibrary
This check updates the model diagram and verifies that reusable subsystems with the same function interface are from the same library blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check the model for reusable subsystems with the same function interfaces | There are reusable subsystems with the same function interface, but from different library blocks. | Modify the model so that reusable subsystems with the same function interface come from the same library blocks. |
Check ID:
mathworks.slci.SharedSynthLocalDSM
This check updates the model diagram and verifies that there is no unsupported usage of shared synthesized local data store memories.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for usage of shared synthesized local data stores | There are signal objects in the model workspace that are referenced as synthesized local data stores by Data Store Read or Data Store Write blocks in this model. | Avoid using signal objects in the model workspace that are referenced as synthesized local data stores by Data Store Read or Data Store Write blocks. Consider creating graphical Data Store Memory blocks to specify those data stores. |
Check ID:
mathworks.slci.SourcesBlocksUsage
Check for usage of Sources blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Sources blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Inport blocks Note This will check shadowed inports if you have any in your model.
| The block cannot specify variable-dimension signals. Block parameter
Variable-size signal (VarSizeSig ) is set
to Yes . | Set Variable-size signal to
No . |
Block parameter Signal Type
(SignalType ) is set to complex . | Set Signal Type to real or
auto . | |
Block parameter Sampling Mode
(SamplingMode ) is set to Frame
based . | Set Signal Type to Sample based or
auto . | |
Root inport in referenced model does not connect to a nonvirtual block. | Connect root inports in referenced models to at least one nonvirtual block. | |
For inports in triggered subsystems, Latch input by delaying
outside signal (LatchByDelayingOutsideSignal ) is
selected (set to on ). | Clear Latch input by delaying outside signal. To retain the latching behavior, restructure the model by placing a Unit Delay block before the input block in the parent diagram. | |
For root inport blocks that use a bus object, block parameter
Output as nonvirtual bus
(BusOutputAsStruct ) is not selected (set to
off ). | For each instance, select Output as nonvirtual bus. | |
Inport is an In Bus Element block. | Instead of an In Bus Element block, use an Inport block with a Bus Selector block. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Constant blocks | Block parameter Constant value
(Value ) is empty, is nonfinite, uses range selection or
variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Constant value setting. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Ground blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.SignalRoutingBlocksUsage
Check for usage of Signal Routing blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Signal Routing blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Bus Creator blocks | The names of signals in the Bus Creator block (Inputs ) do
not match the input signal names for the block
(InputSignalNames ). | Modify the listed Bus Creator block to have matching
Inputs and InputSignalNames . |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Bus Selector blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Bus Assignment blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Data Store Memory blocks | Block parameter Initial value
(InitialValue ) is empty, is nonfinite, uses range selection
or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Initial value setting. |
Block parameter Signal type
(SignalType ) is set to complex . Complex
values are not supported for code inspection. | Set Signal type to auto or
real . | |
Block parameter Detect Write After Write is set to
warning or none . | Set the block parameter Detect Write After Write to
error . | |
Data Store Memory has arrays of buses or buses with elements that are arrays of buses. | Fix the listed Data Store Memory block. | |
Violates a constraint that applies to all blocks:
| Fix the listed Data Store Memory block. | |
Check Data Store Read blocks | The block performs discontinuous selection on datastore arrays. | Modify the selection to a supported form. |
The block uses subscripts with brackets to perform selection on datastore arrays. | Modify the datastore array selection in the Data Store Read blocks to not use subscripts with brackets. | |
Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Data Store Write blocks | The block performs discontinuous selection on datastore arrays. | Modify the selection to a supported form. |
The block uses subscripts with brackets to perform selection on datastore arrays. | Modify the datastore array selection in the Data Store Write blocks to not use subscripts with brackets. | |
Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check From blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Goto blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Merge blocks | Allow unequal port widths
(AllowUnequalInputPortWidths ) is selected. | Clear the Allow unequal port widths parameter. |
Input port offsets is set to an unsupported value. | Set Input port offsets to [] . | |
Source for block must is not an enabled or action subsystem, or is a block
with an InitialConditions function. | Modify the model so that the sources of merge blocks are either enabled or
action subsystems, or blocks without InitialConditions
functions. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Switch blocks | The first and third input ports and the output port do not have the same data type. | Modify the data ports to have the same data type. Consider selecting the block parameter Require all data port inputs to have the same data type. |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Block parameter Allow different data input sizes
(AllowDiffInputSizes ) is selected. | Clear the Allow different data input sizes parameter. | |
Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined and the source of Inport 2 is constant. | Modify the model so that the source of Input 2 is not constant. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Multiport Switch blocks | Data input and output ports do not have the same data type. | Modify the data ports to have the same data type. Consider selecting the block parameter Require all data port inputs to have the same data type. |
Data port indices are specified and an input has more than one value. | Modify the data port configuration so that only one value is specified per input. | |
Data port signal is non-contiguous. | Modify the data port signal so that it is contiguous. | |
Data port signal is connected to a block that selects or reorders input signals. | Modify the data port signal so that it is not connected to a block that selects or reorders input signals. Consider inserting a Signal Conversion block at the non-contiguous data port. | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Block parameter Allow different data input sizes
(AllowDiffInputSizes ) is selected. | Clear the Allow different data input sizes parameter. | |
Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined and the source of Inport 1 is constant. | Modify the model so that the source of Input 1 is not constant. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Mux blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Demux blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Selector blocks | Index port is not of a supported data type. | Modify index port so that it is of data type int8 ,
int16 , int32 , uint8 ,
uint16 , or uint32 . |
Index Option (IndexOptionArray ) is
set to Starting and ending indices (port) | Set Index Option to a value other than
Starting and ending indices (port) . | |
Number of input dimensions
(NumberOfDimensions ) is more than
1 and index port data is connected to a block that selects or
reorders input. | Consider inserting a Signal Conversion block at the index port or modifying the index port data to be contiguous. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Vector Concatenate blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.MathOperationsBlocksUsage
Check for usage of Math Operations blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Math Operations blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Absolute blocks | Input or output port is of type int8 or
int16 . | Modify the port to be of data type double ,
single , uint8 , uint16 ,
int32 , uint32 , or
boolean . |
Input and output ports do not have the same data type. | Modify the port data types to match. | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Bias blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Bias (Bias ) is empty, nonfinite, uses
range selection or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Bias setting. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Gain blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Block parameter Gain (Gain ) is empty,
is nonfinite, uses range selection or variable indexing on the elements of
MATLAB structures, is complex, or has two or more dimensions. | Fix the Gain setting. | |
Block parameter Parameter data type
(ParamDataTypeStr ) does not use the same data type as the
Gain block input. | Modify the Gain block to use the same data type for its input and parameter.
Consider setting Parameter data type to Inherit:
Same as input . | |
Block parameter Multiplication
(Multiplication ) is not set to
Element-wise(K.*u) , Matrix(K*u) ,
Matrix(u*K) , or Matrix(K*u)(u
vector) . | Set Multiplication to
Only | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Block parameter Sample Time
(SampleTime ) is set to a constant sample time. | Set Sample Time to an explicit, non-constant value. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Math blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Function (Operator ) is set to an
unsupported value: conj or
hermitian . | Set Function to one of the following values:
exp , log , 10^u ,
log10 , magnitude^2 ,
square , transpose pow ,
reciprocal , hypot , rem ,
or mod . | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Product blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Multiplication (Multiplication ) is
set to Matrix (*) and Saturate on integer overflow
(SaturateOnIntegerOverflow ) is selected (set to
on ). | Clear the Saturate on integer overflow parameter. | |
Block parameter Number of inputs
(
| Set Number of inputs to
| |
Block parameter Multiplication is set to
Element-wise(.*) when the inport Signal
type is a vector or matrix and the Number of
inputs (inputs ) is set to 1 ,
* or / . | If block parameter Multiplication is set to
Element-wise(.*) and the inport Signal
type is a vector or matrix, do not set Number of
inputs to 1 , * or
/ . | |
Block parameter Multiplication is set to
Element-wise(.*) when the inport Signal
type is a scalar and the Number of inputs
(inputs ) is not set to 1 ,
* or / . | If block parameter Multiplication is set to
Element-wise(.*) and the inport Signal
type is a scalar, then set Number of inputs to
1 , * or / . | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Block parameter Sample Time
(SampleTime ) is set to a constant sample time. | Set Sample Time to an explicit, non-constant value. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Sum blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Block parameter Sum over
(CollapseMode ) is not set to All
dimensions . | Set Sum over to All
dimensions . | |
Block parameter Accumulator data type
(AccumDataTypeStr ) does not use the same data type as the
block inputs | Modify the block to use the same data type for its inputs and accumulator.
Consider setting Accumulator data type to
Inherit: Same as first input . | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Block parameter Sample Time
(SampleTime ) is set to a constant sample time. | Set Sample Time to an explicit, non-constant value. | |
Block has one vector input and parameter Saturate on integer
overflow (SaturateOnIntegerOverflow ) is selected
(set to on ). | Clear the Saturate on integer overflow parameter. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Trigonometry blocks | Block parameter Function (Operator )
is set to cos + jsin (complex exponential of the
input). | Set Function to a value other than cos +
jsin . |
Block parameter Approximation method
(ApproximationMethod ) is not set to
None . | Set Approximation method to
None . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check MinMax blocks | An unsupported data type is specified for an input or output port. | Modify the port data type to be one of the following:
double , single , int8 ,
uint8 , int16 , uint16 ,
int32 , or uint32 . |
Input and output ports do not have the same data type. | Modify the port data types to match. | |
Block has a single input and the standard math library is not
C89/C90 (ANSI) . | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Standard math library
to C89/C90 (ANSI) . | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Rounding Function blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Reshape blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Sign blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Sqrt blocks | Block inputs and outports do not have the same data type. | Fix the listed block inport or outport. |
Block parameter Function (Operator )
is not set to sqrt or
signedSqrt . | Set block parameter Function to
sqrt or
signedSqrt . | |
Block parameter Output signal type
(OutputSignalType ) is set to
complex . | Set block parameter Output signal type
(OutputSignalType ) to auto or
real . | |
Block input and block parameter Intermediate
results
(IntermediateResultsDataTypeStr ) do
not have the same data type. | Set block parameter Intermediate results
(
| |
Block inputs and outports data types are not single or
double . | Fix the listed block inport or outport. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Assignment blocks | Index port is not of a supported data type. | Modify index port so that it is of data type int8 ,
int16 , int32 , uint8 ,
uint16 , or uint32 . |
Initialize output (Y)
( | Set Initialize output (Y) to
| |
Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Polynomial blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Input port data types are not single or
double . | Modify the listed input port data types. | |
Number of coefficients for block parameter Polynomial
Coefficients (coefs ) is not greater than zero. | Modify the number of coefficients for block parameter Polynomial
Coefficients (coefs ) to be greater than zero.
| |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Dot Product blocks | Input ports are not scalars, vectors, or single-column matrices. | Modify the listed input ports. |
Input port data types are not single or
double . | Modify the listed input port data types. | |
Input and output ports do not have the same data type. | Modify the port data types to match. | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Unary Minus blocks | Input port data types are not double ,
single , int8 , int16 , or
int32 . | Modify the listed input port data types. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.SignalAttributesBlocksUsage
Check for usage of Signal Attributes blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Signal Attributes blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Data Type Conversion blocks | Block parameter Input and output to have equal
(ConvertRealWorld ) is not set to Real World Value
(RWV) . | Set Input and output to have equal to Real
World Value (RWV) . |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Block parameter Sample Time
(SampleTime ) is set to a constant sample time. | Set Sample Time to an explicit, non-constant value. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Data Type Duplicate blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Data Type Propagation blocks |
| Fix the listed block inport or outport. |
Check Signal Specification blocks | Variable-size signal (VarSizeSig ) is
not set to
No . | Set Variable-size signal to
No . |
Signal type (SignalType ) is set to
complex . | Set Signal type to
any type except
complex . | |
Sampling mode (SamplingMode ) is set
to Frame based . | Set Sampling mode to
any mode except Frame
based . | |
Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Signal Conversion blocks | Block parameter Output
(ConversionOutput ) is not set to Signal
copy . | Set Output to Signal copy . |
Block parameter Exclude this block from 'Block reduction'
optimization (OverrideOpt ) is not selected (set
to on ). | Select Exclude this block from 'Block reduction' optimization. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Rate Transition blocks | Block parameter Ensure data integrity during data
transfer (Integrity ) is not selected. | Select Ensure data integrity during data transfer. |
Block parameter Ensure deterministic data transfer (maximum
delay) (Deterministic ) is not selected. | Select Ensure deterministic data transfer (maximum delay). | |
Block parameter Initial conditions
(InitialCondition ) is not zero, non-zero scalar or does not
use the same data structure as the output data type. | Modify the block parameter to be zero, non-zero scalar, or to use the same data structure as the output data type. | |
Block parameter Initial conditions
(InitialCondition ) is empty, nonfinite, complex, uses range
selection or variable indexing on the elements of MATLAB structures, or has two or more dimensions. | Modify the block parameter so that is not empty, is not nonfinite, is not complex, does not use range selection or variable indexing on the elements of MATLAB structures, and does not have two or more dimensions. | |
Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Probe blocks | Block parameter Data type for sample time
(ProbeSampleTimeDataType ) is not set to
single or double . | Set block parameter Data type for sample time to
single or double . |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Width blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Unit Conversion blocks | Input port data type is not double or
single . | Modify the input port data type. |
Input and output ports do not have the same data type. | Modify the port data types to match. | |
Block does not use supported inport or outport units. | Modify the block to use supported inport and outport units. Conversions between the following are included:
| |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check IC blocks | Block parameter Initial value (Value )
is empty, nonfinite, complex, uses range selection or variable indexing on the
elements of MATLAB structures, or has two or more dimensions. | Modify the block parameter so that is not empty, is not nonfinite, is not complex, does not use range selection or variable indexing on the elements of MATLAB structures, and does not have two or more dimensions. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.LogicalandBitOperationsBlocksUsage
Check for usage of Logical and Bit Operations blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Logical and Bit Operations blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Relational Operator blocks | The data type of a block outport is not either an enumerated type with
default value 0, or boolean . | Modify the outport data type to be either an enumerated type with default
value 0, or boolean . |
Block input ports do not have the same data type. | Modify the input ports to have the same data type. | |
Block parameter Relational operator
(Operator ) is set to an unsupported value:
isInf , isNaN , or
isFinite . | Set Relational operator to a supported value:
<= , == , >= ,
~= , < , or
> . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Logical Operator blocks | Logical Operator block outport is not boolean or
uint8 . | Modify the data type of the outport to boolean or
uint8 . |
Block input ports do not have the same data type. | Configure the input ports to have the same data type. | |
Model parameter Casting modes is not set to
Nominal for XOR operators with
boolean operands. | Set model parameter Casting modes to
Nominal . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Bitwise Operator blocks | With Number of input
ports(NumInputPorts) set to 1
and Operator(logicop) set to
AND , OR ,
NAND , NOR , or
XOR , the inport data type is not a scalar. | Configure the inport data type to be a scalar. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check ArithShift blocks | Diagnostic for out of range shift value
(DiagnosticForOORShift ) is not set to
Error . | Set Diagnostic for out of range shift value to
Error . |
Binary points to shift
(BinPtShiftNumber ) is not set to
0 . | Set Bits points to shift to
0 . | |
Bits to shift: Number
(BitShiftNumber ) is not within the allowable range of the
inport data type. | Enter a Bits to shift: Number that is within the allowable range of the inport data type. | |
The following configuration parameters are set as follows:
when the source of Inport 2 is constant. | Modify the model so that the source of Input 2 is not constant. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Combinatorial Logic blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.LookupTablesBlocksUsage
Check for usage of Lookup Table blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Lookup Table blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Lookup Table blocks | Input and output ports do not have the same data type. | Modify the input and output ports to have the same data type. |
Block parameter Breakpoints specification
(BreakpointsSpecification ) is not set to Explicit
values . | Set Breakpoints specification to Explicit
values . | |
Block parameter Interpolation method
(InterpMethod ) is not set to Linear
point-slope . | Set Interpolation method to Linear
point-slope . | |
Block parameter Extrapolation method
(ExtrapMethod ) is not set to Clip or
Linear . | Set Extrapolation method to Clip or
Linear . | |
Block parameter Index search method
(IndexSearchMethod ) is not set to Binary
search or Linear search . | Set Index search method to Binary
search or Linear search . | |
Block parameter Support tunable table size in code
generation (SupportTunableTableSize ) is selected
(set to on ). | Clear the Support tunable table size in code generation parameter. | |
Block parameter Table data (Table ) is
empty, is nonfinite, uses range selection or variable indexing on the elements of
MATLAB structures, is complex, or has two or more dimensions. | Fix the Table data setting. | |
For Breakpoints specification
(BreakpointsSpecification ) set to Explicit
values , a Breakpoints block parameter is empty,
is nonfinite, uses range selection or variable indexing on the elements of
MATLAB structures, is complex, or has two or more dimensions. | Fix the Breakpoints 1 setting. | |
Breakpoints > Data Type is not using the same data type as the block input. | Modify the data types to match. Or consider setting Breakpoints >
Data Type to Inherit: Same as corresponding
input | |
Block parameter Table data
(TableDataTypeStr ) is not using the same data type as the
block output. | Modify the data types to match. | |
Block parameter Intermediate Results
(IntermediateResultsDataTypeStr ) is
not using the same data type as the block output. | Modify the data types to match. | |
Block or block output port is constant. | Set the sample time of the block or block output port to an explicit, non-constant sample time. | |
Block parameter Use one input port for all input
data
(UseOneInputPortForAllInputData ) is
selected. | Clear Use one input port for all input data. | |
A Lookup Table block uses a lookup table object with the Support tunable size property selected. | Clear the Support tunable size property. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Prelookup blocks | Block parameter Index search method
(IndexSearchMethod ) is not set to Binary
search or Linear search . | Set Index search method to Binary
search or Linear search . |
Block parameter Breakpoints specification
(BreakpointsSpecification ) is not set to
Explicit values . | Set Breakpoints specification to Explicit
values . | |
Block parameter Output selection is not set to
Index and fraction . | Set Output selection to Index and
fraction . | |
Block parameter Breakpoint > Data Type is not set to
Inherit: Same as input ,
single , or double . | Set Breakpoint > Data Type to Inherit:
Same as input , single , or
double . | |
Block parameter Index > Data Type
(IndexDataTypeStr ) is not set to
uint32 . | Set Index > Data Type to
uint32 . | |
Block parameter Fraction > Data Type
(FractionDataTypeStr ) is not set to
single or double . | Set Fraction > Data Type to
single or double . | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to
Floor . | |
Block parameter Use last breakpoint for input at or above upper
limit (UseLastBreakpoint ) is selected. | Clear the Use last breakpoint for input at or above upper limit parameter. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Interpolation Using Prelookup blocks | Intermediate results > Data Type
(IntermediateResultsDataTypeStr ) is
not set to Inherit:Inherit via internal rule ,
Inherit: Same as output ,
double , or single . | Set Intermediate results > Data Type to
Inherit:Inherit via internal rule ,
Inherit: Same as output ,
double , or single . |
Output > Data Type
(OutDataTypeStr ) is not set to Inherit:Inherit via
back propagation , Inherit: Inherit from ‘Table
data’ , double , or
single . | Set Output > Data Type to
Inherit:Inherit via back propagation ,
Inherit: Inherit from ‘Table data’ ,
double , or single . | |
Table data > Data Type
(TableDataTypeStr ) is not set to Inherit:
Inherit from ‘Table data’ , Inherit: Same as
output , double , or
single . | Set Table data > Data Type to Inherit:
Inherit from ‘Table data’ , Inherit: Same as
output , double , or
single . | |
Internal Rule Priority
(InternalRulePriority ) is not set to
Precision . | Set Internal Rule Priority to
Precision . | |
Number of sub-table selection dimensions or the index
value (k ) from Prelookup block is not of data
type uint32 . | Set Number of sub-table selection dimensions and the
index value to be of data type uint32 . | |
Intermediate results > Data Type
(IntermediateResultsDataTypeStr ),
Table data > Data Type
(TableDataTypeStr ), Output > Data
Type (OutDataTypeStr ), and the fraction value
(f ) from Prelookup block are not the same data
type: double or single . | Set Intermediate results > Data Type, Table
data > Data Type, Output > Data Type , and
the fraction value to be the same data type: double or
single . | |
Integer rounding mode (RndMeth ) is
not set to Floor . | Set Integer rounding mode to
Floor . | |
Saturate on integer overflow
(SaturateOnIntegerOverflow ) is selected (set to
on ). | Clear Saturate on integer overflow. | |
Block is constant or connects all subtable selection inports to constant blocks. | Modify the blocks so that they are not constant and do not connect all subtable selection inports to constant blocks. | |
Blocks or their outports have a constant sample time. | Set sample times of the blocs or block output ports to explicit non-constant sample times. | |
Block parameter Interpolation method
(InterpMethod ) is not set to Linear
point-slope . | Set Interpolation method to Linear
point-slope . | |
Block parameter Require index and fraction as bus
(RequireIndexFractionAsBus ) is selected (set to
on ). | Clear Require index and fraction as bus. | |
Block parameter Valid index input may reach last index
(ValidIndexMayReachLast ) is selected (set to
on ). | Clear Valid index input may reach last index. | |
Block parameter Specification
(TableSpecification ) is not set to Explicit
values . | Set Specification to Explicit
values . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.UserDefinedFunctionBlocksUsage
Check for usage of User-Defined Function blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in User-Defined Function blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check S-Function blocks | The S-function was not created using the current release of the Legacy Code Tool. | If possible, create the S-function using the Legacy Code Tool, or explore alternatives for including the code in the model. |
An S-function argument is neither a scalar nor a vector of fixed dimension. | Modify the S-function such that arguments are scalars or vectors of fixed dimension. | |
The Legacy Code Tool S-function specifies a
InitializeConditionsFcnSpec , StartFcnSpec ,
or TerminateFcnSpec , rather than an
OutputFcnSpec . | Modify the S-function configuration to specify an
OutputFcnSpec . | |
The S-function has more than one dwork . | Modify the S-function configuration to specify one
dwork . | |
S-function parameters (Parameters ) is
complex or non-finite. | Modify the model so that S-function parameters is not complex or non-finite. | |
The integrated model of an S-function SIL block uses a global variable for a root input or output port. | Modify the model so that it does not use global variables for root input or output ports. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.PortsandSubsystemsBlocksUsage
Check for usage of Ports and Subsystems blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Ports and Subsystems blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Enable blocks | The signal entering the enable port is not of data type
boolean . | Fix the signal data type. |
The Enable Port block is located at the root level of the model. | Remove or relocate the Enable Port block. | |
Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined and the signal entering the Enable Port of the parent
subsystem is constant. | Modify the model so that the signal entering the Enable Port of the parent subsystem is not constant. | |
Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Model Reference blocks | Value that is specified in Arguments > Model arguments (ParameterArgumentValues ) is complex or
nonfinite. | Modify the model so that values specified in Model arguments are not complex or nonfinite. |
Block is in protected mode. | Remove protection from the model reference. For more information, see Protect Models to Conceal Contents (Simulink Coder). | |
Block or block output port is constant. | Set the sample time of the block or block output port to an explicit, non-constant sample time. | |
Block has multiple sample times. | Modify the model reference target so that the Model Reference block has a single sample time. | |
Block input port is not one of the following supported data types:
| Fix the input port data type. | |
For input ports within a triggered model reference block, Latch
input by delaying outside signal
(LatchByDelayingOutsideSignal ) is selected (set to
on ). | Clear Latch input by delaying outside signal. To retain the latching behavior, restructure the model by placing a Unit Delay block before the input block, outside the model reference block. | |
For input ports of a model reference block, Latch input for
feedback signals of function-call subsystem outputs
(LatchInputForFeedbackSignals ) is selected (set to
on ). | Clear Latch input for feedback signals of function-call subsystem outputs. To retain the latching behavior, restructure the model by placing a Unit Delay block before the input block, outside the model reference block. | |
Model blocks use the instance parameters of referenced models as arguments. | Modify the model so that the Model blocks do not use the instance parameters of referenced models as arguments. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Subsystem blocks | Subsystem variants do not have the same number of ports. | If possible, reconfigure the model so that variant subsystems have the same number of ports. |
The subsystem is not one of the following:
| If possible, reconfigure the subsystem to be either virtual (clear the Subsystem block parameter Treat as atomic unit), or an inlined atomic, enabled, function-call, if action, or triggered subsystem. Alternatively, wrap the subsystem in a Model block, or explore other implementation options. | |
Subsystem is a Simulink Function block. | Modify the model to remove the Simulink Function blocks. | |
For blocks with variants, either of these conditions apply:
| Clear Generate preprocessor conditionals or set
Model Configuration Parameters > Code Generation > Interface
> Generate preprocessor conditionals to Disable
all . | |
Block parameter Minimize algebraic loop
occurrences ( | Clear Minimize algebraic loop occurrences. | |
For nonvirtual subsystems, Function packaging
( | Set Function packaging to
| |
For block with Function packaging
(
| Fix the block and model parameters. | |
For block with Function packaging
(
|
| |
Block port has arrays of buses or buses with elements that are arrays of buses. | Modify the model so that the Model blocks do not use the instance parameters of referenced models as arguments. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
In the reusable subsystem, a hidden signal buffer has been automatically added at its inport. | Manually place a Signal Conversion block just before the inport of reusable subsystem. Select the signal conversion block parameter Exclude this block from 'Block reduction' optimization. | |
Check Trigger blocks | In the parent subsystem, the signal entering the trigger port is not a scalar. | Configure the signal entering the trigger port of the parent subsystem to be scalar. |
In the parent subsystem, the signal entering the trigger port is not a
boolean data type when Trigger type
(TriggerType ) isrising ,
falling , or either . | Configure the signal entering the trigger port of the parent subsystem to be
boolean . | |
Block is at the root level of the model with Trigger
type (TriggerType ) set to
rising , falling , or
either . | Do one of the following:
| |
States when enabling
(StatesWhenEnabling ) is set to
inherit . | Set States when enabling to held or
reset . | |
Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined and the signal entering the Trigger Port of the
parent subsystem is constant. | Modify the model so that the signal entering the Trigger Port of the parent subsystem is not constant. | |
Output ports data type is not auto ,
int8 or double . | Fix the output port data type. | |
Block parameter Initial trigger signal
state (InitialTriggerSignalState ) is not set to
compatibility (no trigger on first evaluation) or
zero . | Set Initial trigger signal state to
compatibility (no trigger on first evaluation) or
zero . | |
Block port has arrays of buses or buses with elements that are arrays of buses. | Modify the model so that the Model blocks do not use the instance parameters of referenced models as arguments. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport | |
Check Action Port blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check If blocks | Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined and the source of Inport 1 is constant. | Modify the model so that the source of Input 1 is not constant. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Function-Call Generator blocks | Block has more than one destination. | Modify the model so that the block has one destination. |
The Number of iterations
(numberOfIterations ) is not set to
1 . | Set the Number of iterations to
1 . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Function-Call Split blocks | Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check Switch Case blocks | Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined , and the source of Inport 1 is constant. | Modify the model so that the source of Input 1 is not constant. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check For Iterator blocks | Block parameter Set next i (iteration variable)
externally (ExternalIncrement ) is selected (set to
on ). | Clear Set next i (iteration variable) externally. |
Iteration limit source
(IterationSource ) is not set to
internal . | Set Iteration limit source to
internal . | |
Iteration variable data type
(IterationVariableDataType ) is set to
double . | Set Iteration variable data type to
int32 , int16 , or
int8 . | |
For Iterator subsystem has a tunable parameter for internal iteration limit. | Set Default parameter behavior
(DefaultParameterBehavior ) to
Inlined or modify the internal iteration limit so
that it is not a tunable parameter. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check For Each blocks | Input Partition Dimension or Output Concatenation Dimension is greater than 2. | Set Input Partition Dimension and Output Concatenation Dimension to values less than 3. |
Mask parameters are partitioned. | Configure mask parameters so that they are not partitioned. | |
NeedActiveIterationSignal is set to
on . | Set NeedActiveIterationSignal to
off . | |
RequestParallelExec is set to
off . | Set RequestParallelExec to on . | |
ShowIterationIndex is set to
on . | Set ShowIterationIndex to off . | |
StateReset is not set to held . | Set StateReset to held . | |
StateType is not set to Separate states for each
iteration . | Set StateType to Separate states for each
iteration . | |
Number of iterations to execute is not set to
-1 (default value). | Set the Number of iterations to execute to the default
value -1 . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.DiscontinuitiesBlocksUsage
Check for usage of Discontinuities blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Discontinuities blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Saturate blocks | Input and output ports do not have the same data type. | Modify the port data types to match. |
Block parameter Upper limit
(UpperLimit ) is empty, is nonfinite, uses range selection or
variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Upper limit setting. | |
Block parameter Lower limit
(LowerLimit ) is empty, is nonfinite, uses range selection or
variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Lower limit setting. | |
Block parameter Integer rounding mode
(RndMeth ) is set to an unsupported value. | Set Integer rounding mode to Zero or
Floor . | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Relay blocks | Block parameter Switch on point
(OnSwitchValue ) is empty, is nonfinite, uses range selection
or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Switch on point setting. |
Block parameter Switch off point
(OffSwitchValue ) is empty, is nonfinite, uses range selection
or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Switch off point setting. | |
Block parameter Output when on
(OnOutputValue ) is empty, is nonfinite, uses range selection
or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Output when on setting. | |
Block parameter Output when off
(OffOutputValue ) is empty, is nonfinite, uses range selection
or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Output when off setting. | |
Check Dead Zone blocks | Block parameter Saturate on integer overflow
(SaturateOnIntegerOverflow ) is selected (set to
on ). | Fix the Saturate on integer overflow setting. |
Check ID:
mathworks.slci.SinksBlocksUsage
Check for usage of Sinks blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Sinks blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Outport blocks | The block cannot specify variable-dimension signals. Block parameter
Variable-size signal (VarSizeSig ) is set
to Yes . | Set Variable-size signal to
No . |
Signal type (SignalType ) is set to
complex . | Set Signal type to real or
auto . | |
Sampling mode (SamplingMode ) is set
to Frame based . | Set Sampling mode to Sample based or
auto . | |
Root level outport Initial output
(InitialOutput ) is not [] . | Set root level outport Initial output to
[] . | |
Source of initial output value
(SourceOfInitialOutputValue ) is not set to
Dialog . | Set Source of initial output value to
Dialog . | |
Initial output (InitialOutput ) is
complex. | Modify the model so that Initial output is not complex. | |
Storage Class (StorageClass ) is not
Auto . | In the Code Mappings editor, set Storage Class to
Auto . To open the Code Mappings editor, first open the
Embedded Coder app. Then on the C Code
tab, under Code Interface select Individual
Elements Code Mappings. | |
Outport is an Out Bus Element block. | Instead of an Out Bus Element block, use an Outport block with a Bus Creator block. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Terminator blocks | Block port has arrays of buses or buses with elements that are arrays of buses. | Fix the listed block port so that the block does not use arrays of buses or buses with elements that are arrays of buses. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.DiscreteBlocksUsage
Check for usage of Discrete blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Discrete blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check Unit Delay blocks | Block parameter Initial conditions
(InitialCondition ) is empty, is nonfinite, uses range
selection or variable indexing on the elements of MATLAB structures, is complex, or has two or more dimensions. | Fix the Initial conditions setting. |
Block parameter Input Processing
(InputProcessing ) is set to Columns as channels
(frame based) . | Set Input Processing to Elements as
channels (sample based) or
Inherited . | |
When block state resolves to a signal with a custom signal storage class, the signal storage class:
| Modify the custom signal storage class. | |
Block state resolves to a signal object with a non-empty initial value. | Modify the signal object. | |
Block is used for rate transition. | Replace block used for rate transition with a Rate Transition block. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Discrete Integrator blocks | Input ports data types are not single or
double for non-reset ports. | Modify the input ports data types to be single or
double for non-reset ports. |
Inports and outports are not scalars. | Modify the inport or outports to be scalars. | |
Output ports data types are not single or
double . | Modify the output ports data types to be single or
double . | |
The input and output ports do not have the same data type. | Modify the port data types to match. The reset port data type does not need to match the other input and output data types. | |
Block parameter Integrator method
(
| Set Integrator method to one of the following:
| |
Block parameter Show state port
(ShowStatePort ) is selected. | Clear Show state port. | |
Block parameter External reset
(ExternalReset ) is not set to
none . | Set block parameter External reset to
none . | |
Either or both block parameters Upper saturation
limit (
| Set both the Upper saturation limit and the Lower saturation limit to a one-dimensional, non-complex, finite value. | |
Block is inside a conditional subsystem. | Modify the model so that the Discrete Integrator block is not inside a conditional subsystem. | |
Default parameter behavior
(DefaultParameterBehavior ) is set to
Inlined ) and the source of block Inport 2 is
constant. | Set the sample times of the blocks to explicit, non-constant sample times. Modify the model so that the source of block Input 2 is not constant. | |
When block state resolves to a signal with a custom signal storage class, the signal storage class:
| Modify the custom storage class. | |
Block state resolves to a signal object with a non-empty initial value. | Modify the signal object. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. | |
Check Delay blocks | Block parameter Input processing
(InputProcessing ) is set to Columns as channels
(frame based) . | Set Input processing to something other than
Columns as channels (frame based) . |
Block parameter Show enable port
(ShowEnablePort ) is selected. | Clear Show enable port. | |
Violates a constraint that applies to all blocks:
|
Check ID:
mathworks.slci.StateflowBlocksUsage
Check for usage of Stateflow blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow blocks.
Available with Simulink Code Inspector.
Check | Condition | Recommended Action |
---|---|---|
Check Stateflow blocks | Function packaging (RTWSystemCode ) is
not set to Inline . | Set Function packaging to Inline ,
Nonreusable function or Reusable function .
If you select Nonreusable function , the subsystem must be in
the following configurations:
Reusable function , the model must
use the following configurations:
|
Reusable subsystems in the model are not from a library and are not unmasked single-rate atomic or function-call subsystems. | Modify the reusable subsystems in the model so that they are from a library and unmasked single-rate atomic or function-call subsystems. | |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Chart (Stateflow)
Chart Programming (Stateflow)
Check ID:
mathworks.slci.StringBlocksUsage
Identify usage of String blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in String blocks.
Subcheck | Condition | Recommended Action |
---|---|---|
Check ASCII to String blocks | The dimension of the input is greater than or equal to the value of the parameter Buffer size of dynamically-sized string (bytes) (Simulink Coder). | Fix the input dimension. |
Violates a constraint that applies to all blocks:
| Fix the listed block inport or outport. |
Check ID:
mathworks.slci.chartsSFObjsUsage
Check for usage of Stateflow charts that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow charts.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check usage of Stateflow object palette | The chart contains one or more of the following objects:
| Configure the chart so that it does not contain the unsupported objects. |
Check name usage in a Stateflow chart that uses MATLAB action language | A chart that uses MATLAB action language does not have unique names for the Simulink functions, graphical functions, and truth tables it contains. | Use unique names for the functions, graphical functions, and truth tables in the chart. |
Check that all charts unselect ‘Create data for monitoring child activity’ option | Chart property Create data for monitoring child activity
is selected (set to on ). | Clear the chart property Create data for monitoring child activity parameter. |
Check that all charts specify 'Inherited' as their update method | Chart property Update method is not set to
Inherited . | Set Update method to
Inherited . |
Check that states or substates have a default transition | Chart has a state or a substate without a default transition. | Configure the chart so that states and substates have default transitions. |
Check that all charts unselect ‘Enable Super Step Semantics’ option | Chart property Enable Super Step Semantics is selected
(set to on ). | Clear the chart property Enable Super Step Semantics parameter. |
Check that no charts execute at initialization | Chart property Execute (enter) Chart at Initialization
is selected (set to on ). | Clear the chart property Execute (enter) Chart at Initialization parameter. |
Check that no charts export chart level functions | Chart property Export Chart Level Functions is selected
(set to on ). | Clear the chart property Export Chart Level Functions parameter. |
Check that no charts specify saturation on overflow for integer operations | Chart property Saturate on integer overflow is selected
(set to on ). | Clear the chart property Saturate on integer overflow parameter. |
Check usage of State Machine Type | Chart property State Machine Type is set to
Moore . | Set State Machine Type to
Classic or Mealy . |
Check that no charts support variable-size arrays | Chart property Support variable-size arrays is selected
(set to on ). | Clear the chart property Support variable-size arrays parameter. |
Check that all control flows have unique default transitions | Control flow has more than 1 default transition. | Configure the chart so that it has 1 default transition. |
Chart Programming (Stateflow)
Chart (Stateflow)
Check ID:
mathworks.slci.MATLABactionlanguageStateflowUsage
Check for usage of Stateflow MATLAB action language that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow MATLAB action language usage.
Available with Simulink Code Inspector.
For subchecks run to check the usage of MATLAB action language in Stateflow charts, see Check usage of Code in MATLAB Functions.
Chart Programming (Stateflow)
Chart (Stateflow)
Check ID:
mathworks.slci.transitionsSFObjsUsage
Check for usage of Stateflow transitions that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow transitions.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check that actions do not have unsupported operations | Action uses an operation that is not supported:
| Modify the chart so that action uses only supported operations. |
Check for indexing in arrays that are more than one dimension | Array of more than one dimension uses indexing. | Modify the transition to use one-dimensional arrays or avoid indexing for arrays that are more than one dimension. |
Check that all arrays use index of type 'int32' | Array does not use index of data type
int32 . | Modify the array index so that it uses data type
int32 . |
Check that all transition conditions are of boolean data type | Transition condition is not of boolean data type. | Modify the transition condition so that it is of boolean data type. |
Check that no actions access context-sensitive constants | Action uses context-sensitive constants, which is not supported for code inspection. | Modify the action to avoid using context-sensitive constants. |
Check that no actions access custom data | Action accesses custom data, which is not supported for code inspection. | Modify the transitions to:
|
Check that conditions and actions do not have unsupported operations on enumeration type operands | Transition uses one of the following unsupported operations on an enumeration type operand:
| Modify the transition to avoid using unsupported operations on enumeration type operands. |
Check that no transitions have event triggers | Transition has an event trigger, which is not supported for code inspection. | Modify the transition to avoid using an event trigger. |
Check data type of Graphical Function arguments | Transition specifies graphical function calls with different actual and expected argument data types. | Modify the transition to specify graphical function calls with the same data types for actual and expected arguments. |
Check dimensions of Graphical Function arguments | Transition specifies graphical function calls with different actual and expected argument sizes. | Modify the transition to specify graphical function calls with the same size for actual and expected arguments. |
Check that transitions do not have transition actions | Transitions has a transition action, which is not supported for code inspection. | Modify the transition to avoid using a transition action. |
Check that Stateflow transitions do not reuse induction variables outside of a loop | Transition has an unsupported induction variable reuse. | Modify the transition so that the induction variable is not reused. |
Check that no actions contain a function whose argument is of an invalid data type | Math function in an action is not a:
| Modify the math function to use supported data types. |
Check that transitions do not have an unsupported loop step | Transition has an unsupported loop step. | Modify the transition so that there is a single action statement that
increments the int32 scalar loop induction step with a literal
int32 constant value. |
Check that transitions do not have an unsupported loop body | Transition has an unsupported loop body. | Modify the transition so that there are no actions that redefine the loop induction variable. |
Check that transitions do not have an unsupported loop condition | Transition has an unsupported loop condition. | Modify the transition condition so that it has either a single
< or a single <= condition with a
literal int32 constant bound and a scalar
int32 loop induction variable. |
Check for valid induction variable in transition that defines loop condition | Transition that defines loop condition has an invalid induction variable. | Modify the loop condition so that it has only
one < or <= condition with a scalar
Stateflow local or temporary scope loop induction variable. |
Check that transitions do not have unsupported loop induction variable initialization | Transition has unsupported loop induction variable initialization. | Modify the transition so that initialization of the scalar loop induction
variable is a single action statement that uses an int32 data
type and initializes the variable with a literal constant int32
value. |
Check that no actions contain an xor operator with boolean operands | Action contains an XOR operator with boolean operands with
model parameter Casting modes set to
Standards . | Modify the action to avoid using an XOR operator with
boolean operands, or set Casting modes to
Nominal . |
Check that no actions contain a binary operator whose operands are of mixed data type | Action contains a binary operator of mixed data type operands, which is not supported for code inspection. | Modify the chart to avoid using binary operators with operands of mixed data type. |
Check that no transitions have a function with more than 2 arguments | Transition has a function with more than 2 arguments. | Modify each function to have no more than 2
arguments. It might be possible to replace a function with more than 2 arguments
with a series of functions that have no more than 2
arguments. For example, a MinMax function with 3 inputs could
be replaced with 2 MinMax functions, each with 2
arguments. |
Check data type of Simulink Function argument | The actual Simulink function call argument data type differs from the argument data type of the inport and outport in the defining Function-Call Subsystem. | Modify the Simulink function call to have the same argument data type as the inport and outport in the defining Function-Call Subsystem. |
Check dimension of Simulink Function argument | The actual Simulink function call argument size differs from the argument size of the inport and outport in the defining Function-Call Subsystem. | Modify the Simulink function call to have the same argument data size as the inport and outport in the defining Function-Call Subsystem. |
Check that no actions access time (t) | Action accesses time, which is not supported for code inspection. | Modify the action to avoid accessing time. |
Check data type of truth table arguments | Transition specifies a truth table with different actual and expected argument data types. | Modify the transition to specify truth tables to use the same data types for actual and expected arguments. |
Check dimensions of truth table arguments | Transition specifies a truth table with different actual and expected argument sizes. | Modify the transition to specify truth tables to use the same sizes for actual and expected arguments. |
Check unassigned graphical function outputs | A chart specifies graphical function calls with a different number of actual and expected outputs. | Modify the chart so that graphical functions assign all outputs. |
Check that Stateflow transitions are not configured as variant transitions | Stateflow chart contains transitions that are configured as variant transitions. | Modify the chart to avoid using variant transitions. |
Stateflow Charts (Stateflow)
Transitions (Stateflow)
Transition Connections (Stateflow)
Default Transitions (Stateflow)
Check ID:
mathworks.slci.junctionsSFObjsUsage
Check for usage of Stateflow junctions that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow junctions.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check that Stateflow junctions do not have outgoing transitions jumping outside of the loop | Junction has an outgoing transition that jumps outside of a loop body. | Modify the chart so that a junction within a loop does not have outgoing transitions jumping outside of the loop. |
Check that non-terminating junctions have exactly one unconditional exiting transition | Non-terminating junction does not have exactly one unconditional exiting transition. A single unconditional exiting transition prevents backtracking and transition shadowing. | Modify junction so that it has one unconditional exiting transition. |
Check that the chart uses no history junctions | Chart contains a history junction. | Modify chart so that it does not contain a history junction. |
Check that control flows do not have loops with unsupported header junctions | Header junction does not have two incoming and two outgoing transitions. | Modify header junction so that it has two incoming and two outgoing transitions. |
Check usage of terminating Stateflow junctions | Terminating junction traces back to a Stateflow state. | Modify the junction so that it does not trace back to a Stateflow state. |
Check that control flows are structured | Chart contains unstructured control flows, which are not supported for code inspection. | Modify the chart so that it does not contain unstructured control flows. |
Check that unconditional transitions execute last in execution order | Unconditional transition is not last in order of execution. | Modify chart so that the unconditional transition is the last in order of execution. This prevents transition shadowing. |
Check ID:
mathworks.slci.dataSFObjsUsage
Check for usage of Stateflow data that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow data.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check that the chart does not define Stateflow data with Constant scope | Chart defines Stateflow data with Constant scope. | Modify chart to avoid defining Stateflow data with Constant scope. |
Check usage of Stateflow data Initialize Method | InitializeMethod for Local or
Output scope Stateflow data is set to Parameter . | Modify the chart to not set InitializeMethod to
Parameter . In the Model Explorer, for Stateflow data withLocal or Output
scope, you can set InitializeMethod for the Initial
value to Expression . |
Check that states and boxes do not define Stateflow data | State or box defines Stateflow data. | Modify state or box so that it does not define Stateflow data. |
Check that Stateflow data is of a supported data type | Chart data types are not builtin ,
enumerated , or bus . If the chart data type
is a bus and chart uses C as the action language, the data is
an array of buses or has elements that are arrays of buses. If the chart data type
is enumerated , the default value of the data is not
0 . | Modify chart data types to be builtin ,
enumerated , or bus . If the chart data type
is bus and chart uses C as the action language, modify the
chart so that the data is not an array of buses or have elements that are arrays
of buses. If the chart data type is enumerated , update the
chart so that the enumerated data type has a default value of
0 . |
Check that the 'First Index' of Stateflow data are empty or 0 | The First Index property for Stateflow data is not empty or 0. | Modify the First Index property of the Stateflow data to be empty or 0. |
Check that Stateflow parameter data sizes in Stateflow and the base workspace match | Size of Stateflow parameter data is different in Stateflow and the base workspace. | Modify the size of the Stateflow parameter data so that it is the same in Stateflow and the base workspace. |
Check that the chart uses only non-complex data | Chart uses complex data. | Modify chart so that it does not use complex data. |
Data Specification Basics (Stateflow)
Events (Stateflow)
Check ID:
mathworks.slci.eventsSFObjsUsage
Check for usage of Stateflow events that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow events.
Available with Simulink Code Inspector.
Check | Condition | Recommended Action |
---|---|---|
Check that the chart uses only events of scope Local or Output | Event scope is not Output or
Local . | Modify charts to avoid using input events. |
Check that the chart uses only function-call events | Event trigger is not function-call . | Modify model so that event trigger is
function-call |
Data Specification Basics (Stateflow)
Events (Stateflow)
Check ID:
mathworks.slci.statesSFObjsUsage
Check for usage of Stateflow states that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow states.
Available with Simulink Code Inspector.
Check | Condition | Recommended Action |
---|---|---|
Check that control flows do not have cycles | Chart contains control flow cycles, which are not supported for code inspection. | Configure the chart so that it does not contain control flow cycles. |
Check that actions do not have unsupported operations | Action uses an operation that is not:
| Modify the chart so that action uses only supported operations. |
Check for indexing in arrays that are more than one dimension | Array of more than one dimension uses indexing. | Modify the state to use one-dimensional arrays or avoid indexing for arrays that are more than one dimension. |
Check that all arrays use index of type 'int32' | Array does not use index of data type
int32 . | Modify the array index so that it uses data type
int32 . |
Check that no actions access context-sensitive constants | Action uses context-sensitive constants, which is not supported for code inspection. | Modify the action to avoid using context-sensitive constants. |
Check that no actions access custom data | Action accesses custom data, which is not supported for code inspection. | Modify the action to avoid accessing custom data. |
Check that states or substates have a default transition | Chart has a state or a substate without a default transition. | Configure the chart so that states and substates have default transitions. |
Check that actions do not have unsupported operations on enumeration type operands | State uses one of the following unsupported operations on an enumeration type operand:
| Modify the state to avoid using unsupported operations on enumeration type operands. |
Check data type of Graphical Function arguments | State specifies graphical function calls with different actual and expected argument data types. | Modify the state to specify graphical function calls with the same data types for actual and expected arguments. |
Check dimensions of Graphical Function arguments | State specifies graphical function calls with different actual and expected argument sizes. | Modify the state to specify graphical function calls with the same size for actual and expected arguments. |
Check that no actions contain a function whose argument is of an invalid data type | Math function in an action is not a:
| Modify the math function to use supported data types. |
Check that no actions contain an xor operator with boolean operands | Action contains an XOR operator with boolean operands with
model parameter Casting modes set to
Standards . | Modify the action to avoid using an XOR operator with
boolean operands, or set Casting modes to
Nominal . |
Check that no actions contain a binary operator whose operands are of mixed data type | Action contains a binary operator of mixed data type operands, which is not supported for code inspection. | Modify the chart to avoid using binary operators with operands of mixed data type. |
Check that no Stateflow functions have more than 2 arguments | Stateflow function has more than 2 arguments. | Modify the Stateflow function to have no more than 2 arguments. It might be possible to replace the function with a series of functions, each with no more than 2 arguments. |
Check usage of States with recursive send function calls | State contains recursive send function calls. | Modify the state so that there are no recursions. |
Check data type of Simulink Function arguments | State specifies a function call with different actual and expected argument data types. | Modify the state to specify Simulink function calls to use the same data types for actual and expected arguments. |
Check dimensions of Simulink Function arguments | State specifies a function call with different actual and expected argument sizes. | Modify the state to specify Simulink function calls to use the same sizes for actual and expected arguments. |
Check usage of Stateflow state InlineOption | State property Function Inline Option is set to
Auto or Function . | Set state property Function Inline Option to
Inline . |
Check that all states unselect ‘Create data for monitoring’ option | State property Create data for monitoring is selected
(set to on ). | Clear the state property Create data for monitoring parameter. |
Check that no actions access time (t) | Action accesses time, which is not supported for code inspection. | Modify the action to avoid accessing time. |
Check data type of truth table arguments | State specifies a truth table with different actual and expected argument data types. | Modify the state to specify truth tables to use the same data types for actual and expected arguments. |
Check dimensions of truth table arguments | State specifies a truth table with different actual and expected argument sizes. | Modify the state to specify truth tables to use the same sizes for actual and expected arguments. |
Check that control flows are structured | State contains unstructured control flows, which are not supported for code inspection. | Configure the chart so that it does not contain unstructured control flows. |
Check that all control flows have unique default transitions | Control flow has more than 1 default transition. | Configure the chart so that it has 1 default transition. |
Check that all transition paths are either inner transitions to a substate, or outer transitions to siblings, direct parent, or direct substates | The state uses a transition path that is not one of the following:
| Configure the transitions so that it uses a supported path. |
Check unassigned graphical function outputs | A chart specifies graphical function calls with a different number of actual and expected outputs. | Modify the chart so that graphical functions assign all outputs. |
Reuse Simulink Components in Stateflow Charts (Stateflow)
States (Stateflow)
Check ID:
mathworks.slci.graphicalfunctionsSFObjsUsage
Check for usage of Stateflow graphical functions that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow graphical functions.
Available with Simulink Code Inspector.
Check | Condition | Recommended Action |
---|---|---|
Check that control flows do not have cycles | Graphical function contains control flow cycles, which are not supported for code inspection. | Configure the graphical function so that it does not contain control flow cycles. |
Check usage of InlineOption setting | Graphical function property Function Inline Option is
set to Auto . | Set graphical function property Function Inline Option
to Inline or
Function . |
Check configuration for models with non-inlined graphical functions | For a graphical function with Function Inline Option
(InlineOption ) set to Function ,
the configuration parameter Code interface packaging
(CodeInterfacePackaging ) is not set to
Nonreusable function | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Code interface
packaging (Simulink Coder) to Nonreusable
function . |
Check non-inlined graphical function names | Non-inlined function does not have a unique function name. | Modify the function names of non-inlined graphical functions to be unique. |
Check usage of recursive Stateflow function | Graphical function is recursive. | Configure the graphical function so that it is not recursive. |
Check that control flows are structured | Graphical function contains unstructured control flows, which are not supported for code inspection. | Configure the graphical function so that it does not contain unstructured control flows. |
Check ID:
mathworks.slci.truthtablesSFObjsUsage
Check for usage of Stateflow truth tables that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in Stateflow truth tables.
Available with Simulink Code Inspector.
Check | Condition | Recommended Action |
---|---|---|
Check that control flows do not have cycles | Truth table contains control flow cycles, which are not supported for code inspection. | Configure the truth table so that it does not contain control flow cycles. |
Check usage of InlineOption setting | Truth table property Function Inline Option is set to
Auto or Function . | Set truth table property Function Inline Option to
Inline . |
Check usage of recursive Stateflow function | Truth table is recursive. | Configure the truth table so that it is not recursive. |
Check usage of Stateflow truth table language | Truth table property Language is set to
MATLAB . | Set Language to C . |
Check that control flows are structured | Truth table contains unstructured control flows, which are not supported for code inspection. | Configure the truth table so that it does not contain unstructured control flows. |
Use Truth Tables to Model Combinatorial Logic (Stateflow)
Check ID:
mathworks.slci.MATLABFunctionBlocksUsage
Identify MATLAB Function blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds in MATLAB Function blocks.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for block names that contain ‘/*’,’*/’, or start or end with the character ‘*’ | Block name:
| Modify the listed block name. |
Check for unsupported usage of storage class | Block is constant and has outports of non-auto storage class. | Modify the block by either changing the output signal storage class, or modifying the block’s sample time. For example, if the block or its source is a Constant block, set the sample time of that Constant block to an explicit, non-constant sample time. |
Check for unsupported testpoints | Block is constant and an outport is testpointed. | Modify the block by either removing the output signal testpoints, or modifying the block’s sample time. For example, if the block or its source is a Constant block, set the sample time of that Constant block to an explicit, non-constant sample time. |
Check storage class of block outports | Block is using unsupported custom storage class Type,
Data initialization, or InitialValue
(InitialValue ). | Modify the output custom signal storage class:
|
Check for blocks with greater than two-dimensional inputs or outputs | Block inport or outport is not a scalar, vector, or 2–D matrix. | Modify block inport or outport to be a scalar, vector, or 2–D matrix. |
Check whether inputs and outputs are not framed | Block inport or outport uses frame-based signals. | Modify the model so that blocks use sample-based inports and outports. Check upstream blocks of the blocks listed in the results for blocks that output frame-based signals. |
Check that all MATLAB functions set ‘Update method’ to ‘Inherited’ | MATLAB function does not set Update method to
Inherited . | Modify the MATLAB function to set Update method to
Inherited . |
Identify Subsystems that have unsupported configurations for non-inlined | For MATLAB Function block, Function
packaging (RTWSystemCode ) is not set to
Inline . | Modify the MATLAB Function block to set Function
packaging (RTWSystemCode ) to
Inline , Nonreusable function or
Reusable function . If you select Nonreusable
function , the subsystem must be in the following configurations:
Reusable function , the model must
use the following configurations:
|
Check that reusable subsystems in a model are from a library and are unmasked single-rate atomic or function-call subsystems | The reusable subsystems in the model are not from a library and are not unmasked single-rate atomic or function -call subsystems. | Modify the reusable subsystems in the model so that they are from a library. These subsystems must be unmasked single-rate atomic or function-call subsystems. |
Check that MATLAB functions do not contain input Trigger signals | MATLAB function contains input Trigger signals. | Modify the MATLAB function to remove the usage of input Trigger signals. |
Check that blocks that are constant or whose parameters can be tuned, do not drive two or more multirate blocks without using explicit rate transition blocks | Block that is constant or has parameters that can be tuned drives two or more multirate blocks without using explicit Rate Transition blocks. | Modify the block to use explicit Rate Transition blocks. |
Check that all MATLAB functions set ‘Saturate on integer overflow’ to ‘Off’ | MATLAB function does not clear (set to off ) the
Saturate on integer overflow
(SaturateOnIntegerOverflow ) parameter. | Modify the MATLAB function to clear (set to off ) the
Saturate on integer overflow
(SaturateOnIntegerOverflow ) parameter. |
Check that all MATLAB functions set ‘Treat these inherited Simulink signal types as fi objects:’ to a value other than ‘Fixed-point & Integer’ | MATLAB function sets Treat these inherited Simulink signal types
as fi objects to Fixed-point &
Integer . | Modify the MATLAB function to set Treat these inherited Simulink signal
types as fi objects to a value other than Fixed-point
& Integer . |
Check that all MATLAB functions set ‘Support variable-size arrays’ to ‘Off’ | MATLAB function does not clear (set to off ) the
Support variable-size arrays parameter. | Modify the MATLAB function to clear (set to off ) the
Support variable-size arrays parameter. |
Check ID:
mathworks.slci.MATLABFunctionDataUsage
Identify data in MATLAB functions that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports incompatibilities it finds with data in MATLAB functions.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check that data defined in MATLAB function is of a supported data type | Data is not of a supported data type: built-in, bus, or an enumerated type
inherited from Simulink.IntEnumType . | Modify the data to be a supported data type. |
Check that data defined in MATLAB function is of a supported dimension | Data is not a scalar, vector, or matrix. | Modify the data to be a scalar, vector, or matrix. |
Check that data defined in MATLAB function is non-complex | Data is complex. | Modify the MATLAB function to avoid using complex data. |
Check ID:
mathworks.slci.RootOutportBlocksUsage
Check for usage of root Outport blocks that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports root Outport block usage incompatibilities.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Verify sample times | One or more root Outport blocks are constant. This will cause the model functions to fail validation, because the root outport assignment is moved to the model initialize function. | Set the sample times of the root Outport blocks to explicit, nonconstant sample times. |
Verify root Outports pass buses to parent models as structures | One or more root Outport blocks pass a bus to the parent model without passing the bus as a structure. This might cause Simulink software to insert a hidden Signal Conversion block in the parent model, which is not supported for code inspection. | For each instance, open the Outport block dialog box and select the parameter
Output as nonvirtual bus in parent model
(BusOutputAsStruct ). |
Check ID:
mathworks.slci.BusUsage
Check for usage of buses that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and reports bus usage incompatibilities.
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check for automatic conversion between virtual to nonvirtual buses | Simulink software performed an automatic conversion from a virtual to a nonvirtual bus at the interface of one or more listed blocks. This creates a hidden Signal Conversion block, which is not supported for code inspection. | Modify the model to use nonvirtual buses at the interfaces of the listed blocks. |
Verify that blocks in the model do not perform unsupported operations on a bus | In the model, a non-virtual block operates on a virtual bus or a Bus Assignment block operates on a non-virtual bus. | Modify the model so that no non-virtual blocks operate on a virtual bus and no Bus Assignment blocks operate on a non-virtual bus. This action simplifies bus processing to promote traceability and readability of generated code. |
Check ID:
mathworks.slci.SharedUtils
Check for usage of shared utilities that might impact compatibility with Simulink Code Inspector.
This check updates the model diagram and identifies incompatibilities with shared utilities usage.
Supported shared utilities include:
binsearch_u32d
intrp1d_l
intrp2d_l
intrp3d_l
look1_binlc
look2_binlc
plook_binlc
rt_hypotd
rt_hypotf
rt_modd
rt_modf
rt_remd
rt_remf
rt_roundd
rt_roundf
Available with Simulink Code Inspector.
Subcheck | Condition | Recommended Action |
---|---|---|
Check code generation symbols settings for shared utils inspection | Values for code generation symbols parameters are not supported for shared utilities inspection. | In the Configuration Parameters dialog box, on the Code Generation
> Identifiers pane, set Local temporary variables (Embedded Coder) to
default value $N$M and set Shared utilities identifier
format (Embedded Coder) to default value $N$C . |
Check standard math library settings for shared utils inspection | Standard math library settings are not supported for shared utilities inspection. | In the Configuration Parameters dialog box, on the Code Generation
> Interface pane, set Standard math library (Simulink Coder) to C89/C90
(ANSI) or C99 . |
Check code style settings for shared utils inspection | Values for code style configuration parameters are not supported for shared utilities inspection. | In the Configuration Parameters dialog box, on the Code Generation > Code Style pane:
|