Block Usage
hisl_0020: Blocks not recommended for MISRA C:2012 compliance
ID: Title | hisl_0020: Blocks not recommended for MISRA C:2012 compliance | ||
---|---|---|---|
Description | To improve MISRA C:2012 compliance of the generated code: | ||
A | Use only blocks that support code generation, as documented in the Simulink® Block Support Table. | ||
B | Do not use blocks that are listed as “Not recommended for production code” in the Simulink Block Support Table. | ||
C | Do not use Lookup Table blocks using cubic spline interpolation or extrapolation methods. Specific blocks are:
| ||
D | Do not use deprecated Lookup Table blocks. The deprecated Lookup Table blocks are Lookup and Lookup2D. | ||
E | Do not use S-Function Builder blocks in the model or subsystem. | ||
F | Do not use From Workspace blocks in the model or subsystem. | ||
G | Do not use these String blocks in the model or subsystem:
| ||
Notes | If you follow this and other modeling guidelines, you can eliminate model constructs that are not suitable for C/C++ production code generation, at the same time, increase the likelihood of generating code that complies with the MISRA C:2012 standard. Use the Block Support Table block to view the Block Support Table. Blocks with the footnote (4) in the Block Support Table are classified as "Not recommended for production code". | ||
Rationale | A, B, C, D, E, F, G | Improve quality and MISRA C:2012 compliance of the generated code. | |
Model Advisor Checks | For A,B,C, D, E, F, and G: Check for blocks not recommended for MISRA C:2012 (Simulink Check) For A and B: Check for blocks not recommended for C/C++ production code deployment (Simulink Check) | ||
References |
| ||
Last Changed | R2018b |
hisl_0101: Prevent operations that result in dead logic to improve code compliance
ID: Title | hisl_0101: Prevent operations that result in dead logic to improve code compliance |
---|---|
Description | To improve the compliance of generated code, avoid operations that result in dead code or unreachable code. |
Rationale | Enhance clarity and prevention of dead code. |
Model Advisor Checks | Check for unreachable and dead code (Simulink Check) |
References |
|
Last Changed | R2022a |
Example | Not Recommended: The following examples displays operations that result in dead code or unreachable code. Stateflow: MATLAB function: Simulink: |
hisl_0102: Data type of loop control variables to improve MISRA C:2012 compliance
ID: Title | hisl_0102: Data type of loop control variables to improve MISRA C:2012 compliance |
---|---|
Description | To improve MISRA C:2012 compliance of generated code, use integer data type for variables that are used as loop control counter variables in:
|
Rationale | Improve MISRA C:2012 compliance of the generated code. |
Model Advisor Checks | Check data type of loop control variables (Simulink Check) |
References |
|
Last Changed | R2018a |