完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
|
程序中英文缩写都代表什么意思呢?这段程序实现什么功能呢?
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; entity fcounter is generic ( f_len:natural:=9; f_delta:natural:=10 ); port( rst,clk,di:in std_logic; f,fi:out std_logic_vector(f_len-1 downto 0); tm:out std_logic ); end entity fcounter ; architecture bhv of fcounter is type f_reg_type is array (natural range<>) of std_logic_vector(f_len-1 downto 0); signal f_reg:f_reg_type(2+2 downto 0); signal fsum:std_logic_vector(f_len-1+2 downto 0); signal di_reg:std_logic_vector(3 downto 0); signal di_rise,di_fall:std_logic; signal cnt:std_logic_vector(f_len-1 downto 0); begin fsum<="00"&f_reg(0)+f_reg(1)+f_reg(2)+f_reg(2); f<=fsum(f_len-1+2 downto 2); fi<=cnt; count:process(clk,rst) begin if rst='0' then di_reg<=(others=>'0'); f_reg<=(others=>(others=>'0')); cnt<=(others=>'0'); tm<='0'; elsif clk'event and clk='1' then cnt<=cnt+'1'; di_reg<=di_reg(2 downto 0)&di; if di_rise='1' then f_reg(4)<=cnt; cnt<=(others=>'0'); tm<='1'; end if; if di_fall='1' then f_reg(3)<=cnt; cnt<=(others=>'0'); tm<='0'; end if; if (f_reg(3)>f_reg(4) and f_reg(3)-f_delta f_reg(2 downto 0)<=f_reg(1 downto 0)&(f_reg(3)+f_reg(4)); end if; end if; end process; di_rise<= '1' when (di_reg(2)='0' and di_reg(1)='0'and di_reg(0)='1' and di='1') else '0'; di_fall<= '1' when (di_reg(2)='1' and di_reg(1)='1'and di_reg(0)='0' and di='0') else '0'; end bhv; |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
NVMe高速传输之摆脱XDMA设计49:主要功能测试结果与分析1
1280 浏览 0 评论
888 浏览 0 评论
842 浏览 0 评论
619 浏览 0 评论
977 浏览 0 评论
4425 浏览 63 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 23:45 , Processed in 0.705346 second(s), Total 72, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4794