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:
MATLAB variable pipelining
Specify Highlighting of Feedback Loops
By default, highlighting of feedback loops is enabled. This setting is available:
In the Configuration Parameters dialog box, on the HDL Code Generation > Global Settings > Advanced tab, select Highlight feedback loops inhibiting delay balancing and optimizations.
To generate a feedback loop highlighting script programmatically, use the
hdlset_param. For example, to generate a feedback loop highlight script for a model,
hdlset_param ('myModel', 'HighlightFeedbackLoops', 'on');
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:
clearhighlightingscript in the MATLAB Command Window
In the Simulink Toolstrip, select Debug > Trace Signal.
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.