| Contents | Index |
| 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 | By Task > Modeling Standards for MAAB > Stateflow > Check for bitwise operations in Stateflow charts | ||
| References |
| ||
| See Also | hisl_0019: Usage of Bitwise Operator block | ||
| Last Changed | R2011a | ||
| 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 hisf_0001: Mealy and Moore semantics is followed, recursive behavior is prevented due to restrictions in the chart semantics. Additionally, you can detect the error during simulation by enabling the Stateflow diagnostic Detect Cycles. | ||
| Rationale | A, B | Promote bounded function call behavior. | |
| References |
| ||
| Last Changed | R2011a | ||
| Examples | There are multiple patterns in Stateflow that can result in unbounded recursion. Recursive Function Calls
| ||
When the default state A is entered, event Evn is broadcast in the entry action of A. Evn results in a recursive call of the interpretation algorithm. Since A is active, the outgoing transition of A is tested. Since the current event Evn matches the transition event (and because of the absence of condition) the condition action is executed, broadcasting Evn again. This results in a new call of the interpretation algorithm which repeats the same sequence of steps until stack overflow. 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 |
| ||
| Last Changed | R2010b | ||
| ID: Title | hisf_0010: Usage of transition paths (looping out of parent of source and destination objects | ||
|---|---|---|---|
| Description | Transitions that loop out of the parent of the source and destination objects are typically unintentional and cause the parent to deactivate. | ||
| A | Avoid using these transitions. | ||
| Notes | You can use this guideline to maintain a modeling language subset in high-integrity projects. | ||
| Rationale | A | Promote a clear modeling style. | |
| References |
| ||
| Last Changed | R2010b | ||
| Examples |
| ||
| ID: Title | hisf_0012: Chart comments | ||
|---|---|---|---|
| Description | To enhance traceability between generated code and a model, | ||
| A | Add comments to the following Stateflow objects: In R2008b and higher:
In R2008a and lower:
| ||
| Notes | You can us this guideline to maintain a modeling language subset in high-integrity projects. | ||
| Rationale | A | Enhance traceability between generated code and the corresponding model. | |
| References |
| ||
| Last Changed | R2010b | ||
| 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. | |
| Last Changed | R2010b | ||
| Example | In the following example, when Out_A is 4, both parent states (A_Parent and B_Parent) are reentered. Reentering the parent states resets the values of Out_A and Out_B to zero.
| ||
| 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. | |
| References |
| ||
| Last Changed | R2010b | ||
| Examples |
| ||
![]() | Chart Properties | MISRA-C:2004 Compliance Considerations | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |