メインコンテンツ

Enabling Optimizations in HDL Coder

R2026b

You can use optimizations to impact the speed and area of your generated HDL code. You can apply optimizations to MATLAB® code or Simulink® models. In Simulink, you can apply optimizations to an entire model, a subsystem, or an individual block.

For more information about optimizations, see Introduction to Optimizations in HDL Coder.

Enable HDL Code Generation Optimizations in MATLAB

To enable optimizations on your MATLAB code:

  1. On the MATLAB Toolstrip, from the Apps tab, select HDL Coder.

  2. Select the MATLAB design and test bench files and click Workflow Advisor.

  3. On the HDL Code Generation task, in the Optimization tab, enable the optimizations you want to use.

For more information on setting up and using the HDL Workflow Advisor with MATLAB designs, see Set Up HDL Workflow Advisor in MATLAB.

Enable HDL Code Generation Optimizations in Simulink

You can enable optimizations for the entire model, a subsystem, or for an individual block.

To enable optimizations for the entire Simulink model, use one of these approaches:

  • In the Configuration Parameters dialog box, in the HDL Code Generation > Optimization pane, select the optimizations that you want to apply.

  • At the command line, use the makehdl or hdlset_param function and specify the optimizations you want to enable.

  • In the Simulink HDL Workflow Advisor, on the Set HDL Options task, use the HDL Code Generation Settings to open the Configuration Parameters dialog box. You can then navigate to the HDL Code Generation > Optimization pane.

You can also enable optimizations for an individual subsystem. When you enable an optimization for a subsystem:

  • The subsystem inherits the model-level optimization settings. You can override these settings in the HDL Block Properties dialog box or by using the hdlset_param function.

  • If the subsystem has a parent subsystem, the subsystem inherits the optimization settings from the parent subsystem.

This table illustrates which optimizations are available at each level of model hierarchy.

OptimizationAvailable at Model LevelAvailable at Subsystem Level
RAM mappingYesNo
Adaptive pipeliningYesYes
Clock-rate pipeliningYesYes
Delay balancingNoYes
Distributed pipeliningYesYes
Resource sharing

Yes

At the model level, you specify the type of resources you want to share, such as adders and multipliers.

Yes

At the block or subsystem level, you specify the SharingFactor HDL block property.

StreamingNoYes

See Also

Topics