Products & Services Solutions Academia Support User Community Company

Learn more about Stateflow   

Optimizing Generated Code

How to Optimize Generated Code for Embeddable Targets

To optimize Real-Time Workshop code generation for your model, perform these steps:

  1. In the Stateflow Editor, select Simulation > Configuration Parameters.

  2. In the Configuration Parameters dialog box, select the Optimization pane.

  3. In the Stateflow section of the Optimization pane, choose from these options:

    • Use bitsets for storing state configuration — Reduces the amount of memory that stores state configuration variables. However, it can increase the amount of memory that stores target code if the target processor does not include instructions for manipulating bitsets.

    • Use bitsets for storing Boolean data — Reduces the amount of memory that stores Boolean variables. However, it can increase the amount of memory that stores target code if the target processor does not include instructions for manipulating bitsets.

        Note   You cannot use bitsets when you generate code for these cases:

        • An external mode simulation

        • A target that specifies an explicit structure alignment

Design Tips for Optimizing Generated Code

The following design tips can help optimize generated code.

 Do not access machine-parented data in a graphical function

 Be explicit about the inline option of a graphical function

 Avoid using multiple edge-triggered events in Stateflow charts

 Combine input signals of a chart into a single bus object

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS