This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Code Generation

hisl_0051: Configuration Parameters > Code Generation > Optimization > Loop unrolling threshold

ID: Titlehisl_0051: Configuration Parameters > Code Generation > Optimization > Loop unrolling threshold
Description

To support unambiguous code, set the minimum signal or parameter width for generating a for loop by setting Configuration Parameter Loop unrolling threshold to 2 or greater.

Notes

Loop unrolling threshold specifies the array size at which the code generator begins to use a for loop, instead of separate assignment statements, to assign values to the elements of a signal or parameter array. The default value is 5.

RationaleSupport unambiguous generated code.
Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related optimization settings for Loop unrolling threshold

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related optimization settings for Loop unrolling threshold

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related optimization settings for Loop unrolling threshold

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related optimization settings for Loop unrolling threshold

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related optimization settings for Loop unrolling threshold

For check details, see Check safety-related optimization settings for Loop unrolling threshold.

References
  • DO-331 Section MB.6.3.4.e—Source code is traceable to low-level requirements.

    IEC 61508-3, Table A.3 (3) 'Language Subset'

  • 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'

  • MISRA C:2012, Rule 6.1

See Also

Loop unrolling threshold (Simulink Coder) in the Simulink® documentation

Last ChangedR2018a

hisl_0052: Configuration Parameters > Code Generation > Optimization > Data initialization

ID: Titlehisl_0052: Configuration Parameters > Code Generation > Optimization > Data initialization
Description

To support complete definition of data and initialize internal and external data to zero, in the Configuration Parameters dialog box:

AClear Remove root level I/O zero initialization.
BClear Remove internal data zero initialization.
Note

Explicitly initialize all variables. If the run-time environment of the target system provides mechanisms to initialize all I/O and state variables, consider using the initialization of the target as an alternative to the suggested settings.

RationaleA, BSupport fully defined data in generated code.
Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data initialization

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data initialization

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data initialization

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data initialization

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data initialization

For check details, see Check safety-related optimization settings for data initialization.

References
  • DO-331, Section MB.6.3.3.b 'Software architecture is consistent’

  • 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'

See Also

Information about the following parameters in the Simulink documentation:

Last ChangedR2018b

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

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

To support verifiable code, in the Configuration Parameters dialog box, select Remove code from floating-point to integer conversions that wraps out-of-range values

Notes

Avoid overflows as opposed to handling them with wrapper code. For blocks that have parameter Saturate on integer overflow cleared, clearing configuration parameter Remove code from floating-point to integer conversions that wraps out-of-range values might add code that wraps out of range values, resulting in unreachable code that cannot be tested.

RationaleSupport generation of code that can be verified.
Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data type conversions

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data type conversions

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data type conversions

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data type conversions

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related optimization settings for data type conversions

For check details, see Check safety-related optimization settings for data type conversions.

References
  • 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'

  • MISRA C:2012, Rule 2.1

See AlsoRemove code from floating-point to integer conversions that wraps out-of-range values (Simulink Coder) in the Simulink documentation
Last ChangedR2018b

hisl_0054: Configuration Parameters > Code Generation > Optimization > Remove code that protects against division arithmetic exceptions

ID: Titlehisl_0054: Configuration Parameters > Code Generation > Optimization > Remove code that protects against division arithmetic exceptions
Description

To support the robustness of the operations, in the Configuration Parameters dialog box, clear Remove code that protects against division arithmetic exceptions.

Note

Avoid division-by-zero exceptions. If you clear Remove code that protects against division arithmetic exceptions, the code generator produces code that guards against division by zero for fixed-point data.

RationaleProtect against divide-by-zero exceptions for fixed-point code.
Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related optimization settings for division arithmetic exceptions

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related optimization settings for division arithmetic exceptions

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related optimization settings for division arithmetic exceptions

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related optimization settings for division arithmetic exceptions

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related optimization settings for division arithmetic exceptions

For check details, see Check safety-related optimization settings for division arithmetic exceptions.

References
  • 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.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(b) 'Use of language subsets'
    ISO 26262-6, Table 1(d) 'Use of defensive implementation techniques'

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

  • MISRA C:2012, Dir 4.1

See AlsoRemove code that protects against division arithmetic exceptions (Simulink Coder) in the Simulink documentation
Last ChangedR2018b

hisl_0056: Configuration Parameters > Code Generation > Optimization > Optimize using the specified minimum and maximum values

ID: Titlehisl_0056: Configuration Parameters > Code Generation > Optimization > Optimize using the specified minimum and maximum values
DescriptionTo support verifiable code, clear Configuration Parameter Optimize using the specified minimum and maximum values.
NotesSelecting Optimize using the specified minimum and maximum values can result in requirements without associated code and violates traceability objectives.
RationaleSupport traceability between a model and generated code.
Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related optimization settings

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related optimization settings

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related optimization settings

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related optimization settings

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related optimization settings

For check details, see Check usage of For and While Iterator subsystems

References
  • DO-331 Section MB.MB.6.3.4.e 'Source code is traceable to low-level requirements’'

  • 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'

See also
Last ChangedR2018b

hisl_0038: Configuration Parameters > Code Generation > Comments

ID: Titlehisl_0038: Configuration Parameters > Code Generation > Comments
Description

For models used to develop high-integrity systems, in the Configuration Parameters dialog box, on the Code Generation > Comments pane, set the Overall control, Auto generated comments, and Custom comments parameters as follows:

A

Select Include comments.

B

Select Simulink block comments.

C

Select Show eliminated blocks.

D

Select Verbose comments for 'Model default' storage class.

E

Select Requirements in block comments.

RationaleA

Including comments provides good traceability between the code and the model.

B

Including comments that describe the code for blocks provides good traceability between the code and the model.

C

Including comments that describe the code for blocks eliminated from a model provides good traceability between the code and the model.

D

Including the names of parameter variables and source blocks as comments in the model parameter structure declaration in model_prm.h provides good traceability between the code and the model.

E

Including requirement descriptions assigned to Simulink blocks as comments provides good traceability between the code and the model.

Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related code generation settings for comments

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related code generation settings for comments

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related code generation settings for comments

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related code generation settings for comments

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related code generation settings for comments

For check details, see Check safety-related code generation settings for comments.

References
  • DO-331, Section MB.6.3.4.e 'Source code is traceable to low-level requirements‘

  • IEC 61508-3, Table A.3 (3) 'Language subset’

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

  • ISO 26262-6, Table 1 (1e) 'Use of well-trusted design principles'

  • EN 50128, Table A.4 (11) 'Language Subset'

Last ChangedR2017b

hisl_0039: Configuration Parameters > Code Generation > Interface

ID: Titlehisl_0039: Configuration Parameters > Code Generation > Interface
Description

For models used to develop high-integrity systems, in the Configuration Parameters dialog box, on the Code Generation > Interface pane, set the Software environment, Code interface, and Data exchange interface parameters as follows:

A

Clear Support: non-finite numbers.

B

Clear Support: absolute time.

C

Clear Support: continuous time.

D

Clear Support: non-inlined S-functions.

E

Clear Classic call interface.

F

Select Single output / update function.

G

Clear Terminate function required.

H

Select Remove error status field in real-time model data structure.

I

Clear MAT-file logging.

RationaleA

Support for non-finite numbers is not recommended for real-time safety-related systems.

B

Support for absolute time is not recommended for real-time safety-related systems.

C

Support for continuous time is not recommended for real-time safety-related systems.

D

Support for non-inlined S-functions requires support of non-finite numbers, which is not recommended for real-time safety-related systems.

E

To eliminate model function calls compatible with the main program module of the pre-2012a GRT target that is not recommended for real-time safety-related systems; use an ERT based target instead.

F

To simplify the interface to the real-time operating system (RTOS) and simplify verification of the generated code by creating a single call to both the output and update functions.

G

To eliminate model_terminate function, which is not recommended for real-time safety-related systems.

H

To eliminate extra code for logging and monitoring error status that might not be reachable for testing.

I

To eliminate extra code for logging test points to a MAT file that is not supported by embedded targets.

Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related code generation interface settings

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related code generation interface settings

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related code generation interface settings

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related code generation interface settings

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related code generation interface settings

For check details, see Check safety-related code generation interface settings.

References
  • DO-331, Section MB.6.3.1.c 'High-level requirements are compatible with target computer’
    DO-331, Section MB.6.3.2.c ‘Low-level requirements are compatible with target computer

  • IEC 61508-3, Table A.3 (3) 'Language subset’

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

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

  • EN 50128, Table A.4 (11) 'Language Subset'

Last ChangedR2018b

hisl_0047: Configuration Parameters > Code Generation > Code Style

ID: Titlehisl_0047: Configuration Parameters > Code Generation > Code
Description

For models used to develop high-integrity systems, in the Configuration Parameters dialog box, on the Code Generation > Code Style pane, set the Code Style parameters as follows:

A

Set Parenthesis level to Maximum (Specify precedence with parentheses).

B

Select Preserve operand order in expression.

C

Select Preserve condition expression in if statement.

RationaleA

To prevent unexpected results.

B,C

To improve traceability of the generated code.

Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related code generation settings for code style

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related code generation settings for code style

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related code generation settings for code style

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related code generation settings for code style

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related code generation settings for code style

For check details, see Check safety-related code generation settings for code style.

References
  • DO-331, Section MB.6.3.1.c 'High-level requirements are compatible with target computer’
    DO-331, Section MB.6.3.2.c ‘Low-level requirements are compatible with target computer
    DO-331, Section MB.6.3.4.e ‘Source code is traceable to low-level requirements’

  • IEC 61508-3, Table A.3 (3) 'Language subset’

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

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

  • EN 50128, Table A.4 (11) 'Language Subset'

  • MISRA C:2012, Rule 12.1

Last ChangedR2018b

hisl_0049: Configuration Parameters > Code Generation > Symbols

ID: Titlehisl_0049: Configuration Parameters > Code Generation > Symbols
Description

For models used to develop high-integrity systems, in the Configuration Parameters dialog box, on the Code Generation > Symbols pane, set the Auto-generated identifier naming rules parameters as follows:

A

Set Minimum mangle length to 4 or greater.

RationaleA

To minimize the likelihood that parameter and signal names will change during code generation when the model changes. Thus the option can decrease the effort to perform code review.

Model Advisor Checks
  • By Task > Modeling Standards for DO-178C/DO-331 > High-Integrity Systems > Configuration > Check safety-related code generation symbols settings

  • By Task > Modeling Standards for IEC 61508 > High-Integrity Systems > Configuration > Check safety-related code generation symbols settings

  • By Task > Modeling Standards for IEC 62304 > High-Integrity Systems > Configuration > Check safety-related code generation symbols settings

  • By Task > Modeling Standards for EN 50128 > High-Integrity Systems > Configuration > Check safety-related code generation symbols settings

  • By Task > Modeling Standards for ISO 26262 > High-Integrity Systems > Configuration > Check safety-related code generation symbols settings

For check details, see Check safety-related code generation symbols settings.

References
  • DO-331, Section MB.6.3.4.e ‘Source code is traceable to low-level requirements’

  • IEC 61508-3, Table A.3 (3) 'Language subset’

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

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

  • EN 50128, Table A.4 (11) 'Language Subset'

Last ChangedR2018b