您现在的位置: 范文先生网 >> 理工论文 >> 电子通信论文 >> 正文

基于FPGA的四阶IIR数字滤波器

时间:2007-1-20栏目:电子通信论文

  tbb<=nottb+‘1’when(tbn=‘1’)elsetb;
  
  tpp<=‘1’&‘1’&‘1’&‘1’&nottp+‘1’when(tp2n=‘1’)elsetp;
  
  tmpa<=a0whencnt=0else
  
  a1whencnt=1else
  
  a2whencnt=2else
  
  b0whencnt=3else
  
  b1whencnt=4else(others=>‘0’);
  
  tmpb<=x0whencnt=0else
  
  x1whencnt=1else
  
  x2whencnt=2else
  
  y0whencnt=3else
  
  y1whencnt=4else(others=>‘0’);
  
  ta<=tmpa(8downto0);tb<=tmpb(8downto0);
  
  tan<=tmpa(9);tbn<=tmpb(9);
  
  tp<=taa*tbb;
  
  p<=(others=>‘0’)when(tmpb=“0000000000”)else
  
  tp2n&tpp;
  
  process(clk_reg,clk_regbt)
  
  begin
  
  ifclk_reg=‘1’thencnt<=“000”;ytmp<=(others=>‘0’);
  
  elsif(clk_regbt’eventandclk_regbt=‘1’)then
  
  ifcnt<5thencnt<=cnt+1;ytmp<=ytmp+p;
  
  elsif(cnt=5)then
  
  ifytmp(7)=‘1’then
  
  yout(8downto0)<=ytmp(16downto8)+1;
  
  yout(9)<=ytmp(23);
  
  elseyout(8downto0)<=ytmp(16downto8);
  
  yout(9)<=ytmp(23);endif;
  
  endif;
  
  endif;
  
  endprocess;
  
  endbehav;
  
  IIR2模块的输出数据采用将补码最高符号位直接取反转换为移码后,就可以送到DAC7520实现双极性信号输出。
  
  3系统性能测试
  
  系统性能的测试采用单极性方波周期信号作为输入信号。信号的频率为100kHz,在采样频率为2MHz时,每个周期采样20个点,换算成数字域频率为0.1π,其二次谐波的数字频率为0.2π。输入到TLC5510的信号电压幅度为0~2V,则经过A/D转换后的输出为00H~FFH。由于低通滤波器的阻带截止频率选在200kHz,衰减32dB,由信号理论分析可知,周期方波信号没有二次谐波,所以对三次谐波的衰减经过IIR滤波器后输出有直流分量的基波(频率为100kHz)正弦信号。理论计算给出的方波周期信号基波幅度为:
  
  2E/π=(2×255)/π=162.34
  
  输入一个周期的数据,Matlab的计算值与MAX+plusⅡ的仿真值如表3所示。
  
  表3滤波后输出的数据
  
  输入数据255255255255255255255255255255计算值28.7-8.2-29.4-34.9-25.2-1.334.880.0130.5182.0仿真值321020999993100213680129179输入数据0000000000计算值223.4260.2281.4286.9277.2253.2217.1172.0121.570.1仿真值21925527628227325021517112272
  由表3可见,仿真输出值为补码,谷点输出值993换算成符号数为993-1024=-31。Matl

上一页  [1] [2] [3] [4] 下一页

下页更精彩:1 2 3 4 下一页