完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我写了一个滤波器的程序,但是仿真的结果不符合,我找不到错误,有没有人能抽空帮我看一下。 滤波器的系数为-12 9 -12 -22 -3 -1 -38 -32 61 124 61 -32 -38 -1 -3 -22 -12 9 -12
程序如下,其中constant为滤波器的系数 library ieee; use ieee.std_logic_arith.all; use ieee.std_logic_1164.all; entity filter is port( clk,reset :in std_logic; sample_in :in signed (8 downto 0); result_out :out signed(21 downto 0)); end filter; architecture behave of filter is type coef_arr is array(0 to 18) of signed (7 downto 0); constant coefs : coef_arr:=("10001100","00001001","10001100","10010110","10000011", "10000001","10100110","10100000","00111101","01111110","00111101","10010000","10100110", "10000001","10000011","10010110","10001100","00001001","10001100"); begin process(clk,reset) type shift_register is array (18 downto 0) of signed (8 downto 0); variable shift : shift_register; variable temp : signed(8 downto 0); variable mul_value :signed(16 downto 0); variable acc_value : signed (21 downto 0); begin if(reset='0')then for i in 0 to 17 loop shift(i):="000000000"; end loop; result_out<="0000000000000000000000"; elsif (clk'event and clk='1')then temp:=sample_in; mul_value:=temp*coefs(0); acc_value:=conv_signed(mul_value,22); for i in 17 downto 0 loop mul_value:=shift(i)*coefs(i+1); acc_value:=acc_value+conv_signed(mul_value,22); shift(i+1):=shift(i); end loop; shift(0):=temp; end if; result_out<=acc_value; end process; end behave; 我输入一个从1到10的序列仿真的结果如下: 但是我用matlab进行卷积的结果为 din=[1:1:10]; >> h=[-12,9,-12,-22,-3,-1,-38,-32,61,124,61,-32,-38,-1,-3,-22,-12,9,-12]; >> conv(h,din) ans = Columns 1 through 8 -12 -15 -30 -67 -107 -148 -227 -338 Columns 9 through 16 -388 -314 -47 -31 169 490 621 711 Columns 17 through 24 1197 1664 1128 -162 -883 -642 -303 -333 Columns 25 through 28 -340 -135 -18 -120
|
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
嵌入式操作教程_数字信号处理_音频编解码:3-6 AAC音频解码实验
408 浏览 0 评论
数字信号处理实验操作教程:3-3 mp3音频编码实验(AD7606采集)
1299 浏览 0 评论
嵌入式DSP教学实验箱操作教程:2-20 数模转换实验(模拟SPI总线输出电压值)
1229 浏览 0 评论
目前在2837x系列用的最多的、性能最好、性价比最高的是哪一款?
998 浏览 0 评论
国产嵌入式DSP教学实验箱_操作教程:22-AD采集DA输出实验(采集输出正弦波)
2190 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-20 00:33 , Processed in 1.032814 second(s), Total 65, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号