This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Subsystem Optimizations for Filters

The Discrete FIR Filter (when used with scalar or multichannel input data) and Biquad Filter blocks participate in subsystem-level optimizations. To set optimization properties, right-click on the subsystem and open the HDL Properties dialog box.

For these blocks to participate in subsystem-level optimizations, you must leave the block-level Architecture set to the default, Fully parallel.

You cannot use these subsystem optimizations when using the Discrete FIR Filter in frame-based input mode.

Sharing

These filter blocks support sharing resources within the filter and across multiple blocks in the subsystem. When you specify a SharingFactor, the optimization tools generate a filter implementation in HDL that shares resources using time-multiplexing. To generate an HDL implementation that uses the minimum number of multipliers, set the SharingFactor to a number greater than or equal to the total number of multipliers. The sharing algorithm shares multipliers that have the same input and output data types. To enable sharing between blocks, you may need to customize the internal data types of the filters. Alternatively, you can target a particular system clock rate with your choice of SharingFactor.

Resource sharing applies to multipliers by default. To share adders, select the check box under Resource sharing on the Configuration Parameters > HDL Code Generation > Global Settings > Optimizations dialog box.

For more information, see Resource Sharing (HDL Coder) and the Area Reduction of Filter Subsystem example.

You can also use a SharingFactor with multichannel filters. See Area Reduction of Multichannel Filter Subsystem.

Streaming

Streaming refers to sharing an atomic part of the design across multiple channels. To generate a streaming HDL implementation of a multichannel subsystem, set StreamingFactor to the number of channels in your design.

If the subsystem contains a single filter block, the block-level ChannelSharing option and the subsystem-level StreamingFactor option result in similar HDL implementations. Use StreamingFactor when your subsystem contains either more than one filter block or additional multichannel logic that can participate in the optimization. You must set block-level ChannelSharing to off to use StreamingFactor at the subsystem level.

See Streaming (HDL Coder) and the Area Reduction of Multichannel Filter Subsystem example.

Pipelining

You can enable DistributedPipelining at the subsystem level to allow the filter to participate in pipeline optimizations. The optimization tools operate on the InputPipeline and OutputPipeline pipeline stages specified at subsystem level. The optimization tools also operate on these block-level pipeline stages:

  • InputPipeline and OutputPipeline

  • MultiplierInputPipeline and MultiplierOutputPipeline

  • AddPipelineRegisters

The optimization tools do not move design delays within the filter architecture. See Distributed Pipelining (HDL Coder).

The filter block also participates in clock-rate pipelining, if enabled in Configuration Parameters. This feature is enabled by default. See Clock-Rate Pipelining (HDL Coder).

Area Reduction of Filter Subsystem

To reduce the number of multipliers in the HDL implementation of a multifilter design, use the SharingFactor HDL Coder™ optimization.

The model includes a sinusoidal signal source feeding a filter subsystem targeted for HDL code generation.

The subsystem contains a Discrete FIR Filter block and a Biquad Filter block. This design demonstrates how the optimization tools share resources between multiple filter blocks.

The Discrete FIR Filter block has 43 symmetric coefficients. The Biquad Filter block has 6 coefficients, two of which are unity. With no optimizations enabled, the generated HDL code takes advantage of symmetry and unity coefficients. The nonoptimized HDL implementation of the subsystem uses 27 multipliers.

To enable streaming optimization for the Multi-Filter Subsystem, right-click the subsystem and select HDL Code > HDL Block Properties.

Set the SharingFactor to 27 to reduce the design to a single multiplier. The optimization tools attempt to share multipliers with matching data types. To reduce to a single multiplier, you must set the internal data types of the filter blocks to match each other.

To observe the effect of the optimization, under Configuration Parameters > HDL Code Generation, select Generate resource utilization report and Generate optimization report. Then, to generate HDL code, right-click the Multi-Filter Subsystem and select HDL Code > Generate HDL for Subsystem.

With the SharingFactor applied, the subsystem upsamples the rate by 27 to share a single multiplier for all the coefficients.

In the Code Generation Report window, click High-level Resource Report. The generated HDL code now uses one multiplier.

Area Reduction of Multichannel Filter Subsystem

To reduce the number of multipliers in the HDL implementation of a multichannel filter and surrounding logic, use the StreamingFactor HDL Coder™ optimization.

The model includes a two-channel sinusoidal signal source feeding a filter subsystem targeted for HDL code generation.

The subsystem contains a Discrete FIR Filter block and a constant multiplier. The multiplier is included to show the optimizations operating over all eligible logic in a subsystem.

The filter has 44 symmetric coefficients. With no optimizations enabled, the generated HDL code takes advantage of symmetry. The nonoptimized HDL implementation uses 46 multipliers: 22 for each channel of the filter and 1 for each channel of the Product block.

To enable streaming optimization for the Multichannel FIR Filter Subsystem, right-click the subsystem and select HDL Code > HDL Block Properties.

Set the StreamingFactor to 2, because this design is a two-channel system.

To observe the effect of the optimization, under Configuration Parameters > HDL Code Generation, select Generate resource utilization report and Generate optimization report. Then, to generate HDL code, right-click the Multichannel FIR Filter Subsystem and select HDL Code > Generate HDL for Subsystem.

With the streaming factor applied, the logic for one channel is instantiated once and run at twice the rate of the original model.

In the Code Generation Report window, click High-level Resource Report. The generated HDL code now uses 23 multipliers, compared to 46 in the nonoptimized code. The multipliers in the filter kernel and subsequent scaling are shared between the channels.

To apply SharingFactor to multichannel filters, set the SharingFactor to 23.

The optimized HDL now uses only 2 multipliers. The optimization tools do not share multipliers of different sizes.

Related Topics