## Introduction

If you’re an HDL developer, chances are you’re going to encounter digital filters in some shape or form throughout your career. Hence this blog post serves as an introduction to the topic, seen from the eyes of a hardware developer.

This article discusses mainly the implementation of the filters rather than the theory and design. Therefore, it would be beneficial to have some basic understanding of the digital signal processing theory. If not, please refer to your favorite DSP book; mine is [1] 🙂.

## FIR and IIR filter types

Digital filters are devices that modify the spectrum and phase of an input signal. Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) are the two main types of digital filters you’re most likely to work with. Both are quite different from each other, yet they can be used interchangeably (in some situations).

The main difference between the two when it comes to implementation, however, is the signal path – FIRs are feed-forward-based (there are exceptions[1]), whereas IIR filters are based on a combination of feed-forward and feedback paths. This difference brings unique challenges when it comes to HDL implementation.

## Filter building blocks

Figure 1 shows examples of FIR and IIR filter structures. The block diagrams specify the signal path and its operations, but not how they are implemented. Notice that both devices are composed of three main components – addition (the circles), multiplication (the triangles), and memory elements (the squares).

### Memory elements

These are memory storage units that hold z-amount of consecutive data samples. For example, a delay element of z-1 holds one value, whereas z-N holds N-amount of values. When there are multiple delay elements in a row, the data is being shifted (transferred) from one element to the next once per sampling period. All memory elements connected sequentially form a delay line.

### Arithmetic operators

The most common arithmetic operations involved in digital filters are addition and multiplication, with each using its own hardware. They are so common that some hardware allows them to perform a multiply-add operation, where both operations are performed at once. There are, of course, other operations such as division, logarithmic and trigonometric operations, but they are far less common.

### Sampling rate

This is the rate at which the data is being processed by the filter, also known as sampling frequency or sampling clock/period (Fs). During this period, all operations (memory or arithmetic) are executed once.