Implementation of FIR Digital Filters On FPGA Board For Real-Time Audio Processing
Implementation of FIR Digital Filters On FPGA Board For Real-Time Audio Processing
Abstract—This research paper presents the filters are widely used in various audio applications, such
implementation of digital filters on an FPGA platform for as frequency shaping, noise removal, and signal
real-time audio signal processing. The paper utilizes the enhancement. We justify the choice of these filters based
Basys-3 field programmable gate array (FPGA) board and on their relevance to audio processing and the human
the peripheral module (PMOD) I2S2 accessory to process auditory spectrum's frequency range.
audio data using digital finite impulse response (FIR) filters.
The extension of the filter kernel length is achieved by To optimize the filter performance and resource
converting the dual-channel input to a single-channel output, utilization, we explore techniques to extend the filter
and the use of free LUTs (Look Up Tables) as digital signal kernel length. We demonstrate how the conversion from
processing (DSP) multipliers, optimizing the utilization of dual-channel input to single-channel output allows for a
available resources. The successful implementation of the larger kernel length, maximizing the utilization of the
filters highlighted the potential for FPGA-based solutions in available resources on the FPGA. Furthermore, we
audio engineering and digital signal processing. The results investigate the utilization of free Look-Up Tables (LUTs)
provide valuable insights that can guide future work in as Digital Signal Processing (DSP) multipliers, enabling
optimizing FPGA-based digital filters for audio engineering. additional computational capacity without consuming
extra resources.
Keywords—digital filter, field programmable gate array
(FPGA), digital signal processing (DSP). The research presented in this paper contributes to
FPGA-based audio signal processing by showing the
I. INTRODUCTION feasibility and effectiveness of implementing digital filters
on the Basys-3 FPGA board. The outcomes of our paper
Digital signal processing techniques have provide valuable insights into the design and optimization
revolutionized the field of audio engineering by enabling of real-time audio processing systems using FPGAs. The
advanced manipulation and analysis of audio signals [1]. findings and methodologies discussed in this paper lay the
Real-time processing of audio data is crucial for groundwork for further advancements in FPGA-based
applications such as audio effects, noise cancellation, audio processing and inspire future research and
speech recognition, and audio enhancement. Field- innovation in this domain.
Programmable Gate Arrays (FPGAs) have emerged as a
powerful platform for implementing real-time signal
processing systems due to their reconfigurability, parallel II. LITERATURE REVIEW
processing capabilities, and low latency. In this paper, we
present an implementation of FIR digital filters on an A. Introduction to FPGAs
FPGA platform for real-time audio signal processing. Field-Programmable Gate Arrays (FPGAs) have
emerged as powerful hardware platforms for implementing
This paper aims to demonstrate the capabilities of various digital signal processing (DSP) applications,
FPGAs to design and implement efficient and high- including real-time audio processing. FPGAs are
performance digital filters. The chosen platform for our programmable semiconductor devices that consist of an
paper is the Basys-3 FPGA board, which offers a rich set array of configurable logic blocks (CLBs), embedded
of resources and peripherals suitable for audio processing memory blocks (BRAM), digital signal processing blocks
applications. To interface with audio sources, we utilize (DSPs), and input/output (I/O) blocks interconnected by a
the PMOD I2S2 accessory, which provides a convenient network of programmable routing resources. What sets
interface for transmitting audio data into and out of the FPGAs apart from other devices is their reconfigurability.
FPGA. This combination of hardware components forms Unlike ASICs, which are designed for specific functions
the foundation for our FPGA-based audio signal and cannot be altered once manufactured, FPGAs can be
processing system. programmed and reprogrammed to implement different
In this paper, we focus on the implementation of functionalities, making them highly adaptable to changing
essential filters for audio processing, including low-pass, requirements.
high-pass, band-pass, and moving average filters. These
A. Choice of Filters
When designing digital filters for audio applications,
several constraints need to be considered to ensure optimal
performance and compatibility with the target hardware. In
the context of audio processing on a FPGA board, the
following constraints are particularly relevant: the audio
spectrum, the available DSP units on the FPGA, and the
sampling frequency. The human audio spectrum, which
encompasses the range of audible frequencies, typically
extends from 20 Hz to 20 kHz. To accurately process
audio signals within this frequency range, it is essential to
Fig. 1. Digilent Basys-3 FPGA Board view.
choose filters that provide sufficient frequency response
234
Authorized licensed use limited to: BRACT's Vishwakarma Institute Pune. Downloaded on July 22,2024 at 10:39:34 UTC from IEEE Xplore. Restrictions apply.
coverage. The filters should be designed to handle TABLE I: RESOURCE UTILIZATION OF 45-TAP DUAL-CHANNEL FILTER
frequencies from 20 Hz to 20 kHz without significant Utilization
attenuation or distortion in their passband, and sufficient Site Type
Used Available % Utilization
attenuation in their stopbands so that an average human
can hear the effects of the filters. Slice LUTs 383 20800 1.84%
DSPs 90 90 100%
Another important consideration is the available
resources on the Basys-3 FPGA board. The board is
equipped with a limited number of DSP units, which are V. IMPLEMENTATION
essential for implementing digital filters efficiently. DSP The Digilent Basys-3 FPGA is programmed in System
units are specialized hardware blocks within the FPGA Verilog using Xilinx Vivado 2019.2. The FIR engine is
designed for digital signal processing operations. The divided into two main files: firbackend.sv and fir.sv. All
number of available DSP units determines the kernel the code can be found in [9]. The file firbackend.sv
length of the filters implemented. In the case of the Basys- contains System Verilog code implements FIR filter
3 FPGA board, having 90 DSP units means the filter engine capable of applying four different filters to
design should consider the utilization of these units to incoming data. It utilizes buffer elements to store the input
achieve the desired audio processing functionality. data and compute the filtered output based on the selected
filter's coefficients. The coefficients for the filters are a
Furthermore, the sampling frequency of the PMOD
part of this file. Based on the currently selected filter, the
I2S2 module plays a crucial role in filter design. The
FIR filter engine computes the output of the filter on
PMOD I2S2 module provides an interface for audio input
receiving each new packet. The output is computed using
and output and operates at a sampling frequency of 44.1
the standard formula for FIR filters, multiplying the
kHz [8]. This sampling frequency represents the number of
coefficients with the corresponding buffer values, and
samples taken per second from the analog audio signal. To
accumulating the results.
ensure accurate audio processing, the filters must be
designed to handle the specific sampling frequency of 44.1 The file fir.sv contains modules that handle and
kHz. This involves considering the cutoff frequencies and connect the AXI stream from the PMOD input to the FIR
filter characteristics that are appropriate for this sampling filter backend and forward the output from the FIR filter to
rate to avoid aliasing and ensure accurate reconstruction of the output stream. The file Basys-3-Master.xdc contains
the audio signal. the mapped pins and switches between hardware and
software, and the clocks used.
B. Selected Filters
With regards to the constraints introduced in the A. Resource Utilization
previous section, the following filters were selected to be Based on the synthesis report of the dual-channel 45-
implemented. All these filters are dual channel, with a tap filter, the utilization of resources is given in Table I.
kernel length of 45 for each filter. Although this design effectively utilizes the available DSP
resources with 100% utilization, there is some room for
1. Low-pass Filter with a cut-off frequency of 1KHz.
improvement in terms of LUT (Look Up Tables)
2. High-pass Filter with a cut-off frequency of 2KHz. utilization. This will be the focus of the next section.
3. Band-pass Filter with a passband from 1KHz to 4KHz.
VI. INCREASING THE KERNEL LENGTH
C. Generation of Coefficients Extending the filter kernel length is a crucial
The coefficients for the digital filters were generated consideration in digital signal processing applications. The
using GNU Octave, a high-level programming language kernel length refers to the number of taps or coefficients in
for numerical computations. The “fir1” function is used to the filter, which directly impacts the filter's frequency
generate the filter coefficients. This function creates a response and its ability to accurately process the input
finite impulse response (FIR) filter with the specified signal. We used two techniques to increase the kernel
number of taps and cutoff frequencies. The resulting length of the implemented filters.
coefficients are then scaled to fit within the desired
coefficient width of 16 bits. The code also prints out the A. Using Single-Channel filters instead of Dual-Channel
coefficients in a formatted, human-readable format. [9] filters
By converting the dual-channel input to a single-
channel output, the available resources can now be
dedicated entirely to a single channel, allowing for a
higher number of taps to be accommodated. By utilizing a
single-channel filter, the number of taps or coefficients can
be effectively doubled compared to a dual-channel filter
design with the same available resources. The decision to
use a single-channel filter should be based on the
application's nature and the specific requirements of the
signal processing task. In scenarios where the input signal
contains significant information in both channels, or when
preserving stereo imaging is crucial, a dual-channel filter
may be more appropriate.
Fig. 3. Pictorial view of PMOD I2S2.
235
Authorized licensed use limited to: BRACT's Vishwakarma Institute Pune. Downloaded on July 22,2024 at 10:39:34 UTC from IEEE Xplore. Restrictions apply.
200
150
100 Kernel Length
50
0
Utilization
Site Type
Used Available % Utilization
Slice LUTs 18948 20800 91.1%
DSPs 90 90 100%
236
Authorized licensed use limited to: BRACT's Vishwakarma Institute Pune. Downloaded on July 22,2024 at 10:39:34 UTC from IEEE Xplore. Restrictions apply.
solutions in audio engineering and digital signal [2] Abdulzahra, Mohammed & Al-Dulaimi, Mohammed & Wahhab,
processing. Husam & Amer, Ahmed. (2023). Design and Implementation of
Communication Digital FIR Filter for Audio Signals on the FPGA
One notable aspect of the paper was the extension of Platform. Journal of Communications. Volume 18, 89-97.
10.12720/jcm.18.2.89-96.
the filter kernel length. By converting the dual-channel
input to a single-channel output, it was possible to double [3] Vellaiappan, Elamaran & Upadhyay, H.N. & Raju, Nallusamy &
Kumaravelu, Narasimhan. (2015). Real time audio denoising using
the kernel length of the implemented filters. The utilization digital fir filters with FPGA implementation. International Journal
of free LUTs as DSP multipliers further enhanced the filter of Pharmacy and Technology. 7. 9802-9810.
capabilities. By mapping the multiplier DSP units to the [4] Mohammed Abdulzahra Ahmed Al-Dulaimi, Husam A. Wahhab,
available LUTs, an additional 73 multiplier blocks were and Ahmed Abdulhussein Amer. (2023). Design and
obtained. The use of free LUTs as DSP multipliers Implementation of Communication Digital FIR Filter for Audio
highlighted the flexibility and resourcefulness of the Signals on the FPGA Platform. Journal of Communications vol.
18, no. 2, February 2023.
FPGA platform for optimizing the design and achieving
[5] Shensheng Tang, Siong Moua, Yi Xie and Yi Zheng. (2022).
efficient utilization of available resources. FPGA based Implementation of an Audio Signal Processing
While the paper achieved its objectives, there are areas System on Zedboard. Journal of Smart Technology Applications
Vol.3, No.1 (2022), pp.1-20.
for further exploration and improvement. Future work in
[6] C. Ünsalan, B. Tar, “Digital system design with FPGA:
implementing digital filters on FPGA for audio processing Implementation using Verilog and VHDL,” McGraw-Hill
can include exploring more complex filters such as Infinite Education, 2017.
Impulse Response (IIR) filters. Another area of future [7] Digilent. “Basys-3 – Digilent Reference.” digilent.com.
work can be the development of FPGA-based compilation https://digilent.com/reference/programmable-logic/basys-3/start
flows for ultra-low latency audio signal processing [11], (accessed Jun. 29, 2023)
involving exploration of new algorithms and techniques [8] Digilent. “Pmod I2S2 Reference Manual.” digilent.com.
for reducing latency. Research can also be done on the https://digilent.com/reference/pmod/pmodi2s2/reference-manual
(accessed Jun. 29, 2023)
implementation of multirate digital filters (MDF), or lattice
[9] Fahad Syed. “Real-Time Audio Processing on Basys-3 FPGA.”
wave digital filters on FPGA. github.com.
https://github.com/sinandredemption/fir_basys3 (accessed Jun. 29,
REFERENCES 2023)
[10] S. W. Smith, “The scientist and engineer's guide to digital signal
processing,” California Technical Pub., 1997.
[1] M. Abdulzahra, M. Al-Dulaimi, H. Wahhab, A. Amer, “Design
[11] Maxime Popoff, Romain Michon, Tanguy Risset, Yann Orlarey,
and Implementation of Communication Digital FIR Filter for
Stéphane Letz. Towards an FPGA-Based Compilation Flow for
Audio Signals on the FPGA Platform,” Journal of
Ultra-Low Latency Audio Signal Processing. SMC-22 - Sound and
Communications, Vol. 18, pp. 89-97, 2023 doi:
Music Computing, Jun 2022, Saint-Étienne, France. hal-03805199
10.12720/jcm.18.2.89-96.
237
Authorized licensed use limited to: BRACT's Vishwakarma Institute Pune. Downloaded on July 22,2024 at 10:39:34 UTC from IEEE Xplore. Restrictions apply.