This repository presents digital design for a low-pass FIR filter. Leveraging the filterDesigner tool in MATLAB, we meticulously crafted a 50th Order FIR Low Pass Filter utilizing the Hamming windowing method.then we extracted the filter coefficients and meticulously implemented the design using the Verilog description language. This design has undergone rigorous simulation on VIVADO to ensure its efficacy and accuracy.
An FIR (Finite Impulse Response) filter is a type of digital filter used in signal processing. It operates by convolving a finite-length input signal with a series of coefficients, which are typically called the filter taps. These coefficients determine how the input signal is weighted and combined to produce the output signal. FIR filters are is widely used in different applications such as biomedical, communication and control due to its easily implementation, stability and best performance. Its simplicity makes it attractive for many applications where it is need to minimize computational requirements.
Digital filters are implemented using the basic building block elements of adders, multipliers, and shift registers. How these elements are arranged and interconnected defines a filter β s architecture. In general, a given filter can have multiple architectures that can be used to implement a common transfer function.
Another baseline FIR architecture is called the transpose FIR, which is a variation of the direct architecture theme. An FIR, with an impulse response β[π]={β_0 , β_1 , . . . , β_(πβ1)} can be implemented as the transpose architecture shown in the following Figure
Comparing with the direct form we observe that the order of the filter coefficients is reversed, And the input reaches all the multipliers at the same time This is in contrast to the direct form structure where a given input sample reaches the multipliers at different clock cycles.
we will design an audio lowpass filter that operates at a sampling rate of 44.1kHz which are standard sampling rate for audio applications. Let's say you want to design a FIR LPF for audio signal processing with a cutoff frequency of 4 kHz. We must also specify the word length of the coefficients, which in this case is 16 bits, assuming a 16-bit fixed-point DSP is to be used. We can design FIR LPF using various methods such as windowing, frequency sampling, or optimization techniques. The filter length and the coefficients will depend on the specific design method you choose and the desired filter characteristics. We will use window method in our design.
- Filter Type: Lowpass
- Sampling Frequency: 44,100Hz
- Cutoff Frequency: 4,000Hz
- Word length: 16-bits
Now we can design our filter based on the previous specifications using Filter Designer tool by the following command: filterDesigner
The following step is to get the filter coefficients from File>Export>Coefficient File (ASCII) and choose decimal format.
To represent floating number in binary we use python script "floating_binary.py" truncate the numbers to just the 7 digits after the decimal point and write the new values after truncated then converted it to binary.
This MATLAB script generates a noisy signal by adding random noise to a clean sinusoidal signal. the script first calculates the power of the noise based on the specified SNR, and then generates Gaussian noise samples with that power to add to the clean signal.
After the fifty-clock edge, we have the output: [ y(n) = b_{50} x(n-50) + b_{49} x(n-49) + \ldots + b_2 x(n-2) + b_1 x(n-1) + b_0 x(n) ]
data_in : noisy signal = (sinβ‘(2πβ1000βπ‘) + noise)
data_out : filtered signal = sinβ‘(2πβ1000βπ‘)
We can notice that the original signal is recovered successfully with an acceptable delay that was expected due to the filter hardware stages.
data_in : signal with two frequencies = sinβ‘(2πβ1000t) +cosβ‘(2πβ20000t);
data_out : filtered signal = sinβ‘(2πβ1000t)
We can notice that the frequency 20KHz is filtered and frequency 2KHz is passed
data_in : signal with two high frequencies = sinβ‘(2πβ8000t) + cosβ‘(2πβ20000t);
data_out : filtered signal β0
We can notice that the both frequencies 20KHz and 8KHz is filtered
data_in : sinβ‘(2πβ1000t)
data_out : the same signal =sinβ‘(2πβ1000t)
We can notice that the frequency 1KHz which is below cutoff frequency is passed