ID: Title | hisf_0003: Usage of bitwise operations | |
---|---|---|
Description | When using bitwise operations in Stateflow® blocks, | |
A | Avoid signed integer data types as operands to the bitwise operations. | |
Notes | Normally, bitwise operations are not meaningful on signed integers. Undesired behavior can occur. For example, a shift operation might move the sign bit into the number, or a numeric bit into the sign bit. | |
Rationale | A | Promote unambiguous modeling style. |
Model Advisor Checks | Check usage of bitwise operations in Stateflow charts (Simulink Check) | |
References |
| |
See Also | hisl_0019: Usage of bitwise operations | |
Last Changed | R2016a |
ID: Title | hisf_0004: Usage of recursive behavior | |
---|---|---|
Description | To support bounded function call behavior, avoid using design patterns that include unbounded recursive behavior. Recursive behavior is bound if you do the following: | |
A | Use an explicit termination condition that is local to the recursive call. | |
B | Make sure the termination condition is reached. | |
Notes | This rule only applies if a chart is a classic Stateflow chart. If Mealy and Moore semantics are followed, recursive behavior is prevented due to restrictions in the chart semantics. To detect the error during chart simulation, open your Stateflow chart and, in the Debug tab, select Diagnostics > Detect Cyclical Behavior. | |
Rationale | A, B | Promote bounded function call behavior. |
Model Advisor Checks | Adherence to this modeling guideline cannot be verified by using a Model Advisor check. | |
References |
| |
Last Changed | R2016a | |
Examples | There are multiple patterns in Stateflow that can result in unbounded recursion.
Recursive Function Calls | |
When the default state A is entered, event
Recursive Function Calls |
ID: Title | hisf_0007: Usage of junction conditions (maintaining mutual exclusion) | |
---|---|---|
Description | To enhance clarity and prevent the generation of unreachable code: | |
A | Make junction conditions mutually exclusive. | |
Notes | You can use this guideline to maintain a modeling language subset in high-integrity projects. | |
Rationale | A | Enhance clarity and prevent generation of unreachable code. |
References |
| |
Model Advisor Checks | Adherence to this modeling guideline cannot be verified by using a Model Advisor check. | |
Last Changed | R2012b | |
Example |
|
ID: Title | hisf_0013: Usage of transition paths (crossing parallel state boundaries) | |
---|---|---|
Description | To avoid creating diagrams that are hard to understand, | |
A | Avoid creating transitions that cross from one parallel state to another. | |
Notes | You can use this guideline to maintain a modeling language subset in high-integrity projects. | |
Rationale | A | Enhance model readability. |
Model Advisor Checks | Check Stateflow charts for transition paths that cross parallel state boundaries (Simulink Check) | |
References |
| |
Last Changed | R2017b | |
Example | In the following example, when
|
ID: Title | hisf_0014: Usage of transition paths (passing through states) | |
---|---|---|
Description | To avoid creating diagrams that are confusing and include transition paths without benefit, | |
A | Avoid transition paths that go into and out of a state without ending on a substate. | |
Notes | You can use this guideline to maintain a modeling language subset in high-integrity projects. | |
Rationale | A | Enhance model readability. |
Model Advisor Checks | Check for inappropriate use of transition paths (Simulink Check) | |
References |
| |
Last Changed | R2018b | |
Examples |
|
ID: Title | hisf_0015: Strong data typing (casting variables and parameters in expressions) | |
---|---|---|
Description | To facilitate strong data typing, | |
A | Explicitly type cast variables and parameters of different data types in:
| |
Notes | The Stateflow software automatically casts variables of different type into the same data type. This guideline helps clarify data types of the intermediate variables. | |
Rationale | A | Apply strong data typing. |
Model Advisor Checks | Check Stateflow charts for strong data typing (Simulink Check) | |
References |
| |
Last Changed | R2017b | |
Examples |
Recommended Not Recommended |
ID: Title | hisf_0016: Stateflow port names |
---|---|
Description | The name of a Stateflow input or output must be the same as the corresponding signal. An exception to the guideline is that reusable Stateflow blocks can have different port names. |
Rationale | Support generation of traceable code. |
Model Advisor Checks | Check naming of ports in Stateflow charts (Simulink Check) |
References |
|
Last Changed | 2018a |
ID: Title | hisf_0017: Stateflow data object scoping |
---|---|
Description | Stateflow data objects with local scope must be defined at the chart level or below. |
Rationale | Support generation of traceable code. |
Model Advisor Checks | Check scoping of Stateflow data objects (Simulink Check) |
References |
|
Last Changed | 2018a |
Examples |
Recommended Not Recommended |