SlideShare a Scribd company logo
E N G R . R A S H I D F A R I D C H I S H T I
L E C T U R E R , D E E , F E T , I I U I
C H I S H T I @ I I U . E D U . P K
F I R , I I R F I L T E R
FPGA Based System Design
Sunday, August 21, 2022
1
www.iiu.edu.pk
 A digital filter is a system that performs mathematical algorithm that operates on a
digital input signal to improve output signal for the purpose of achieving a filter
objective such as:
 separation of signals that have been combined
 restoration of signals that have been distorted
 Digital filter mostly operates on digitized analog signals or just numbers, representing
some variable, stored in a computer memory
 A simplified block diagram of a real-time digital filter, with analog input and output
signals, is given below.
www.iiu.edu.pk Sunday, August 21, 2022
Digital Filter
2
 A low-pass filter is a filter that passes low-frequency signals but attenuates
(reduces the amplitude of) signals with frequencies that are higher than the cut
off frequency.
 A high-pass filter, is a filter that passes signals containing high frequencies, but
attenuates frequencies lower than the filter's cut off frequency.
 A band-pass filter is a device that passes frequencies within a certain range and
rejects (attenuates) frequencies outside that range.
 A band-stop filter or band-rejection filter is a filter that passes most frequencies
unaltered, but attenuates those in a specific range to very low levels.
www.iiu.edu.pk Sunday, August 21, 2022
Digital Filter Types
3
 A Finite Impulse Response (FIR) filter is a type of a signal processing filter whose
impulse response ( or response to any finite length input ) is of finite duration , because it
settles to zero in finite time.
 The impulse response of an Nth-order discrete - time FIR filter lasts for N+1 samples, and
then dies to zero. For a discrete-time FIR filter, the output is a weighted sum of the current
and a finite number of previous input values.
 The operation is described by the following equation, which defines the output sequence
y[n] in terms of its input sequence x[n] :
 y[n] = b0 x[n] + b x[n-1] + ................ +b x[n-N]
 y[n] = (Summation i=0 to N ) bi x[n-i]
 x[n] = input signal, y[n] = output signal, bi = filter co-efficients, N = filter order
BLOCK DIAGRAM
OF DIGITAL
FIR FILTER
www.iiu.edu.pk Sunday, August 21, 2022
Digital FIR (Finite Impulse Response) Filter
4
 5-Tap FIR Filter Example:
y[n] = h0*x[n] + h1*x[n-1] + h2*x[n-2] + h3*x[n-3]+ h4*x[n-4]
 The critical path (or the minimum time required for processing a new sample) is
limited by 1 multiply and 4 add times. Thus the “sample period” (or the “sample
frequency”) is given by:
Tsample ≥ TM + 4TA Here TM is multiplication time
fsample ≤ 1/ (TM + 4TA) TA is addition time
www.iiu.edu.pk Sunday, August 21, 2022
Digital FIR (Finite Impulse Response) Filter
5
+ + + +
y[n]
x[n] x[n-1] x[n-2] x[n-3] x[n-4]
h0 h1 h2 h3 h4
Z-1
Z-1
Z-1
Z-1
// Module uses multipliers to implement an FIR filter
module FIR_filter(
input signed [15:0] x, input clk,
output reg signed [31:0] yn );
reg signed [15:0] xn [4:0]; wire signed [31:0] v;
// Coeefficients of the filter
wire signed [15:0] h0 = 16'h0325;
wire signed [15:0] h1 = 16'h1e00;
wire signed [15:0] h2 = 16'h3DB6;
wire signed [15:0] h3 = 16'h1e00;
wire signed [15:0] h4 = 16'h0325;
// Implementing filters using multiplication and addition operators
assign v = (h0*xn[0] + h1*xn[1] + h2*xn[2] + h3*xn[3] + h4*xn[4]);
always @(posedge clk) begin
xn[0] <= x; xn[1] <= xn[0];
xn[2] <= xn[1]; xn[3] <= xn[2];
xn[4] <= xn[3];
yn <= v; // Registering the output
end
endmodule
www.iiu.edu.pk Sunday, August 21, 2022
FIR Filter: Verilog Programming
6
module Test_FIR_filter;
reg signed [15:0] x; reg clk; wire signed [31:0] yn;
initial $monitor ( $time, "," , x , "," , yn);
FIR_filter FIR1(x, clk, yn);
initial begin clk = 0; repeat (250) #5 clk = ~clk; end
initial begin x = 0; repeat (5) #100 x = x+100;
repeat (5) #100 x = x-100; end
endmodule
input output response
www.iiu.edu.pk Sunday, August 21, 2022
FIR Filter: Test Bench
7
0
50
100
150
200
250
300
350
400
450
500
0
115
145
215
245
315
345
415
445
515
545
615
645
715
745
815
845
915
945
1015
1045
x
x
0
2000000
4000000
6000000
8000000
10000000
12000000
14000000
16000000
18000000
0
115
145
215
245
315
345
415
445
515
545
615
645
715
745
815
845
915
945
1015
1045
y
y
 This example implements a simple single tap infinite impulse response (IIR) filter in
RTL Verilog and writes its stimulus to demonstrate coding of a design with feedback
registers. The design implements the following equation:
y [n] = 0.5y[n-1] + x[n]
 The multiplication by 0.5 is implemented by an arithmetic shift right by 1 operation.
 A register y _reg realizes y [n -1] in the feedback path of the design, thus needing
reset logic. The reset logic is implemented as an active-low asynchronous reset.
 The module has 16-bit data x, clock clk, reset rst_n as inputs and the value of y as
output.
 The module IIR has two procedural blocks. One block models combinational logic
and the other sequential. The block that models combinational logic consists of an
adder and hard-wired shifter. The adder adds the input data x in shifted value of y_reg.
 The output of the combinational cloud is assigned to y.
 The sequential block latches the value of y in y_reg.
 The RTL Verilog code for the module IIR is given next:
www.iiu.edu.pk Sunday, August 21, 2022
IIR Filter
8
// Implimenting FIR Filter y[n] = 0.5y[n-1] + x[n]
module iir(
input signed [15:0] Xn, input clk, rst_n, output reg signed [31:0] Yn);
reg signed [31:0] Yn_1;
always @(Yn_1 or Xn) Yn = (Yn_1 >>> 1) + Xn; // combinitional logic block
always @(posedge clk or negedge rst_n) begin // sequential logic block
if (!rst_n) Yn_1 <= 0;
else Yn_1 <= Yn;
end
Endmodule
module stimulus_irr;
reg [15:0] X; reg CLK, RST_N;
wire [31:0] Y;
iir IRR0(X, CLK, RST_N, Y); // instantiation of the module
initial begin #5 RST_N = 0; #2 RST_N = 1; end
initial begin X = 0; repeat (5) #20 X = X+1;
repeat (5) #20 X = X-1; end
initial begin CLK = 0; repeat (30) #10 CLK = ~CLK; end
initial $monitor($time, " , %d, %d", X, Y);
endmodule
www.iiu.edu.pk Sunday, August 21, 2022
IIR Filter: Verilog Programming
9
x[n]
0.5 Z-1
y[n]
y[n-1]
+
www.iiu.edu.pk Sunday, August 21, 2022
IIR Filter: Verilog Programming
10
0
1
2
3
4
5
6
7
8
9
10
0 5 20 40 50 60 70 80 90 100 110 120 140 150 160 170 180 190 200 210
X
y

More Related Content

Similar to Lecture Slide (21).pptx

J010325764
J010325764J010325764
J010325764
IOSR Journals
 
Video lectures for bba
Video lectures for bbaVideo lectures for bba
Video lectures for bba
Edhole.com
 
Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...
Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...
Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...
IOSR Journals
 
Lecture 1& 2.pptx
Lecture 1& 2.pptxLecture 1& 2.pptx
Lecture 1& 2.pptx
SalmanHameed26
 
Fault Tolerant Parallel Filters Based On Bch Codes
Fault Tolerant Parallel Filters Based On Bch CodesFault Tolerant Parallel Filters Based On Bch Codes
Fault Tolerant Parallel Filters Based On Bch Codes
IJERA Editor
 
Digital Signal Processing Tutorial:Chapt 1 signal and systems
Digital Signal Processing Tutorial:Chapt 1 signal and systemsDigital Signal Processing Tutorial:Chapt 1 signal and systems
Digital Signal Processing Tutorial:Chapt 1 signal and systemsChandrashekhar Padole
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Madhumita Tamhane
 
Unit 2a combinational circuits
Unit 2a combinational circuitsUnit 2a combinational circuits
Unit 2a combinational circuits
anshul sharma
 
INTERNSHIP_PTTX_1066.pptx
INTERNSHIP_PTTX_1066.pptxINTERNSHIP_PTTX_1066.pptx
INTERNSHIP_PTTX_1066.pptx
URK20EC1061ROSHAN
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
Electric&elctronics&engineeering
 
Chapter-04.pdf
Chapter-04.pdfChapter-04.pdf
Chapter-04.pdf
ssuserf7cd2b
 
Novel fpga design and implementation of digital up
Novel fpga design and implementation of digital upNovel fpga design and implementation of digital up
Novel fpga design and implementation of digital up
eSAT Publishing House
 
Chapter10. Realization of Digital Filter.pptx
Chapter10. Realization of Digital Filter.pptxChapter10. Realization of Digital Filter.pptx
Chapter10. Realization of Digital Filter.pptx
RajGopalMishra4
 
Lec 05 - Combinational Logic
Lec 05 - Combinational LogicLec 05 - Combinational Logic
Lec 05 - Combinational Logic
Vajira Thambawita
 
Design of digital filters
Design of digital filtersDesign of digital filters
Design of digital filters
Naila Bibi
 
Unit 4 dica
Unit 4 dicaUnit 4 dica
Unit 4 dica
Pavan Mukku
 
Dss
Dss Dss
Dss
nil65
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
Naol Worku
 
Analysis of different FIR Filter Design Method in terms of Resource Utilizati...
Analysis of different FIR Filter Design Method in terms of Resource Utilizati...Analysis of different FIR Filter Design Method in terms of Resource Utilizati...
Analysis of different FIR Filter Design Method in terms of Resource Utilizati...
ijsrd.com
 
“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...
“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...
“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...
sipij
 

Similar to Lecture Slide (21).pptx (20)

J010325764
J010325764J010325764
J010325764
 
Video lectures for bba
Video lectures for bbaVideo lectures for bba
Video lectures for bba
 
Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...
Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...
Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL a...
 
Lecture 1& 2.pptx
Lecture 1& 2.pptxLecture 1& 2.pptx
Lecture 1& 2.pptx
 
Fault Tolerant Parallel Filters Based On Bch Codes
Fault Tolerant Parallel Filters Based On Bch CodesFault Tolerant Parallel Filters Based On Bch Codes
Fault Tolerant Parallel Filters Based On Bch Codes
 
Digital Signal Processing Tutorial:Chapt 1 signal and systems
Digital Signal Processing Tutorial:Chapt 1 signal and systemsDigital Signal Processing Tutorial:Chapt 1 signal and systems
Digital Signal Processing Tutorial:Chapt 1 signal and systems
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
 
Unit 2a combinational circuits
Unit 2a combinational circuitsUnit 2a combinational circuits
Unit 2a combinational circuits
 
INTERNSHIP_PTTX_1066.pptx
INTERNSHIP_PTTX_1066.pptxINTERNSHIP_PTTX_1066.pptx
INTERNSHIP_PTTX_1066.pptx
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
Chapter-04.pdf
Chapter-04.pdfChapter-04.pdf
Chapter-04.pdf
 
Novel fpga design and implementation of digital up
Novel fpga design and implementation of digital upNovel fpga design and implementation of digital up
Novel fpga design and implementation of digital up
 
Chapter10. Realization of Digital Filter.pptx
Chapter10. Realization of Digital Filter.pptxChapter10. Realization of Digital Filter.pptx
Chapter10. Realization of Digital Filter.pptx
 
Lec 05 - Combinational Logic
Lec 05 - Combinational LogicLec 05 - Combinational Logic
Lec 05 - Combinational Logic
 
Design of digital filters
Design of digital filtersDesign of digital filters
Design of digital filters
 
Unit 4 dica
Unit 4 dicaUnit 4 dica
Unit 4 dica
 
Dss
Dss Dss
Dss
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
 
Analysis of different FIR Filter Design Method in terms of Resource Utilizati...
Analysis of different FIR Filter Design Method in terms of Resource Utilizati...Analysis of different FIR Filter Design Method in terms of Resource Utilizati...
Analysis of different FIR Filter Design Method in terms of Resource Utilizati...
 
“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...
“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...
“FIELD PROGRAMMABLE DSP ARRAYS” - A NOVEL RECONFIGURABLE ARCHITECTURE FOR EFF...
 

Recently uploaded

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 

Recently uploaded (20)

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 

Lecture Slide (21).pptx

  • 1. E N G R . R A S H I D F A R I D C H I S H T I L E C T U R E R , D E E , F E T , I I U I C H I S H T I @ I I U . E D U . P K F I R , I I R F I L T E R FPGA Based System Design Sunday, August 21, 2022 1 www.iiu.edu.pk
  • 2.  A digital filter is a system that performs mathematical algorithm that operates on a digital input signal to improve output signal for the purpose of achieving a filter objective such as:  separation of signals that have been combined  restoration of signals that have been distorted  Digital filter mostly operates on digitized analog signals or just numbers, representing some variable, stored in a computer memory  A simplified block diagram of a real-time digital filter, with analog input and output signals, is given below. www.iiu.edu.pk Sunday, August 21, 2022 Digital Filter 2
  • 3.  A low-pass filter is a filter that passes low-frequency signals but attenuates (reduces the amplitude of) signals with frequencies that are higher than the cut off frequency.  A high-pass filter, is a filter that passes signals containing high frequencies, but attenuates frequencies lower than the filter's cut off frequency.  A band-pass filter is a device that passes frequencies within a certain range and rejects (attenuates) frequencies outside that range.  A band-stop filter or band-rejection filter is a filter that passes most frequencies unaltered, but attenuates those in a specific range to very low levels. www.iiu.edu.pk Sunday, August 21, 2022 Digital Filter Types 3
  • 4.  A Finite Impulse Response (FIR) filter is a type of a signal processing filter whose impulse response ( or response to any finite length input ) is of finite duration , because it settles to zero in finite time.  The impulse response of an Nth-order discrete - time FIR filter lasts for N+1 samples, and then dies to zero. For a discrete-time FIR filter, the output is a weighted sum of the current and a finite number of previous input values.  The operation is described by the following equation, which defines the output sequence y[n] in terms of its input sequence x[n] :  y[n] = b0 x[n] + b x[n-1] + ................ +b x[n-N]  y[n] = (Summation i=0 to N ) bi x[n-i]  x[n] = input signal, y[n] = output signal, bi = filter co-efficients, N = filter order BLOCK DIAGRAM OF DIGITAL FIR FILTER www.iiu.edu.pk Sunday, August 21, 2022 Digital FIR (Finite Impulse Response) Filter 4
  • 5.  5-Tap FIR Filter Example: y[n] = h0*x[n] + h1*x[n-1] + h2*x[n-2] + h3*x[n-3]+ h4*x[n-4]  The critical path (or the minimum time required for processing a new sample) is limited by 1 multiply and 4 add times. Thus the “sample period” (or the “sample frequency”) is given by: Tsample ≥ TM + 4TA Here TM is multiplication time fsample ≤ 1/ (TM + 4TA) TA is addition time www.iiu.edu.pk Sunday, August 21, 2022 Digital FIR (Finite Impulse Response) Filter 5 + + + + y[n] x[n] x[n-1] x[n-2] x[n-3] x[n-4] h0 h1 h2 h3 h4 Z-1 Z-1 Z-1 Z-1
  • 6. // Module uses multipliers to implement an FIR filter module FIR_filter( input signed [15:0] x, input clk, output reg signed [31:0] yn ); reg signed [15:0] xn [4:0]; wire signed [31:0] v; // Coeefficients of the filter wire signed [15:0] h0 = 16'h0325; wire signed [15:0] h1 = 16'h1e00; wire signed [15:0] h2 = 16'h3DB6; wire signed [15:0] h3 = 16'h1e00; wire signed [15:0] h4 = 16'h0325; // Implementing filters using multiplication and addition operators assign v = (h0*xn[0] + h1*xn[1] + h2*xn[2] + h3*xn[3] + h4*xn[4]); always @(posedge clk) begin xn[0] <= x; xn[1] <= xn[0]; xn[2] <= xn[1]; xn[3] <= xn[2]; xn[4] <= xn[3]; yn <= v; // Registering the output end endmodule www.iiu.edu.pk Sunday, August 21, 2022 FIR Filter: Verilog Programming 6
  • 7. module Test_FIR_filter; reg signed [15:0] x; reg clk; wire signed [31:0] yn; initial $monitor ( $time, "," , x , "," , yn); FIR_filter FIR1(x, clk, yn); initial begin clk = 0; repeat (250) #5 clk = ~clk; end initial begin x = 0; repeat (5) #100 x = x+100; repeat (5) #100 x = x-100; end endmodule input output response www.iiu.edu.pk Sunday, August 21, 2022 FIR Filter: Test Bench 7 0 50 100 150 200 250 300 350 400 450 500 0 115 145 215 245 315 345 415 445 515 545 615 645 715 745 815 845 915 945 1015 1045 x x 0 2000000 4000000 6000000 8000000 10000000 12000000 14000000 16000000 18000000 0 115 145 215 245 315 345 415 445 515 545 615 645 715 745 815 845 915 945 1015 1045 y y
  • 8.  This example implements a simple single tap infinite impulse response (IIR) filter in RTL Verilog and writes its stimulus to demonstrate coding of a design with feedback registers. The design implements the following equation: y [n] = 0.5y[n-1] + x[n]  The multiplication by 0.5 is implemented by an arithmetic shift right by 1 operation.  A register y _reg realizes y [n -1] in the feedback path of the design, thus needing reset logic. The reset logic is implemented as an active-low asynchronous reset.  The module has 16-bit data x, clock clk, reset rst_n as inputs and the value of y as output.  The module IIR has two procedural blocks. One block models combinational logic and the other sequential. The block that models combinational logic consists of an adder and hard-wired shifter. The adder adds the input data x in shifted value of y_reg.  The output of the combinational cloud is assigned to y.  The sequential block latches the value of y in y_reg.  The RTL Verilog code for the module IIR is given next: www.iiu.edu.pk Sunday, August 21, 2022 IIR Filter 8
  • 9. // Implimenting FIR Filter y[n] = 0.5y[n-1] + x[n] module iir( input signed [15:0] Xn, input clk, rst_n, output reg signed [31:0] Yn); reg signed [31:0] Yn_1; always @(Yn_1 or Xn) Yn = (Yn_1 >>> 1) + Xn; // combinitional logic block always @(posedge clk or negedge rst_n) begin // sequential logic block if (!rst_n) Yn_1 <= 0; else Yn_1 <= Yn; end Endmodule module stimulus_irr; reg [15:0] X; reg CLK, RST_N; wire [31:0] Y; iir IRR0(X, CLK, RST_N, Y); // instantiation of the module initial begin #5 RST_N = 0; #2 RST_N = 1; end initial begin X = 0; repeat (5) #20 X = X+1; repeat (5) #20 X = X-1; end initial begin CLK = 0; repeat (30) #10 CLK = ~CLK; end initial $monitor($time, " , %d, %d", X, Y); endmodule www.iiu.edu.pk Sunday, August 21, 2022 IIR Filter: Verilog Programming 9 x[n] 0.5 Z-1 y[n] y[n-1] +
  • 10. www.iiu.edu.pk Sunday, August 21, 2022 IIR Filter: Verilog Programming 10 0 1 2 3 4 5 6 7 8 9 10 0 5 20 40 50 60 70 80 90 100 110 120 140 150 160 170 180 190 200 210 X y