Control the Scope of Delay Balancing

This example shows how to balance delays in specific parts of a design, without balancing delays on the entire design.

Introduction

The Delay Balancing and Validation Model Workflow In HDL Coder (TM) example shows how to use the 'BalanceDelays' option to balance the additional delays introduced by HDL Coder for certain block implementations and optimizations. This model-level option controls delay balancing for the entire model. However, for certain designs, you may want to balance delays in only some parts of the design. For example, in a design containing a data path and a control path, delay balancing should be applied only on the data path of the design, i.e., the paths requiring data synchronization. This example shows how to use a subsystem-level 'BalanceDelays' option provides fine-grained control on how HDL Coder balances delays in individual subsystems.

We use two examples to demonstrate the use of this subsystem-level feature:

hdlcoder_localdelaybalancing.slx shows how to disable delay balancing on user-defined control paths.

hdlcoder_localdelaybalancing_sharing.slx shows how the user can apply HDL optimizations like resource sharing in the presence of complicated control paths that require carefully constrained delay balancing.

Example 1: Constraining Delay Balancing to the data path

The example model, "hdlcoder_localdelaybalancing.slx", has two subsystems under hdlcoder_localdelaybalancing/Subsystem: param_control and symmetric_fir, containing the control logic and the data path, respectively.

In this example design, only the data path, symmetric_fir, requires data synchronization. The outputs from param_control are coefficients to the FIR filter and do not have to synchronize with each other or with the processed data. Turning off delay balancing on the control logic therefore saves resources. In order to achieve this, the model-level 'BalanceDelays' option must be 'off', and the subsystem-level 'BalanceDelays' options must be set appropriately on the data path and control path.

Notice that simulating the validation model now shows mismatches, because the validation model does not compensate for latency inserted by optimizations or block implementations.

Example 2: Localized Delay Balancing and Resource Sharing

The resource sharing optimization saves area usage in the final HDL implementation, at the cost of introducing a cycle of latency for each sharing group. This additional latency is usually balanced during delay balancing so that the numerics and functionality of the algorithm are preserved. One of the restrictions of resource sharing is that it cannot be applied on a subsystem within a feedback loop. Thus, if resource sharing is specified for a subsystem within a loop, then the optimization will fail. You can observe this in hdlcoder_localdelaybalancing_sharing.slx, where hdlcoder_localdelaybalancing_sharing/Subsystem/Subsystem is within a feedback loop.

However, in this design, you may know that the feedback loop is rarely used since the control signal causes the switch block, 'hdlcoder_localdelaybalancing_sharing/Subsystem/Subsystem/Switch', to choose the top input, the feed-forward path, most of the time. This user insight implies that it is fine to go ahead with resource sharing in this subsystem and disregard the feedback loop in the parent subsystem. In such cases, if you wish to ignore feedback loops during delay balancing, you must turn off delay balancing in the subsystem containing the feedback loop. This enables HDL Coder (TM) to ignore the feedback loop and proceed with resource sharing.