完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
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 (7 downto 0); result_out :out signed(20 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:=coef_arr'("10000101","00000100","10000101","10001001","10000001","00000000","10001111","10001101","00011000","00110000","00011000",10001101","10001111","00000000","10000001","10001001","10000101","00000100","10000101"); begin process(clk,reset) type shift_register is array (18 downto 0) of signed (7 downto 0); variable shift : shift_register; variable temp : signed(7 downto 0); variable mul_value :signed(15 downto 0); variable acc_value : signed (20 downto 0); begin if(reset='0')then for i in 0 to 17 loop shift(i):=(others=>'0'); end loop; result_out<=(others=>'0'); elsif (clk'event and clk='1')then temp:=sample_in; mul_value:=temp*coefs(0); acc_value:=conv_signed(mul_value,20); for i in 17 downto 0 loop mul_value:=shift(i)*coefs(i+1); acc_value:=acc_value+conv_signed(mul_value,20); shift(i+1):=shift(i); end loop; shift(0):=temp; result_out<=acc_value; end if; end process; end behave; |
|
相关推荐
1个回答
|
|
出了什么问题!
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1533 浏览 1 评论
1313 浏览 0 评论
矩阵4x4个按键,如何把识别结果按编号01-16(十进制)显示在两个七段数码管上?
1523 浏览 0 评论
925 浏览 0 评论
2317 浏览 0 评论
1457 浏览 35 评论
5666 浏览 113 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 08:34 , Processed in 0.404356 second(s), Total 39, Slave 33 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号