Skip to Main Content Skip to Search
Product Documentation

Improving Filter Performance with Pipelining

Optimizing the Clock Rate with Pipeline Registers

You can optimize the clock rate used by filter code by applying pipeline registers. Although the registers increase the overall filter latency and space used, they provide significant improvements to the clock rate. These registers are disabled by default. When you enable them, the coder adds registers between stages of computation in a filter.

For...Pipeline Registers Are Added Between...
FIR, antisymmetric FIR, and symmetric FIR filtersEach level of the final summation tree
Transposed FIR filtersCoefficient multipliers and adders
IIR filtersSections

For example, for a sixth order IIR filter, the coder adds two pipeline registers, one between the first and second section and one between the second and third section.

For FIR filters, the use of pipeline registers optimizes filter final summation. For details, see Optimizing Final Summation for FIR Filters

To use pipeline registers,

  1. Select the Add pipeline registers option in the Filter architecture pane of the Generate HDL dialog box.

  2. For FIR, antisymmetric FIR, and symmetric FIR filters, consider setting an error margin for the generated test bench to account for numeric differences. The error margin is the number of least significant bits the test bench will ignore when comparing the results. To set an error margin:

    1. Select the Test Bench pane in the Generate HDL dialog box. Then click the Configuration tab.

    2. Specify an integer in the Error margin (bits) field that indicates an acceptable minimum number of bits by which the numerical results can differ before the coder issues a warning.

  3. Continue setting other options or click Generate to initiate code generation.

Command Line Alternative: Use the generatehdl function with the property AddPipelineRegisters to optimize the filters with pipeline registers.

Multiplier Input and Output Pipelining for FIR Filters

If you choose to retain multiplier operations for a FIR filter, you can achieve significantly higher clock rates by adding pipeline stages at multiplier inputs or outputs.

The following figure shows the GUI options for multiplier pipelining options. To enable these options, Coefficient multipliers to Multiplier.

Command Line Alternative: Use the generatehdl function with the MultiplierInputPipeline and MultiplierOutputPipeline properties to specify multiplier pipelining for FIR filters.

Optimizing Final Summation for FIR Filters

If you are generating HDL code for an FIR filter, consider optimizing the final summation technique to be applied to the filter. By default, the coder applies linear adder summation, which is the final summation technique discussed in most DSP text books. Alternatively, you can instruct the coder to apply tree or pipeline final summation. When set to tree mode, the coder creates a final adder that performs pair-wise addition on successive products that execute in parallel, rather than sequentially. Pipeline mode produces results similar to tree mode with the addition of a stage of pipeline registers after processing each level of the tree.

In comparison,

To change the final summation to be applied to an FIR filter,

  1. Select one of the following options in the Filter architecture pane of the Generate HDL dialog box:

    For...Select...
    Linear mode (the default)Linear from the FIR adder style menu
    Tree mode Tree from the FIR adder style menu
    Pipeline modeThe Add pipeline registers check box

  2. If you specify tree or pipelined mode, consider setting an error margin for the generated test bench to account for numeric differences. The error margin is the number of least significant bits the test bench will ignore when comparing the results. To set an error margin,

    1. Select the Test Bench pane in the Generate HDL dialog box. Then click the Configuration tab.

    2. Specify an integer in the Error margin (bits) field that indicates an acceptable minimum number of bits by which the numeric results can differ before the coder issues a warning.

  3. Continue setting other options or click Generate to initiate code generation.

Command Line Alternative: Use the generatehdl function with the property FIRAdderStyle or AddPipelineRegisters to optimize the final summation for FIR filters.

Specifying or Suppressing Registered Input and Output

The coder adds an extra input register (input_register) and an extra output register (output_register) during HDL code generation. These extra registers can be useful for timing purposes, but they add to the filter's overall latency. The following process block writes to extra output register output_register when a clock event occurs and clk is active high (1):

Output_Register_Process : PROCESS (clk, reset)
BEGIN
  IF reset = '1' THEN
    output_register <= (OTHERS => '0');
  ELSIF clk'event AND clk = '1' THEN
    IF clk_enable = '1' THEN
      output_register <= output_typeconvert;
    END IF;
  END IF;
END PROCESS Output_Register_Process;

If overall latency is a concern for your application and you have no timing requirements, you can suppress generation of the extra registers as follows:

  1. Select the Global Settings tab on the Generate HDL dialog box.

  2. Select the Ports tab in the Additional settings pane.

  3. Clear Add input register and Add output register as required. The following figure shows the setting for suppressing the generation of an extra input register.

Command Line Alternative: Use the generatehdl and function with the properties AddInputRegister and AddOutputRegister to add an extra input or output register.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS