基于FPGA的FIR滤波器设计论文.doc_第1页
基于FPGA的FIR滤波器设计论文.doc_第2页
基于FPGA的FIR滤波器设计论文.doc_第3页
基于FPGA的FIR滤波器设计论文.doc_第4页
基于FPGA的FIR滤波器设计论文.doc_第5页
免费预览已结束,剩余11页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

基于fpga的fir滤波器设计数字滤波器由数字乘法器、加法器和延时单元组成的一种算法或装置。数字滤波器的功能是对输入离散信号的数字代码进行运算处理,以达到改变信号频谱的目的。数字滤波器是一个离散系统,该系统能对输入的离散信号进行处理,从而获取所需的有用信息。在数字信号处理中,fir数字滤波器是最常用的单元之一。它用于将输入信号xn的频率特性进行特定的修改,转换成另外的输出序列yn。fir(finite impulse response)滤波器:有限长单位冲激响应滤波器,是数字信号处理系统中最基本的元件,它可以在保证任意幅频特性的同时具有严格的线性相频特性,同时其单位抽样响应是有限长的,因而滤波器是稳定的系统。因此,fir滤波器在通信、图像处理、模式识别等领域都有着广泛的应用。有限长脉冲响应(fir)滤波器的系统函数只有零点,除原点外,没有极点,因而fir滤波器总是稳定的。如果他的单位脉冲响应是非因果的,总能够方便的通过适当的移位得到因果的单位脉冲响应,所以fir滤波器不存在稳定性和是否可实现的问题。它的另一个突出的优点是在满足一定的对称条件时,可以实现严格的线性相位。由于线性相位滤波器不会改变输入信号的形状,而只是在时域上使信号延时,因此线性相位特性在工程实际中具有非常重要的意义,如在数据通信、图像处理等应用领域,往往要求信号在传输和处理过程中不能有明显的相位失真,因而线性相位fir滤波器得到了广泛的应用。长度为m的因果有限冲激响应滤波器由传输函数h(z)描述: 它是次数为m-1的z-1的一个多项式。在时域中上述有限冲激响应输入输出关系为: 其中y(n)和x(n)分别是输出和输入序列。有限冲激响应滤波器的一种直接型实现,如图所示。通常一个长度为m的有限冲激响应滤波器由m个系数描述,并且需要m个乘法器和(m-1)个双输入加法器来实现。直接型寄存器模块寄存器用于寄存一组二值代码,只要求它们具有置1、置0的功能即可。在本设计中用d触发器组成寄存器,实现寄存功能。本设计中使用带异步复位rst端的d触发器,当rst=1时,输出信号q=0,当rst=0且上升沿脉冲到达时q=d。程序如下:library ieee;use ieee.std_logic_1164.all;library ieee;use ieee.std_logic_1164.all;architecture dff16 of dff16 isbegin process (rst,clk) begin if(rst=1)then q0); elsif(clkevent and clk=1)then q=d; end if; end process;end dff16;仿真结果如图所示:图 寄存器仿真结果加法器模块实现两个有符号数的相加运算。即将输入的两数,在时钟脉冲到来时相加运算,输出结果。在本设计中共有8个两个10位有符号数相加产生一个11位有符号数的加法器、一个18位和19位有符号数相加产生20位有符号数的加法器、一个两个20位有符号数相加产生一个21位有符号数的加法器、一个两个19位有符号数相加产生一个20位有符号位数的加法器、一个20位和21位有符号数相加产生22位有符号数的加法器,以及一个20位和22位有符号数相加产生23位有符号数的加法器电路。其中一个20位和22位有符号数相加产生23位有符号数的加法器电路为最后一级,所以在加法器电路中在引入低位舍去功能只保留最终10位输出,最终保留10位输出采用了直接取输出23位数的高十位的方法,因此在输出中近似等于除掉了213即8192以后的结果。10位有符号数相加产生一个11位有符号数的加法器设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity sum101011 is port(a,b: in signed(9 downto 0); clk: in std_logic; s:out signed(10 downto 0);end sum101011;architecture sum101011 of sum101011 isbegin process(clk) begin if(clkevent and clk=1)then s=(a(9)&a)+(b(9)&b); end if; end process;end sum101011;仿真结果如图15所示:图15 两10位相加产生11位加法器仿真结果18位和19位有符号数相加产生20位有符号数的加法器设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity sum7023918 is port(a: in signed(17 downto 0); b: in signed(18 downto 0); clk: in std_logic; s:out signed(19 downto 0);end sum7023918;architecture sum7023918 of sum7023918 isbegin process(clk) begin if(clkevent and clk=1)then s0);begin process(din1,din2,clk) begin if clkevent and clk=1 then dout0);begin process(din1,din2,clk) begin if clkevent and clk=1 then dout=s2-din1-s1; end if; end process;end sub1065417;仿真结果如图18所示:图18 -106和-54减法器的仿真结果乘法器模块从资源和速度考虑,常系数乘法运算可用移位相加来实现。将常系数分解成几个2的幂的和形式。滤波器系数分别为-31、-88、-106、-54、70、239、401、499、499、401、239、70、-54、-106、-88、-31。算法:其中带负号数先乘去负号的整数部分,在后面的求和中做减法运算。编码方式如下:31被编码为25-20、88被编码为26+24+23、106被编码为26+25+23+21、54被编码为26-23-21、70被编码为26+22+21、239被编码为28-24-20、401被编码为29-27+24+20、499被编码为29-23-22-20。 实现输入带符号数据与固定数据两个二进制数的乘法运算。当到达时钟上升沿时,将两数输入,运算并输出结果。乘31电路设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity mult31 isport( clk : in std_logic; din : in signed (10 downto 0); dout : out signed (15 downto 0);end mult31;architecture mult31 of mult31 issignal s1 : signed (15 downto 0);signal s2 : signed (10 downto 0);signal s3 : signed (15 downto 0);begin a1:process(din,s1,s2,s3) begin s1=din&00000; s2=din; if (din(10)=0) then s3=(0&s1(14 downto 0)-(00000&s2(10 downto 0); else s3=(1&s1(14 downto 0)-(11111&s2(10 downto 0); end if; end process; a2: process(clk,s3) begin if clkevent and clk=1 then dout=s3; end if; end process;end mult31;仿真结果如图19所示:图19 乘31仿真结果乘88电路设计程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity mult88 isport( clk : in std_logic; din : in signed (10 downto 0); dout : out signed (17 downto 0);end mult88;architecture mult88 of mult88 issignal s1 : signed (16 downto 0);signal s2 : signed (14 downto 0);signal s3 : signed (13 downto 0);signal s4 : signed (17 downto 0);begin a1:process(din,s1,s2,s3) begin s1=din&000000; s2=din&0000; s3=din&000; if (din(10)=0) then s4=(0&s1(16 downto 0)+(000&s2(14 downto 0)+(0000&s3(13 downto 0); else s4=(1&s1(16 downto 0)+(111&s2(14 downto 0)+(1111&s3(13 downto 0); end if; end process; a2: process(clk,s4) begin if clkevent and clk=1 then dout=s4; end if; end process;end mult88;乘106电路设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity mult106 isport( clk : in std_logic; din : in signed (10 downto 0); dout : out signed (17 downto 0);end mult106;architecture mult106 of mult106 issignal s1 : signed (16 downto 0);signal s2 : signed (15 downto 0);signal s3 : signed (13 downto 0);signal s4 : signed (11 downto 0);signal s5 : signed (17 downto 0);begin a1:process(din,s1,s2,s3,s4) begin s1=din&000000; s2=din&00000; s3=din&000; s4=din&0; if (din(10)=0) then s5=(0&s1(16 downto 0)+(00&s2(15 downto 0)+(0000&s3(13 downto 0)+(000000&s4(11 downto 0); else s5=(1&s1(16 downto 0)+(11&s2(15 downto 0)+(1111&s3(13 downto 0)+(111111&s4(11 downto 0); end if; end process; a2: process(clk,s5) begin if clkevent and clk=1 then dout=s5; end if; end process;end mult106;乘54电路设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;-entity mult54 isport( clk : in std_logic; din : in signed (10 downto 0); dout : out signed (16 downto 0);end mult54;architecture mult54 of mult54 issignal s1 : signed (16 downto 0);signal s2 : signed (13 downto 0);signal s3 : signed (11 downto 0);signal s4 : signed (16 downto 0);begin a1:process(din,s1,s2,s3) begin s1=din&000000; s2=din&000; s3=din&0; if (din(10)=0) then s4=(0&s1(15 downto 0)-(00&s2(13 downto 0)-(0000&s3(11 downto 0); else s4=(1&s1(15 downto 0)-(11&s2(13 downto 0)-(1111&s3(11 downto 0); end if; end process; a2: process(clk,s4) begin if clkevent and clk=1 then dout=s4; end if; end process;end mult54;乘70电路设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity mult70 isport( clk : in std_logic; din : in signed (10 downto 0); dout : out signed (17 downto 0);end mult70;architecture mult70 of mult70 issignal s1 : signed (16 downto 0);signal s2 : signed (12 downto 0);signal s3 : signed (11 downto 0);signal s4 : signed (17 downto 0);begin a1:process(din,s1,s2,s3) begin s1=din&000000; s2=din&00; s3=din&0; if (din(10)=0) then s4=(0&s1(16 downto 0)+(00000&s2(12 downto 0)+(000000&s3(11 downto 0); else s4=(1&s1(16 downto 0)+(11111&s2(12 downto 0)+(111111&s3(11 downto 0); end if; end process; a2: process(clk,s4) begin if clkevent and clk=1 then dout=s4; end if; end process;end mult70;乘239电路设计:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity mult239 isport( cl

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论