Main Content

Block reduction


Reduce execution time by collapsing or removing groups of blocks.

Category: Simulation Target


Default: On


Simulink® software searches for and reduces these block patterns:

  • Redundant type conversions — Unnecessary type conversion blocks, such as an int type conversion block with an input and output of type int

  • Dead code — Blocks or signals in an unused code path

  • Fast-to-slow Rate Transition block in a single-tasking systemRate Transition blocks with an input frequency faster than its output frequency


Simulink software does not search for block patterns that can be optimized. Simulation and generated code are not optimized.


  • When you select Block reduction, Simulink software collapses certain groups of blocks into a single, more efficient block, or removes them entirely. This reduction results in faster execution during model simulation and in generated code.

  • Block reduction does not change the appearance of the source model.

  • Tunable parameters do not prevent a block from being reduced by dead code elimination.

  • Once block reduction takes place, Simulink software does not display the sorted order for blocks that have been removed.

  • You can determine programmatically which blocks are reduced in a model by querying the ReducedNonVirtualBlockList parameter of the model to obtain a vector of the block handles of the reduced blocks.

    ReducedBlockHandlesVector = get_param(ModelName,'ReducedNonVirtualBlockList');

  • If you have a Simulink Coder™ license, block reduction is intended to remove only the generated code that represents execution of a block. Other supporting data, such as definitions for sample time and data types might remain in the generated code.

Dead Code Elimination

Any blocks or signals in an unused code path are eliminated from generated code.

  • The following conditions need to be met for a block to be considered part of an unused code path:

    • All signal paths for the block end with a block that does not execute. Examples of blocks that do not execute include Terminator blocks, disabled Assertion blocks, S-Function blocks configured for block reduction, and To Workspace blocks when MAT-file logging is disabled for code generation.

    • No signal paths for the block include global signal storage downstream from the block.

  • Tunable parameters do not prevent a block from being reduced by dead code elimination.

  • Consider the signal paths in the following block diagram.

    If you check Block reduction, Simulink Coder software responds to each signal path as follows:

    For Signal Path...Simulink Coder Software...
    In1 to Out1Generates code because dead code elimination conditions are not met.
    In2 to TerminatorDoes not generate code because dead code elimination conditions are met.
    In3 to ScopeGenerates code if MAT-file logging is enabled and eliminates code if MAT-file logging is disabled.

Highlight Reduced Blocks

When Block reduction is selected, you can highlight nonvirtual blocks that are removed to reduce execution time during model simulation and code generation. To highlight such blocks, on the Simulink toolstrip, go to the Debug tab. From the Information Overlays menu, select Reduced Blocks.

Debug tab on Simulink toolstrip, Information Overlays menu, with Reduced Blocks highlighted on menu.


If there are no reduced blocks to highlight, the Reduced Blocks option is disabled.

Reduced blocks appear highlighted on the canvas. After you update or simulate your model, blocks that are reduced during normal simulation are highlighted. After you build your model, blocks that are reduced during code generation are highlighted.

Simulink canvas with a simple model. Background is in grey, and one block, a Data Type Conversion block, is highlighted with a yellow border and white background. In the upper-right corner of the canvas, there is a circle containing an X.

To remove the highlighting, click circle with X inside in the upper-right corner of the canvas, or clear the Reduced Blocks selection from the Information Overlays menu.

Command-Line Information

Parameter: BlockReduction
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

DebuggingOff for simulation or during development
No impact for production code generation
Safety precaution

No impact

Related Topics