Unroll For-Generate Loops
Unroll and omit FOR and GENERATE loops from
generated HDL code
Model Configuration Pane: Global Settings / Coding style
Description
Specify whether FOR and GENERATE loops are unrolled and omitted from generated HDL code.
Settings
off (default) | onDefault: Off
onUnroll and omit
FORandGENERATEloops from the generated HDL code.offInclude
FORandGENERATEloops in the generated HDL code.
Tips
To set this property, use the functions hdlset_param or makehdl. To view the property value, use
the function hdlget_param.
For some Simulink® blocks, by default, the HDL code is generated by using a FOR-GENERATE loop construct. These Simulink blocks are:
The code generated by using a FOR-GENERATE loop has better code readability, reduced lines of code, and reduced code generation time. For example, consider the VHDL® code generated for reshaping a 2-D matrix into a 1-D matrix. The example shows the code generated for the Reshape block with and without FOR-GENERATE loops.
Reshape block without
FOR-GENERATEloop (Unroll For-Generate Loops is enabled):
Reshape_output : PROCESS (In1_signed) BEGIN Reshape_out1(0) <= In1_signed(0, 0); Reshape_out1(1) <= In1_signed(1, 0); Reshape_out1(2) <= In1_signed(2, 0); Reshape_out1(3) <= In1_signed(3, 0); Reshape_out1(4) <= In1_signed(4, 0); Reshape_out1(5) <= In1_signed(5, 0); Reshape_out1(6) <= In1_signed(6, 0); Reshape_out1(7) <= In1_signed(7, 0); Reshape_out1(8) <= In1_signed(8, 0); Reshape_out1(9) <= In1_signed(9, 0); Reshape_out1(10) <= In1_signed(0, 1); ...
Reshape block with a
FOR-GENERATEloop (Unroll For-Generate Loops is disabled):
Reshape_out1GEN_LABEL1: FOR d1 IN 0 TO 1 GENERATE
Reshape_out1GEN_LABEL: FOR d0 IN 0 TO 9 GENERATE
Reshape_out1(d0 + (d1*10)) <= In1_signed(d0, d1);
END GENERATE;
END GENERATE;
If you are using an electronic design automation (EDA) tool that does not support
GENERATEloops, select the loop unrolling option to omit loops from your generated HDL code.Setting the loop unrolling option does not affect results obtained from simulation or synthesis of generated HDL code.
Recommended Settings
No recommended settings.
Programmatic Use
Parameter: LoopUnrolling |
| Type: character vector |
Value: 'on' | 'off' |
Default: 'off' |
Version History
Introduced in R2012a