Contenu principal

hisl_0008: Usage of For Iterator blocks

R2026b

Configure For Iterator blocks to support bounded iterative behavior in generated code

Usage: High-Integrity System Modeling

Guideline ID: hisl_0008

Rules

hisl_0008: Usage of For Iterator blocks
A

To support bounded iterative behavior in the generated code when using the For Iterator block, clear block parameter Set next i (iteration variable) externally and set block parameter Iteration limit source to internal.

Rationale

Support bounded iterative behavior in generated code.

Verification

Check usage of For Iterator blocks (Simulink Check)

B

To support bounded iterative behavior in the generated code when using the For Iterator block, clear block parameter Set next i (iteration variable) externally and when Iteration limit source is set to external, use a block that has a constant value to set the iteration limit. Options include Width, Probe, or Constant with non-tunable parameter.

Rationale

Support bounded iterative behavior in generated code.

Verification

Check usage of For Iterator blocks (Simulink Check)

Tips

  • When you use the For Iterator block, feed the loop control variable with fixed (nonvariable) values to get a predictable number of loop iterations. Otherwise, a loop can result in unpredictable execution times and, in the case of external iteration variables, infinite loops that can lead to execution-time overruns.

Industry Standards

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

  • IEC 61508-3, Table A.3 (3) 'Language subset'
    IEC 61508-3, Table A.4 (3) 'Defensive programming'

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

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

  • EN 50128, Table A.4 (11) 'Language Subset'
    EN 50128, Table A.3 (1) 'Defensive Programming'

  • EN 50657, Table A.4 (11) 'Language Subset'
    EN 50657, Table A.3 (1) 'Defensive Programming'

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

  • MISRA C:2012, Rule 14.2
    MISRA C:2012, Rule 16.4
    MISRA C:2012, Dir 4.1

  • MISRA C:2023, Rule 14.2
    MISRA C:2023, Rule 16.4
    MISRA C:2023, Dir 4.1

Version History

Introduced in R2010a

expand all