Resource Sharing Parameters for Adders and Multipliers
This page describes configuration parameters that reside in the HDL Code Generation > Optimization > Resource sharing tab of the Configuration Parameters dialog box. Enable these parameters to save resources on the target device by specifying whether to share adders and multipliers in your design, and the minimum sharing bitwidth.
Share Adders
Enable this parameter to share adders with the resource sharing optimization. Resource sharing identifies Add or Sum blocks in your design that have two inputs and replaces them with a single Add or Sum block. This optimization saves area on the target FPGA device.
Settings
Default: Off
On
When resource sharing is enabled, this optimization shares adders with a bit width greater than or equal to the Adder sharing minimum bitwidth.
Off
Do not share adders.
Dependency
To share adders in your design, in the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
When you specify the Adder sharing minimum bitwidth, the code generator shares adders that have a bit width greater than or equal to the minimum bit width. The default minimum bit width for sharing adders is zero.
Command-Line Information
Property:
ShareAdders |
Type: character vector |
Value:
'on' | 'off' |
Default:
'off' |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the ShareAdders
setting when you
generate HDL code for the symmetric_fir
subsystem inside the
sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'ShareAdders','on')
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed','ShareAdders','on') makehdl('sfir_fixed/symmetric_fir')
See Also
Adder sharing minimum bitwidth
Use this parameter to specify the minimum bit width that is required to share adders with the resource sharing optimization.
Settings
Default: 0
- 0, 1
No minimum bit width for shared adders.
- N, where N is an integer greater than 1
When resource sharing and adder sharing are enabled, share adders with a bit width greater than or equal to N.
Dependency
To share adders in your design:
In the Resource Sharing tab, enable the Adders setting.
In the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
Command-Line Information
Property:
AdderSharingMinimumBitwidth |
Type: integer |
Value: integer greater than or equal to 0 |
Default: 0 |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the AdderSharingMinimumBitwidth
setting
when you generate HDL code for the symmetric_fir
subsystem inside the
sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'AdderSharingMinimumBitwidth',16)
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed','AdderSharingMinimumBitwidth',16) makehdl('sfir_fixed/symmetric_fir')
See Also
Share Multipliers
Enable this parameter to share multipliers with the resource sharing optimization. Resource sharing identifies Product or Gain blocks in your design that have two inputs and replaces them with a single Product or Gain block. This optimization saves area on the target FPGA device.Share multipliers with the resource sharing optimization.
Settings
Default: On
On
When resource sharing is enabled, share multipliers with a bit width greater than or equal to the Multiplier sharing minimum bitwidth. For successfully sharing multipliers, the input fixed-point data types must have the same wordlength. The fraction lengths and signs of the fixed-point data types can be different.
Off
Do not share multipliers.
Dependency
To share multipliers in your design, in the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
When you specify the Multiplier sharing minimum bitwidth, the code generator shares multipliers that have a bit width greater than or equal to the minimum bit width. The default minimum bit width for sharing multipliers is zero.
Command-Line Information
Property:
ShareMultipliers |
Type: character vector |
Value:
'on' | 'off' |
Default:
'on' |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the ShareMultipliers
setting when you
generate HDL code for the symmetric_fir
subsystem inside the
sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'ShareMultipliers','on')
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed','ShareMultipliers','on') makehdl('sfir_fixed/symmetric_fir')
See Also
Multiplier sharing minimum bitwidth
Use this parameter to specify the minimum bit width that is required to share multipliers with the resource sharing optimization.
Settings
Default: 0
- 0, 1
No minimum bit width for shared multipliers.
- N, where N is an integer greater than 1
When resource sharing and multiplier sharing are enabled, share multipliers with a bit width greater than or equal to N.
Dependency
To share multipliers in your design:
In the Resource Sharing tab, make sure that the Multipliers check box is selected.
In the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
Command-Line Information
Property:
MultiplierSharingMinimumBitwidth |
Type: integer |
Value: integer greater than or equal to 0 |
Default: 0 |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the MultiplierSharingMinimumBitwidth
setting when you generate HDL code for the symmetric_fir
subsystem
inside the sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'MultiplierSharingMinimumBitwidth',16)
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed','MultiplierSharingMinimumBitwidth',16) makehdl('sfir_fixed/symmetric_fir')
See Also
Multiplier promotion threshold
To share smaller multipliers with other larger multipliers by using the resource sharing optimization, specify the multiplier promotion threshold. This threshold specifies the maximum word length by which HDL Coder™ promotes a multiplier for sharing with other multipliers. For example, if you have a multiplier whose input word lengths sum to 28 bits and you want to share that multiplier with another multiplier whose input word lengths sum to 34 bits, subtract the total bits from each other, and set the multiplier promotion threshold to at least as large as the difference. In this example, the difference is 6 bits.
Settings
Default: 0
- 0
No difference in word length between the multipliers, meaning that HDL Coder shares multipliers that have the same word length.
- N, where N is an integer greater than 0
Maximum word length by which HDL Coder promotes a multiplier for sharing with other multipliers. If the difference in word lengths is less than or equal to N, HDL Coder promotes and shares multipliers that have different word lengths.
To determine N:
Calculate the sum of the input word lengths for the multipliers that you want to share.
Set N to be at least as large as the difference between the summation of input word lengths for the different multipliers.
Dependency
To share multipliers in your design:
In the Resource Sharing tab, make sure that you select the Multipliers check box.
In the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
Command-Line Information
Property:
MultiplierPromotionThreshold |
Type: integer |
Value: integer greater than or equal to 0 |
Default: 0 |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the MultiplierPromotionThreshold
setting
when you generate HDL code for the symmetric_fir
subsystem inside the
sfir_fixed
model by using either of these methods:
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'MultiplierPromotionThreshold',8)
When you use
hdlset_param
, you can set the parameter on the model, and then generate HDL code by usingmakehdl
.hdlset_param('sfir_fixed','MultiplierPromotionThreshold',8) makehdl('sfir_fixed/symmetric_fir')
See Also
Multiplier partitioning threshold
Settings
Default:
Inf
- N, where N is an integer greater than or equal to 2
Partition multipliers so that N is the maximum multiplier input bit width.
This parameter specifies the maximum input bit width for a multiplier. If at least one of the inputs to the multiplier has a bit width greater than the threshold value, the code generator splits the multiplier into smaller multipliers.
To improve hardware mapping results, set the multiplier partitioning threshold to the input bit width of the DSP or multiplier hardware on your target device.
- Inf
Do not partition multipliers.
Command-Line Information
Property:
MultiplierPartitioningThreshold |
Type: integer |
Value: integer greater than or equal to 0 |
Default:
Inf |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can set the MultiplierPartitioningThreshold
to
16
when you generate HDL code for the
symmetric_fir
subsystem inside the sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'MultiplierPartitioningThreshold',16)
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed', 'MultiplierPartitioningThreshold',16) makehdl('sfir_fixed/symmetric_fir')
See Also
Share Multiply-Add blocks
Share Multiply-Add blocks with the resource sharing optimization.
Settings
Default: On
On
When resource sharing is enabled, share Multiply-Add blocks with a bit width greater than or equal to Multiply-Add block sharing minimum bitwidth.
Off
Do not share Multiply-Add blocks.
Dependency
To share Multiply-Add blocks in your design, in the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
When you specify the Multiply-Add block sharing minimum bitwidth, the code generator shares Multiply-Add blocks that have a bit width greater than or equal to the minimum bit width. The default minimum bit width for sharing Multiply-Add blocks is zero.
Command-Line Information
Property:
ShareMultiplyAdds |
Type: character vector |
Value:
'on' | 'off' |
Default:
'on' |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the ShareMultiplyAdds
setting when you
generate HDL code for the symmetric_fir
subsystem inside the
sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'ShareMultiplyAdds','on')
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed','ShareMultiplyAdds','on') makehdl('sfir_fixed/symmetric_fir')
See Also
Multiply-Add block sharing minimum bitwidth
Use this parameter to specify the minimum bit width that is required to share Multiply-Add with the resource sharing optimization.
Settings
Default: 0
- 0, 1
No minimum bit width for shared Multiply-Add blocks.
- N, where N is an integer greater than 1
When resource sharing and Multiply-Add block sharing are enabled, share Multiply-Add blocks with a bit width greater than or equal to N.
Dependency
To share Multiply-Add blocks in your design:
In the Resource Sharing tab, make sure that the Multiply-Add blocks check box is selected.
In the HDL Block Properties for the DUT Subsystem, specify the SharingFactor.
Command-Line Information
Property:
MultiplierAddSharingMinimumBitwidth |
Type: integer |
Value: integer greater than or equal to 0 |
Default: 0 |
To set this property, use the functions hdlset_param
or makehdl
. To view the property value, use
the function hdlget_param
.
For example, you can use the MultiplierAddSharingMinimumBitwidth
setting when you generate HDL code for the symmetric_fir
subsystem
inside the sfir_fixed
model using either of these methods.
Pass the property as an argument to the
makehdl
function.makehdl('sfir_fixed/symmetric_fir', ... 'MultiplierAddSharingMinimumBitwidth',16)
When you use
hdlset_param
, you can set the parameter on the model and then generate HDL code usingmakehdl
.hdlset_param('sfir_fixed',MultiplierAddSharingMinimumBitwidth',16) makehdl('sfir_fixed/symmetric_fir')
See Also