Code Generation
hisl_0052: Configuration Parameters > Code Generation > Optimization > Data initialization
ID: Title | hisl_0052: Configuration Parameters > Code Generation > Optimization > Data initialization | |
---|---|---|
Description | Explicitly initialize variables for models that are configured with these model configuration parameter settings:
For these models, you can configure code generation that completely defines data and initializes internal and external data to zero by clearing these model configuration parameters:
| |
Notes |
| |
Rationale | Support fully defined data in generated code. | |
Model Advisor Checks | Check safety-related optimization settings for data initialization (Simulink Check) | |
References |
| |
See Also | Information about these parameters in the Simulink® documentation:
| |
Last Changed | R2024a |
hisl_0053: Configuration Parameters > Code Generation > Optimization > Remove code from floating-point to integer conversions that wraps out-of-range values
ID: Title | hisl_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, select configuration parameter 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 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. | ||
Rationale | Support generation of code that can be verified. | ||
Model Advisor Checks | Check safety-related optimization settings for data type conversions (Simulink Check) | ||
References |
| ||
See Also | Remove code from floating-point to integer conversions that wraps out-of-range values (Simulink Coder) in the Simulink documentation | ||
Last Changed | R2021b |
hisl_0054: Configuration Parameters > Code Generation > Optimization > Remove code that protects against division arithmetic exceptions
ID: Title | hisl_0054: Configuration Parameters > Code Generation > Optimization > Remove code that protects against division arithmetic exceptions | ||
---|---|---|---|
Description | To support the robustness of the operations, clear configuration parameter 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. This configuration parameter is applicable only when the System target file is an ERT-based target. | ||
Rationale | Protect against divide-by-zero exceptions for fixed-point code. | ||
Model Advisor Checks | Check safety-related optimization settings for division arithmetic exceptions (Simulink Check) | ||
References |
| ||
See Also | Remove code that protects against division arithmetic exceptions (Embedded Coder) in the Simulink documentation | ||
Last Changed | R2024a |
hisl_0056: Configuration Parameters > Code Generation > Optimization > Optimize using the specified minimum and maximum values
ID: Title | hisl_0056: Configuration Parameters > Code Generation > Optimization > Optimize using the specified minimum and maximum values | ||
---|---|---|---|
Description | To support verifiable code, clear configuration parameter Optimize using the specified minimum and maximum values. | ||
Notes | Selecting Optimize using the specified minimum and maximum values can result in requirements without associated code and violates traceability objectives. | ||
Rationale | Support traceability between a model and generated code. | ||
Model Advisor Checks | Check safety-related optimization settings for specified minimum and maximum values (Simulink Check) | ||
References |
| ||
See also |
| ||
Last Changed | R2018b |
hisl_0038: Configuration Parameters > Code Generation > Comments
ID: Title | hisl_0038: Configuration Parameters > Code Generation > Comments | |
---|---|---|
Description | In the Configuration Parameters dialog box, on the Code Generation > Comments pane, select these parameters: | |
A | Include comments (Simulink Coder). | |
B | Simulink block comments (Simulink Coder). | |
C | Show eliminated blocks (Simulink Coder). | |
D | Verbose comments for 'Model default' storage class (Simulink Coder). | |
E | Requirements in block comments (Embedded Coder). | |
F | Stateflow object comments (Simulink Coder) | |
G | MATLAB source code as comments (Simulink Coder) | |
Rationale | A | 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
| |
E | Including requirement descriptions assigned to Simulink blocks as comments provides good traceability between the code and the model. | |
F | Including Stateflow® object comments provides good traceability between the code and the model. | |
G | Including MATLAB® source code as comments provides good traceability between the code and the model. | |
Model Advisor Checks | Check safety-related code generation settings for comments (Simulink Check) | |
References |
| |
See Also | Model Configuration Parameters: Comments (Embedded Coder) | |
Last Changed | R2024a - Added configuration parameters Stateflow object comments (Simulink Coder) and MATLAB source code as comments (Simulink Coder). |
hisl_0039: Configuration Parameters > Code Generation > Interface
ID: Title | hisl_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: continuous time. | |
C | Clear Support: non-inlined S-functions. | |
D | Clear Classic call interface. | |
E | Select Single output / update function. | |
F | Clear Terminate function required. | |
G | Select Remove error status field in real-time model data structure. | |
H | Clear MAT-file logging. | |
Rationale | A | Support for non-finite numbers is not recommended for real-time safety-related systems. |
B | Support for continuous time is not recommended for real-time safety-related systems. | |
C | Support for non-inlined S-functions requires support of non-finite numbers, which is not recommended for real-time safety-related systems. | |
D | 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. | |
E | 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. | |
F | To eliminate
| |
G | To eliminate extra code for logging and monitoring error status that might not be reachable for testing. | |
H | To eliminate extra code for logging test points to a MAT file that is not supported by embedded targets. | |
Model Advisor Checks | Check safety-related code generation interface settings (Simulink Check) | |
References |
| |
See Also | Model Configuration Parameters: Code Generation Interface (Embedded Coder) | |
Last Changed | R2023b |
hisl_0047: Configuration Parameters > Code Generation > Code Style
ID: Title | hisl_0047: Configuration Parameters > Code Generation > Code Style | |
---|---|---|
Description | In the Configuration Parameters dialog box, on the Code Generation > Code Style pane, set these parameters: | |
A | Set Parentheses level (Embedded Coder) to
| |
B | Select Preserve operand order in expression (Embedded Coder). | |
Note | These configuration parameters are
available when configuration parameter System target file (Simulink Coder) is set to
ert.tlc . | |
Rationale | A | To prevent unexpected results. |
B | To improve traceability of the generated code. | |
Model Advisor Checks | Check safety-related code generation settings for code style (Simulink Check) | |
References |
| |
See Also | Model Configuration Parameters: Code Style (Embedded Coder) | |
Last Changed | R2019b |
hisl_0049: Configuration Parameters > Code Generation > Identifiers
ID: Title | hisl_0049: Configuration Parameters > Code Generation > Identifiers | |
---|---|---|
Description | To minimize the likelihood that
parameter and signal names will change during code generation when the model
changes, set configuration parameter Minimum mangle
length to 4 or greater. | |
Rationale | Decrease the effort to perform code review. | |
Model Advisor Checks | Check safety-related code generation identifier settings (Simulink Check) | |
References |
| |
See Also | Model Configuration Parameters: Code Generation Identifiers (Embedded Coder) | |
Last Changed | R2021a |
hisl_0074: Configuration Parameters > Diagnostics > Modeling issues related to variants
ID: Title | hisl_0074: Configuration Parameters > Diagnostics > Modeling issues related to variants | ||
---|---|---|---|
Description | Set these configuration parameters to error:
| ||
Rationale | To maintain a consistent behavior between the simulation and generated code and to prevent the creation of unused variables in generated code. | ||
Model Advisor Checks | Check safety-related diagnostic settings for variants (Simulink Check) | ||
References |
| ||
See Also | |||
Last Changed | R2021b |
hisl_0075: Usage of library links
ID: Title | hisl_0075: Usage of library links | ||
---|---|---|---|
Description | To maintain a consistent behavior between the simulation and generated code, avoid Disabled library links and Parameterized library links in the model. | ||
Rationale | To avoid unintended simulation results. | ||
Model Advisor Checks | Check for disabled and parameterized library links (Simulink Check) | ||
References |
| ||
Last Changed | R2022a | ||
Examples | Recommended: It is recommended to use masked library links to change the parameter values inside the library blocks instead of creating the parameterized library links. Changing the gain value on masked parameter in the model doesn’t create the parameterized links. Not Recommended: Changing the gain value using set_param in the command window cause parameterized library link. This would cause unintended behavior. |