Main Content

Resource Sharing Settings for Various Blocks

Resource sharing is an area optimization in which HDL Coder™ identifies multiple functionally equivalent resources and replaces them with a single resource. The data is time-multiplexed over the shared resource to perform the same operations. To learn more about how resource sharing works, see Resource Sharing.

You can follow these guidelines to learn how to use the resource sharing optimization effectively with blocks such as Add and Product. Each guideline has a severity level that indicates the level of compliance requirements. To learn more, see HDL Modeling Guidelines Severity Levels.

Resource Sharing of Add Blocks

Guideline ID

3.1.1

Severity

Recommended

Description

To share multiple Add blocks:

  • Select the Share Adders setting.

  • Leave the Adder sharing minimum bitwidth to 0.

  • Determine whether to perform resource sharing at the existing clock rate or at a higher clock rate. To use a higher clock rate, specify an Oversampling factor greater than 1.

  • Specify the StreamingFactor for Add blocks with vector inputs or outputs.

  • Specify the SharingFactor for Add blocks with scalar inputs or outputs.

  • Make sure that the input word-lengths of the Add blocks match.

    For example, this figure illustrates a model containing three Add blocks placed inside a Subsystem with SharingFactor of 3. To share the Add blocks, you must insert Data Type Conversion blocks with Output data type set to int16 so that the input word lengths match.

  • When using a Sum of Elements block (vector in, scalar out), use the Tree architecture. This configuration allows sharing by creating stages of parallel add operations. Each stage can be shared down to one Add block since all Add blocks have the same bit width, reducing the critical path and optimizing hardware resources. The Linear architecture creates a chain of add operations with increasing bit widths, which currently does not support sharing.

Resource Sharing of Gain Blocks

Guideline ID

3.1.2

Severity

Recommended

Description

When you share multiple Gain blocks in your design, the optimization inserts serialization and deserialization logic to share resources. This additional logic can become an area overhead if you are not sharing a large number of resources. Therefore, if your design does not contain a large number of Gain blocks to share, it is recommended that you disable the resource sharing optimization. To share multiple Gain blocks:

To share multiple Gain blocks:

  • Determine how to implement the Gain block. HDL Coder does not share Gain blocks in either of these cases:

    • ConstMultiplierOptimization parameter set to csd or fcsd.

    • Gain parameter is a power of two.

    In both these cases, the code generator uses a cast operation to replace the multiplier operations with shift and add or subtract operations, which causes sharing to be unsuccessful. In addition, if the Gain parameter is 0 or 1, then resource sharing requires no additional logic.

  • Specify the StreamingFactor for Gain blocks with vector inputs or outputs.

  • Specify the SharingFactor for Gain blocks with scalar inputs or outputs.

  • Determine whether to perform resource sharing at the existing clock rate or at a higher clock rate. To use a higher clock rate, specify an Oversampling factor greater than 1.

  • Use the same synthesis attribute settings if you specify the DSPStyle block property for the Gain blocks. HDL Coder does not share multipliers that have different synthesis attribute settings.

Resource Sharing of Product Blocks

Guideline ID

3.1.3

Severity

Recommended

Description

To share multiple Product blocks:

  • Specify 18 as the Multiplier partitioning threshold when targeting Xilinx® devices and 25 as the threshold when targeting Intel® devices. This setting creates more resource sharing opportunities for multipliers with a wide bit width, which reduces the use of DSPs on the FPGA.

  • Specify the Multiplier promotion threshold if you want to share Product blocks that have different word-lengths. The multiplier promotion threshold is the maximum word-length by which HDL Coder promotes a multiplier for sharing with other multipliers.

  • Leave the Share Multipliers setting enabled and the Multiplier sharing minimum bitwidth to 0.

  • Specify the StreamingFactor for the subsystems that contain Product blocks with vector inputs or outputs.

  • Specify the SharingFactor for the subsystems that contain Product blocks with scalar inputs or outputs.

  • Use a Gain block instead of a Product block when one of the inputs to the Product block is a constant. Use the constant value as the Gain parameter of the Gain block. If you use floating-point data types in the Native Floating Point mode, HDL Coder converts the Product block to a Gain block automatically during code generation. To learn more, see Simplify Constant Operations and Reduce Design Complexity in HDL Coder.

  • Determine whether to perform resource sharing at the existing clock rate or at a higher clock rate. To use a higher clock rate, specify an Oversampling factor greater than 1.

  • Use the same synthesis attribute settings if you specify the DSPStyle block property for the Product blocks. HDL Coder does not share multipliers that have different synthesis attribute settings.

Resource Sharing of Multiply-Add Blocks

Guideline ID

3.1.4

Severity

Recommended

Description

To share multiple Multiply-Add blocks:

Related Examples

More About