Main Content

Find Feedback Loops

Feedback loops in your Simulink® design can inhibit delay balancing and optimizations such as resource sharing and streaming.

To find feedback loops in your design that are inhibiting optimizations, you can generate and run a MATLAB® script that highlights one or more feedback loops in your original model and the generated model. When you run the script, different feedback loops are highlighted in different colors. The feedback loop highlighting script is saved in the same target folder as the HDL code.

After you generate code, if feedback loops are inhibiting optimizations, the command window shows a link that you can click to highlight feedback loops. If you generate an Optimization Report, the report also contains a link you can click to highlight feedback loops.

The script can highlight feedback loops that are inhibiting the following optimizations:

  • Resource sharing

  • Streaming

  • MATLAB variable pipelining

  • Delay balancing

Specify Highlighting of Feedback Loops

By default, highlighting of feedback loops is enabled. To generate a feedback loop highlighting script programmatically, use the HighlightFeedbackLoops property with makehdl or hdlset_param. For example, to generate a feedback loop highlight script for a model, myModel, enter:

hdlset_param ('myModel', 'HighlightFeedbackLoops', 'on');

Remove Highlighting

By default, HDL Coder™ generates a script to highlight feedback loops and a script to clear the highlighting of feedback loops in your model. You can turn off highlighting using either of these ways:

  • Click the clearhighlighting script in the MATLAB Command Window

  • In the Simulink Toolstrip, select Debug > Trace Signal.

Limitations

  • Feedback loop highlighting cannot highlight blocks that have names that contain a single quote (').

  • In some cases, feedback loop highlighting might highlight a subsystem or one block instead of the lowest-level block.

Related Topics