Main Content

Adaptive Pipelining

Certain patterns or combination of blocks with registers can improve the achievable clock frequency and reduce the area usage on the FPGA boards. The adaptive pipelining optimization creates these patterns by inserting pipeline registers to the blocks in your design. To determine the optimal number of pipeline registers to insert in your design, the optimization considers the target device, target frequency, multiplier word lengths, and the settings in the HDL Block Properties. Use adaptive pipelining with:

  • Clock-rate pipelining to insert pipeline registers at a faster clock-rate instead of the slower data-rate. With clock-rate pipelining, you can design your DUT at one rate, and then specify the Oversampling factor.

  • Resource sharing which saves area and timing because the code generator shares resources and inserts adaptive pipeline registers.

By default, the adaptive pipelining optimization is disabled on the model. In certain situations, you must enable this optimization before generating HDL code. See Design Patterns That Require Adaptive Pipelining.

Requirements

  • For HDL Coder™ to insert adaptive pipelines, specify the target device. When your design has multipliers, specify the target device and the target frequency.

    Note

    If you use a target device that is not characterized for adaptive pipelining, the optimization uses Xilinx® Virtex®-7 when Xilinx Vivado is specified as the Synthesis Tool, and uses Intel® Stratix® V when the Synthesis Tool is Altera Quartus II or Intel Quartus Pro.

  • Make sure that delay balancing is enabled for the subsystem that you want HDL Coder to insert adaptive pipelines for. If you disable delay balancing, the code generator does not insert adaptive pipelines.

  • Make sure that your design does not have floating-point data types or operations.

Note

In some cases, when you have blocks inside a feedback loop, adaptive pipelining is unable to insert the required number of pipeline registers at the output. Delay balancing can then fail.

Specify Adaptive Pipelining

You can set adaptive pipelining for an entire model or, for finer control, you can set adaptive pipelining for subsystems within the top-level DUT subsystem.

Enable Adaptive Pipelining for a Model

By default, adaptive pipelining is disabled at the model level. You can enable adaptive pipelining in one of the following ways:

  • In the HDL Workflow Advisor, on the HDL Code Generation > Set Code Generation Options > Set Optimization Options > Pipelining tab, select Adaptive pipelining.

  • In the Configuration Parameters dialog box, on the HDL Code Generation > Optimization > Pipelining tab, select Adaptive pipelining and click OK.

  • At the command line, use the makehdl or hdlset_param function to set Adaptive pipelining to on.

    hdlset_param(gcs, 'AdaptivePipelining', 'on')

Enable Adaptive Pipelining for a Subsystem

By default, subsystems in your model inherit the model-level adaptive pipelining setting. If you want HDL Coder to selectively enable adaptive pipelines for a subsystem in your model, set AdaptivePipelining to on for that subsystem.

To learn how to set adaptive pipelining for a subsystem, see Set Adaptive Pipelining For a Subsystem.

Supported Blocks

Adaptive pipelining supports these lookup tables, multipliers, multiply accumulate, and rate transition blocks for automatic pipeline insertion.

  • n-D Lookup Table

  • Direct Lookup Table (n-D)

  • Sine HDL Optimized

  • Cosine HDL Optimized

  • Downsample

  • Rate Transition

  • Product

  • Gain

  • Multiply-Add

  • Multiply-Accumulate

  • MATLAB Function

Pipeline Insertion for Rate Transition and Downsample Blocks

To insert adaptive pipelines for the Rate Transition and Downsample blocks:

  1. Specify the target device.

  2. Make sure that Downsample blocks have a Downsample factor greater than two.

When generating code, HDL Coder inserts a pipeline register at the output port of the Downsample block. Addition of the pipeline register can avoid the bypass register logic, which saves area on the target FPGA.

This figure is the generated model for the blocks with Xilinx Virtex7 as the target FPGA device.

Pipeline Insertion for Product and Gain Blocks

To insert adaptive pipelines for these blocks:

  1. Specify the target device.

  2. Specify a target frequency greater than zero.

When generating code, HDL Coder inserts registers at the input and output ports of the blocks. The combination of multipliers with the registers can potentially map to DSP units on the target device.

This figure is the generated model for the Product, Gain, and Multiply-Add blocks with Intel Arria10 as the target FPGA device and a target frequency of 500 MHz. The inputs to the blocks are of type int16.

The pattern and number of pipeline registers that HDL Coder inserts can vary depending on the target device, target frequency, and the multiplier word lengths.

This figure is the generated model for the blocks with Xilinx Virtex7 as the target FPGA device and a target frequency of 1500 MHz. The inputs are of type int8.

The blocks have a different number of pipeline registers at the output ports. To match the delays, HDL Coder adds a delay at the output of the Product and Gain blocks.

Pipeline Insertion for Multiply-Add and Multiply-Accumulate Blocks

To insert adaptive pipelines for these blocks:

  1. Specify the target device.

  2. Specify a target frequency greater than zero.

  3. Use the Parallel HDL architecture for the Multiply-Accumulate block. For an input vector of size N, this architecture uses N Multiply-Add blocks in series to compute the result.

Caution

The Multiply-Add block with PipelineDepth set to auto or a value greater than zero and the Multiply-Accumulate block with HDL architecture specified as Parallel ignore the adaptive pipelining setting. If you specify the target FPGA device and a target frequency greater than zero, the code generator inserts pipeline registers at the inputs and outputs of the block even when adaptive pipelining is disabled.

When generating code, HDL Coder inserts registers at the input and output ports of the blocks. The combination of the blocks with the registers can potentially map to DSP units on the target device.

This figure is the generated model for the Multiply-Add and Multiply-Accumulate with Intel Arria10 as the target FPGA device and a target frequency of 500 MHz. The inputs to the blocks are of type int8.

Multiply-add and accumulate adaptive pipelining.

The pattern and number of pipeline registers that HDL Coder inserts can vary depending on the target device, target frequency, and the multiplier word lengths.

This figure is the generated model for the blocks with Xilinx Virtex7 as the target FPGA device and a target frequency of 1500 MHz. The inputs are of type int16.

Pipeline Insertion for MATLAB Function Blocks

To insert adaptive pipelines for MATLAB Function blocks:

  1. Specify the target device.

  2. Specify a target frequency greater than zero.

  3. Set the HDL architecture for the MATLAB Function blocks to MATLAB Datapath.

HDL Coder treats MATLAB Function blocks with architecture set to MATLAB Datapath like regular Subsystems. The code generator converts the MATLAB® algorithm to a Simulink® block diagram. If the Simulink diagram uses blocks that are supported by adaptive pipelining such as Product or Add. the code generator inserts pipeline registers at the input and output ports of the blocks. The combination of multipliers with the registers can potentially map to DSP units on the target device.

Consider a MATLAB Function block that uses the MATLAB Datapath architecture. This code is the algorithm inside the MATLAB Function block.

function y = fcn(u)

y = u*5;

This figure is the generated model for the MATLAB Function block with Intel Arria10 as the target FPGA device and a target frequency of 500 MHz. The inputs to the blocks are of type int16. The code generator inferred the algorithm as a multiplication by a constant and inserted adaptive pipelines at the input and output.

See HDL Applications for the MATLAB Function Block.

Adaptive Pipelining Report

To see the adaptive pipelining information in the report, before you generate code for each Subsystem or model reference, enable the Code Generation report. To enable the Code Generation report, in the Configuration Parameters dialog box, on the HDL Code Generation pane, select Generate optimization report.

When you generate code, HDL Coder produces the Code Generation report. Select the Adaptive Pipelining section of the Optimization report.

The Adaptive Pipelining report displays the status of the adaptive pipelining optimization and whether HDL Coder inserted adaptive pipelines in your design.

If adaptive pipelining is successful, the report displays the blocks for which HDL Coder inserted pipeline registers, the number of pipeline registers inserted, and any additional notes. Click the link to the block to see the pipeline registers inserted to the blocks in your design.

If adaptive pipelining fails, the report displays the criteria that caused adaptive pipelining to fail.

Related Topics