# FIR Filters

## 1 Finite Impulse Response (FIR) filters

Schematic diagram of an FIR filter where sample delays (${\displaystyle Z}$), coefficient multiplication (${\displaystyle b}$), and summation are used to convolve the input waveform ${\displaystyle x}$ is by the coefficients ${\displaystyle b}$. This convolution in time corresponds to a multiplication in frequency, making the output samples, ${\displaystyle y_{i}}$, reflect a frequency-filtered version of ${\displaystyle x_{i}}$.

FIR filters are digital circuits that are used to filter an input signal in frequency. As shown above, samples of a signal, ${\displaystyle x_{i}}$, propagate through the chain of delays along the top of the diagram as the circuit is clocked. At each clock, the set of ${\displaystyle N}$ samples of ${\displaystyle x}$ (where ${\displaystyle N}$ is called the number of “taps" in the FIR filter) held in this chain of delays is multiplied by ${\displaystyle N}$ coefficients, ${\displaystyle b_{0}\dots b_{N-1}}$, and then summed. While the coefficients remain constant — each associated with one tap — the input samples continue to shift through the circuit. In effect, this results in the input waveform ${\displaystyle x}$ being convolved by the coefficients ${\displaystyle b}$, as in the equation:

${\displaystyle y(\tau )=[b*x](\tau )=\int {b(t)\cdot x(\tau -t)~dt}.\,\!}$

When ${\displaystyle x}$, ${\displaystyle b}$, and ${\displaystyle y}$ are discretely sampled, this convolution becomes

${\displaystyle y(t_{i})=\sum _{j=0}^{N-1}b(t_{j})\cdot x(t_{i-j}),\,\!}$

which is precisely the arithmetic that the FIR filter circuit implements. In particular, note how the samples of ${\displaystyle b}$ (which increase left-to-right in the figure above), are multiplied by samples of ${\displaystyle x}$ that are in the opposite order. For example, in a 4-tap FIR filter, 4 samples of ${\displaystyle b\equiv [b(t_{0}),b(t_{1}),b(t_{2}),b(t_{3})]}$ are multiplied by 4 samples of ${\displaystyle x}$ in reversed order ${\displaystyle [x(t_{3}),x(t_{2}),x(t_{1}),x(t_{0})]}$ before the products are all summed together to produce ${\displaystyle y(t_{0})=b(t_{0})x(t_{3})+b(t_{1})x(t_{2})+b(t_{2})x(t_{1})+b(t_{3})x(t_{0})}$. Note that the output sample for ${\displaystyle y}$ is labeled ${\displaystyle t_{0}}$, but because the logical steps of multiplication and summation, the first valid sample of the convolved signal may appear several clock cycles after the input signal is multiplied. This delay in the output (called the “latency”) is a common artifact of digital signal processing circuits, and is usually not a problem.

### 1.1 Coefficient Selection

FIR filters implement different filtering shapes, depending on the values chosen for ${\displaystyle b}$. By the convolution theorem, ${\displaystyle b(t)}$ represents the Fourier transform of the frequency filter that is applied. Usually, the amplitude of this filter as a function of frequency is the most important feature; the (complex) phase of the output is of less importance. This, combined with the fact that windowing functions may be desired to reduce spectral leakage and to optimize filter flatness, roll-off, or stop-band rejection, can complicate the choice of FIR coefficients. Many design tools exist for optimizing FIR filter coefficients.

### 1.2 Optimizations

One common optimization in FIR filters is to use only real-valued coefficients for ${\displaystyle b}$. While the resulting filter must necessarily be symmetric between positive and negative frequency components, this constrain is often worth the factor of ${\displaystyle \sim }$2 reduction in the computational complexity of the FIR filtering operation. (Real-valued multiplies require approximately half the operations complex multiplies require). Another common optimization in FIR filters is to implement half-band, quarter-band, etc. filters, where a large number of the FIR coefficients end up being 0. Since such coefficients can be implemented by stripping out the multiplier circuit and omitting the tap from the summation, this optimization can similarly save a significant fraction of resources.

### 1.3 Number of Taps

Finally, the number of taps in an FIR filter affects the sharpness of the filter. This can be easily understood by recognizing that the number of taps determines the length of time over which the filter operates, and sharp features in frequency require longer time intervals to represent. In fact, for those who are familiar with “poles" in analog filters (1 pole = -6dB; people talk about, e.g., a 6-pole Butterworth filter), each tap in an FIR filter is equal to 1 pole.