 Open Access
 Total Downloads : 655
 Authors : Rajesh Kumar Dwivedi, Raghav Dwivedi
 Paper ID : IJERTV6IS100114
 Volume & Issue : Volume 06, Issue 10 (October 2017)
 DOI : http://dx.doi.org/10.17577/IJERTV6IS100114
 Published (First Online): 20102017
 ISSN (Online) : 22780181
 Publisher Name : IJERT
 License: This work is licensed under a Creative Commons Attribution 4.0 International License
FIR Filter Implementation using Matlab Fdatool and Xilinx Vivado
Rajesh Kumar Dwivedi1 and Raghav Dwivedi2 1Department of Physics, Christ Church College, Kanpur 2PG scholar, JIIT Noida
Abstract: Finite impulse filter is a filter structure that can be implemented at almost any sort of frequency digitally. An FIR filter can be implemented using a series of delays, multipliers, adders to create filter output. Although FIR Filter has been implemented successfully using various softwares but this paper is actually the implementation of ntap or n1 order FIR filter using Matlab Fdatool and Xilinx Vivado. The waveform on Xilinx Vivado is representation of output of FIR which we obtain On Matlab.
Keywords: Xilinx Vivado, Matlab Fdatool, FIR Filter.
Where
Fig.2: Lowpass digital filter specification

INTRODUCTION
Filters are signal conditioners each accept input signal and block some prespecified frequency component and the output of the filter is the input signal minus the prespecified frequency component. For example a typical phone line acts as a filter that limits frequencies considerably to the range of frequencies that the human can hear. A digital filter takes digital input, produce digital output and have digital components.
Fir filter are the filter with finite response, they are also called as the recursive filter. Basic diagram of Fir filter is shown under fig. 1.

p normalized cutoff frequency in the pass band

s normalized cutoff frequency in the stop band

ap maximum ripples in the pass band

as minimum attenuation in the stop band
Similarly for the highpass, band pass, band stop filter is shown in the following figures 3, 4, 5.
Fig.3: High pass digital filter specification
Fig.1
Representation of digital filters
It can be clearly seen iir filter has feedback while fir filter does not, thus fir filter are stable as compared to iir filter. Hence, fir filter are preferred over iir filter. In time domain digital filter is given by convolution sum:
Fig.4: Bandpass digital filter specification
For the band stop filter specification please refer to next
=
Y[n] =
[][ ]diagram as follows
An fir filter of order N is characterized by N+1 coefficients and in general requires N+1 multipliers
And N two input adders. The following figure below show the specification of various fir filters which are the basic block for the Fir filter specification (fig.2).
Fig.5: Bandstop digital filter Specification
The Ztransform is performed using with discretetime signals. It converts a discrete timedomain signal into a frequencydomain representation. It is very suitable for analysing discrete time signals and systems in dsp architectures. The ztransform is derived from the Fourier discrete time transformation and is considered the basic operation in digital filter design process.
The Ztransform is defined as:
() = ()
=
Fir filter can be implemented using various structures which are explained in the following sections.

FIR DIRECT FORM
Fig.6: Direct form realization of fir filter
This is called direct form because it is direct implementation of the convolution, the number of delay is the order of filter, and hence this is also called canonical form. Fig.6 shows the structure of direct form fir, y[n] can be obtained from below given equation
y[n]=h[0]x[n]+h[1]x[n1]++h[n]x[nN]=
N
h[k]x[kn]
k=0

FIR CASCADED DIRECT FORM
The transpose of the direct form shown above is represented in fig.7.
Fig.7: Cascade direct form realization of fir

FIR CASCADE FORM
A cascade realization of fir filter with N=6 is shown in fig.8
Fig.8: Cascade form realization of fir
Each secondorder section in the above structure shown in figure 8 can also be realized in the transposed direct form

LINEAR PHASE FIR STRUCTURE
The symmetry property of a linear phase fir filter can be accomplished to reduce the number of multipliers into almost half of that in the direct form implementation. Consider a length7 type 1 fir filter; its symmetric impulse response is given as:
() = h[0]+h[1]1 + [2]2 + [3]3 + [2]4
+ [1]5 + [0]6
Rewriting H (z) we get
() = [0](1 + 6) + [1](1 + 5)
+ [2](2 + 4) + [3]3
We obtain the realization as shown below in fig.9
Fig. 8 Linear Phase fir structure
A similar decomposition can be applied to Type2 Fir Filter transfer function.


IMPLEMENTATION OF FIR FILTER
The implementation of fir filter requires the basic three building blocks viz.

Multiplication

Adder

Signal delay
Building blocks of the fir filter can be shown in fig.9. Multiplier output is y[n] = x[n]
Adder output is y[n] = x1[n] + x2[n]
Fig.9: Basic building block of fir filter
Delay output is y[n] = x [n1]
However DSP filter now uses MAC circuit for the multiplication followed by accumulation.
Fig.10: MAC Circuit
A typical MAC structure has been shown above in fig.10 it consists of multiplying two values, then adding the result to the previously accumulated value, which should be restored in the registers for future accumulations. Another feature of a MAC circuit is that it must check for overflow operation in the filter, when the number of MAC operations is large.


MATLAB FDATOOL
MATLAB FDATOOL is a filter design analysis tool used mainly to design the filter on MATLAB platform and then transforms it into corresponding VHDL code. In the following section are the steps how to configure the FIR filter on MATLAB.
III.A GETTING STARTED WITH FDATOOL

Type fdatool or filterDesigner at the MATLAB command prompt.
>> fdatool
Fig. 11 fdatool on MATLAB command window

Filter design and analysis toolbox appear as shown in the figure 12
Fig. 12: FDATOOL box in MATLAB

In the Filter Design & Analysis Tool dialog box, check that the following filter options are set:
Fig. 13: FDATOOL options in FDATOOL box
These settings are for the default filter design that the Filter Designer creates for you. If you do not have to change the filter, and design filter is grayed out, you are done and can skip to quantize the Filter.

If you modified options listed in step c, click Design Filter. The Filter Designer creates a filter for the specified design and displays the following message in the Filter Designer status bar when the task is complete.
Designing Filter… Done.
Quantize filters for HDL code generation. To quantize your filter,

Open the basic FIR filter design you created in Design a FIR Filter in Filter Designer.

Click the Set Quantization Parameters button in the leftside toolbar. The Filter Designer displays a Filter arithmetic menu in the bottom half of its dialog box.
Fig.14: Quantizing the Filter in MATLAB
e) Set the quantization parameters as shown in the figure below
Fig. 15 Quantization parameters of the filter

After quantizing the filter we need to set the coder option and generate VHDL code from the MATLAB. Select target> generate HDL from filter designer dialog box.
Fig. 16 filter design box in MATLAB

Change the default name n the target window to basicfir
Fig.17 Target window in MATLAB

Open the global setting tab of the filter and write TutorialBasic FIR filter in the comment in header text box
Fig. 18 Global setting box for Filter

Select the ports in the additional setting portion of the GUI.
Fig. 19 Ports in the additional setting at the GUI

Replace filter_in with data_in and filter_out with data_out in the input port text box
Fig. 20 Changes in the input port text box

Clear the add input register option from the input port text box then the box looks like as shown.
Fig. 21 Input port text box final look after following instruction

In the testbench tab, the file name box should have basicfir_tb as its entry onto it.
Fig. 22 Testbench box in MATLAB

Click on generate button to start generate process. The coder displays the message as in the command window shown in the following figure.
Fig. 23 Message in Command window

After the successful generation of VHDL codes analyse it on XILINX VIVADO. The waveforms are shown in the next segment of this paper.


ANALYSIS OF VHDL CODE ON XILINX
VIVADO
The following VHDL code along with the testbench is generated using MATLAB FDATOOLS and the following code is analysed using Xilinx vivado the waveform obtained is then compared with the waveform posted on MATLAB tutorials. The waveform is shown below.
Fig.24 (a) WaveformI on Xilinx vivado
Fig.24 (b) WaveformII on Xilinx vivado
RTL netlist of the following is generated as shown in the figure below, since the size of the filter is 51 tap so its impossible to capture in the screenshot but still some glimpse of that 51 tap filter is shown here:
Fig. 25 RTL Netlist of the FIR Filter on Xilinx Vivado
The project summary of the following filter is shown below:
Fig. 26 postimplementation of fir filter
Fig. 27 Postsynthesis and power onchip of FIR filter
Thus, the following FIR filter is successfully designed using MATLAB FDATOOLS and the XILINX VIVADO. The
order of the filter is 50. This type of filter can be made using floating point, fixed point or even the distributed arithmetic coefficient and the MATLAB provides the platform for all the type of algorithm. FDATOOL provide the platform for the fixed point or the floating point coefficient, however for distributed arithmetic we have to follow some other procedure to configure it successfully.
However, with the help of following paper its easy to recognize the use of MATLAB in transforming the MATLAB code to the VHDL code significantly, this paper will provide all the steps for designing the FIR filter. The filter order can vary for different design.
In the recent development the Xilinx platform has provide all the significant and necessary information for the designing of the filter.

FUTURE SCOPE AND APPLICATION

With the help of the MATLAB its almost easy to design the FIR filter as it provide easy and suitable platform for the implementation of the FIR filter. MATLAB along with XILINX are helpful for the fast and errorfree implementation of FIR filter.

MATLAB provide easy approach to generate VHDL code for any configuration and any order.

The following tutorial focuses on the practical aspects of FIR filter design. Practically, it is possible to design any FIR filter using MATLAB.

The coefficient in the FIR filter can be fixedpoint or floatingpoint or even distributed arithmetic algorithm etc. can be implemented using MATLAB.

Its easy to configure and generate summary for the successful implementation of the FIR filter.

Time efficient implementation of the FIR Filter is possible using FDATOOLS.
REFERENCES

Practical FIR Filter Design in MATLAB, Ricardo A. Losada, The MathWorks, Inc, 3 Apple Hill Dr. Natick, MA 01760, USA January 12, 2004.

Introduction to Signal Processing, Prentice Hall, S. J. Orfanidis, Upper Saddle River, 1996.

Theory and Application of Digital Signal Processing, L. R. Rabiner and B. Gold, Prentice Hall, Englewood Cliffs, 1975.

Design of computationally efficient interpolated FIR filters,
T. Saramaki, Y. Neuvo, and S. K. Mitra, IEEE Trans. on Circuits and Systems, vol. 35, N0. 1,pp. 7088, January 1988

Exchange algorithms that complement the ParksMcClellan algorithm for linearphase FIR filter design, I. W. Selesnick and C. S. Burrus, IEEE Trans. on Circuits and Systems II, 44(2):137142, February 1997.

Sakshat virtual labs, Digital FIR filter design and simulation,
NMEICT initiative of MHRD.

MATLAB FDATOOLS, MATHWORKS tutorials

Circuit design and simulation with VHDL, The MIT Press,
Volnei A. pedroni,2010

XILINX VIVADO tutorial, Xilinx

VHDL Primer by J.Bhaskar

Design and verification of FIR filter based on MATLAB and DSP, ChenLong Hu, IEEE 2012 International Conference on Image Analysis and Signal Processing (IASP), 10.1109/IASP.2012.6425042