主要内容

hisl_0053: Configuration Parameters > Code Generation > Optimization > Remove code from floating-point to integer conversions that wraps out-of-range values

R2026b

Select removal of wrapping code to support verifiable generated code

Usage: High-Integrity System Modeling

Guideline ID: hisl_0053

Rules

hisl_0053: Configuration Parameters > Code Generation > Optimization > Remove code from floating-point to integer conversions that wraps out-of-range values

To support verifiable code, select configuration parameter Remove code from floating-point to integer conversions that wraps out-of-range values

Rationale

Support generation of code that can be verified.

Verification

Check safety-related optimization settings for data type conversions (Simulink Check)

Tips

  • Avoid overflows as opposed to handling them with wrapper code.

  • For blocks whose Saturate on integer overflow configuration parameter is cleared, deselecting Remove code from floating-point to integer conversions that wraps out-of-range values can add code that wraps out of range values, resulting in unreachable code that cannot be tested.

Industry Standards

  • DO-331, Section MB.6.3.1.g 'Algorithms are accurate'

    DO-331, Section MB.6.3.2.g 'Algorithms are accurate'

  • IEC 61508-3, Table A.4 (3) 'Defensive Programming'

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

  • ISO 26262-6, Table 1 (1d) 'Use of defensive implementation techniques'

  • EN 50128, Table A.3 (1) 'Defensive Programming'

  • EN 50657 Table A.3 (1) 'Defensive Programming'

  • EN 50716, Table A.3 (1) 'Defensive Programming'

  • MISRA C:2012, Rule 2.1

  • MISRA C:2023, Rule 2.1

  • INT32-C. Ensure that operations on signed integers do not result in overflow

Version History

Introduced in R2010a

expand all