MATLAB Examples


This error message generally occurs when you have Simulink™ blocks performing floating-point operations inside a feedback loop. These blocks have a latency. HDL Coder™ is unable to allocate delays to compensate for the latency, because the code generator needs to add delays and balance them to maintain numerical accuracy.

If you open this example, you see a Simulink™ model that uses single data types.

To generate HDL code for the CumSum_Sl Subsystem, right-click the subsystem and select HDL Code > Generate HDL for Subsystem. During code generation, HDL Coder™ generates an error:

Unable to allocate delays to compensate for the 11 delay(s) introduced by Add
in native floating-point mode. Consider either increasing the oversampling
factor, setting the 'Latency Strategy' to 'Zero', or adding the necessary
output pipelines via HDL block properties for other blocks in the model to
accommodate for the latency introduced by this block. 

By using the path to the block mentioned in the error message, navigate to the Add block in the model. This block is inside a feedback loop.

The Add block has a latency of 11. When generating code, HDL Coder™ cannot allocate 11 delays for the block, because it cannot add matching delays to other paths.

This model serves as an example to illustrate the various strategies to solve this problem.