Resource Sharing of Subsystems and Floating-Point IPs
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 for subsystems such as atomic subsystems and MATLAB Function blocks, and with floating-point IPs. Each guideline has a severity level that indicates the level of compliance requirements. To learn more, see HDL Modeling Guidelines Severity Levels.
General Considerations for Sharing of Subsystems
To share resources for identical subsystems, such as when grouping Product, Add, and Delay blocks to map to one DSP slice, the subsystems to be shared must be Atomic Subsystem blocks, Virtual Subsystem blocks, or MATLAB Function blocks.
Determine whether you want to share resources at the existing clock rate or at a higher clock rate.
Sharing of enabled subsystems is not supported. For sharing resources, use atomic or virtual subsystems without enable semantics.
Specify a SharingFactor that is greater than or equal to the number of subsystems that you want to share.
For example, if you have
10subsystems, and you set the SharingFactor to
5, HDL Coder cannot implement the resource sharing to
2instances of the subsystem. To share the subsystems, divide the subsystems, and then share the instances of the smaller subsystems.
Check the SharingFactor that you specify for various subsystems. The resource sharing optimization overclocks the shared resources by the LCM (Least Common Multiple) of the SharingFactor of various subsystems.
For example, if you specify a SharingFactor of
5for one Subsystem, and a SharingFactor of
7for another Subsystem, the resource sharing optimization overclocks the shared resources by
35. In such cases, it is recommended that you use the same SharingFactor for both subsystems, such as
7. To learn more about this calculation, see How Resource Sharing Works.
Use MATLAB Datapath Architecture for Sharing with MATLAB Function Blocks
HDL Coder shares MATLAB Function blocks that have:
The same Simulink® checksum. Use
Simulink.SubSystem.getChecksumto determine the checksum.
The same HDL block properties.
Make sure that the blocks do not use:
By using the
MATLAB Datapath architecture, you can share
resources inside the MATLAB Function block and across the
MATLAB Function block with other blocks in your Simulink model. When you use this architecture, the code generator treats
the MATLAB Function block like a regular Subsystem
block. This capability enables you to more widely apply various speed and area
optimizations with MATLAB Function blocks. See HDL Optimizations Across MATLAB Function Block Boundary Using MATLAB Datapath Architecture.
Sharing of Subsystems
HDL Coder can share Subsystem blocks that have the same Simulink checksum and the same HDL block properties.
To share Subsystem blocks, the state elements that the blocks can contain are:
Unit Delay Enabled Synchronous
Unit Delay Resettable Synchronous
Unit Delay Enabled Resettable Synchronous
The state elements must have the Initial condition parameter set to 0.
Sharing of subsystems inside enabled subsystems with synchronous semantics is not supported. To share resources, use enabled subsystems with classic semantics.
You cannot share subsystems that contain the following blocks or block implementations:
Discrete Transfer Fcn
Math Function (conj, hermitian, transpose)
MATLAB Function blocks that contain persistent variables
Cascade architecture (MinMax, Product, Sum)
Reciprocal Newton architecture
Filter blocks including Discrete FIR Filter
Communications Toolbox™ blocks
DSP System Toolbox™ blocks, except Discrete FIR Filter
Blocks that are not supported for delay balancing. For details, see Delay Balancing Limitations.
Resource sharing of atomic subsystems might cause a mismatch in the initialization cycles of the validation model if your model has:
Logic in the subsystems shared that produce non-zero output when the input is zero.
Subsystems shared that are in a serial configuration in your design under test (DUT) subsystem.
Resource Sharing of Floating-Point IPs
To share multiple:
Floating-point adders, set
Floating-point multipliers, make sure
ShareMultipliersis set to on.
Other floating-point resources, set
See also Modeling with Native Floating Point.
- Resource Sharing Parameters for Subsystems and Floating-Point IPs | Resource Sharing of Adders and Multipliers
- Resource Sharing of Multipliers to Reduce Area
- Resource Sharing for Area Optimization
- Single-Rate Resource Sharing Architecture