FIRV2
Overview
FIR filter with support for hardware accelerator for compatible targets
Discussion
The FIR Module implements a direct convolution N-order Finite Impulse Response filter. The module operates on multiple channels with all channels sharing the same set of filter coefficients. The filter coefficients are stored in the array, coeffs, in normal order. The size of the array is numTaps x 1. The state variable array is of size (numTaps + blockSize + 3) x numChannels. Generic implementation needs "blockSize" as the size. Dependent on the platform, additional words are added to state buffer for SIMD optimizations.
The module is optimized in assembly on the SHARC. The SHARC implementation utilizes SIMD if the length of the filter is even and this reduces the processing load significantly. If you have an odd order filter, you can zero pad the filter with one additional zero coefficient and realize the benefits of SIMD.
V2 was introduced to support en- or disabling hardware accelerator for compatible targets. Hardware accelerator may significantly reduce the module processing load. Current platforms using hardware accelerator: - Analog Devices SHARC+ (ADSP-2159x) - Analog Devices SHARC-FX (ADSP-2183x, planned) - Texas Instruments C7x (TI AM62D)
On the ADI SHARC+ platforms, except ADSP-2157x and ADSP-2158x, the module make use of FIR Accelerators, in legacy mode, to optimize the processing time. All the channels are processed in FIR accelerator. On SHARC+ processor, additional memory is allocated for accelerator TCB with size of numAcceleratorChannels*13. As the accelerators access data by DMA, when the dm and pm caches are enabled, extra cycles are needed to maintain cache coherence. It is highly recommended to increase the allocation priority of this module instance in the signal flow to have a larger chance to allocate in the AWE fast heaps. In this way, the overhead from accelerator can be minimized. If any of this module instances allocated in the AWE slow heap, please note that the CPU load might be higher than without FIRA due to cache coherence maintenance. Maximum number of channels that can be processed in FIR Accelerator is limited to 32 and the remaining channels are processed by the core. i.e. FIRA channels=min(numChannels, 32)
On the processors of 2159x where 2 FIR accelerators are available with dual SHARC+ cores, two FIR accelerators are used which further reduces the processing load of multiple channels. Here the max FIRA channels = min(numChannels, 32*2). Please note that this module is not multi-core safe i.e. same module can not be used in Sharc1 and Sharc2 at the same time.
Module Pack
Standard
ClassID
classID = 258
Type Definition
typedef struct _ModuleFIRV2
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 numTaps; // Length of the filter.
INT32 stateIndex; // Index of the oldest state variable in the array of state variables.
INT32 enableHWAccel; // Enables or disables hardware accelerators for compatible targets
FLOAT32* coeffs; // Filter coefficient array in normal order.
FLOAT32* state; // State variable array. The size of the array equals stateLen * numChannels.
void * hardware_specific_struct_pointer; // This is the internal TCB array used for hardware specific accelerator
} ModuleFIRV2Class;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| numTaps | int | const | 0 | 31 | 1:1:5000 | |
| stateIndex | int | state | 1 | 0 | Unrestricted | |
| enableHWAccel | int | const | 1 | 0 | 0:1 | |
| coeffs | float* | parameter | 0 | [31 x 1] | Unrestricted | |
| state | float* | state | 1 | [66 x 1] | Unrestricted | |
| hardware_specific_struct_pointer | void * | state | 1 | Unrestricted |
Pins
Input Pins
| Name | in |
| Description | audio input |
| Data type | float |
| Channel range | Unrestricted |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
Output Pins
| Name | out |
| Description | audio output |
| Data Type | float |
Matlab Usage
File Name: fir_v2_module.m
M=fir_v2_module(NAME, L, ENABLEHWACCEL)
Creates an FIR filter object for use in the Audio Weaver environment.
The module has a single multichannel input pin. This module supports
hardware accelerator flag
Arguments:
NAME - name of the module.
L - length of the filter (number of taps).
ENABLEHWACCEL - hardware accelerator flag for compatible targets
Copyright (c) 2026 DSP Concepts, Inc.