完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
顶层文件 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity tongbu is port( load: in std_logic; data: in std_logic_vector(7 downto 0); clock: in std_logic; tongbu_en: in std_logic; delay_en: out std_logic; tongbu_signal: buffer std_logic ); end tongbu; architecture tongbu_behave of tongbu is component counter port( clk: in std_logic; enable: in std_logic; load: in std_logic; co: out std_logic; data: in std_logic_vector(7 downto 0); q: buffer std_logic_vector(7 downto 0) ); end component; signal inter1,inter2: std_logic; signal pr,c,ch,cout: std_logic; signal en_in: std_logic; signal d: std_logic_vector(7 downto 0):="00000100"; signal q1,q2: std_logic_vector(7 downto 0):="00000000"; signal in_pulse: std_logic; signal comp: std_logic_vector(7 downto 0):="00000001"; signal comp_q: std_logic_vector(7 downto 0); signal t_tmp: std_logic:='0'; begin pr<=load or c; en_in<=tongbu_en and (not inter1); in_pulse<=ch and (not inter1); process(tongbu_signal,t_tmp) begin if (tongbu_signal'event and tongbu_signal='1')then t_tmp <= not t_tmp; else t_tmp <= t_tmp; end if; end process; delay_en <= t_tmp; process(clock) begin if (clock'event and clock='1')then if (q1="00000000" and q2="00000000")then c <= '1'; else c <= '0'; end if; end if; end process; u1:counter port map (clk=>clock,enable=>en_in,load=>pr,co=>inter1,data=>data,q=>q1); u2:counter port map (clk=>clock,enable=>inter1,load=>pr,co=>inter2,data=>d,q=>q2); process(inter1) variable temp3:integer; begin if (inter1'event and inter1='1')then if (temp3=1) then temp3 := 1; ch <= inter1; else temp3 := temp3+1; end if; end if; end process; process(load,in_pulse,tongbu_en) begin -- if(clock'event and clock='1')then -- load<='1'; if (load ='1')then comp_q <= comp; else if (in_pulse'event and in_pulse='0')then if (tongbu_en='1')then if comp_q="00000000"then comp_q <= "00000000"; cout <= '0'; else comp_q <= comp_q-1; end if; end if; end if; end if; -- end if; end process; tongbu_signal <= in_pulse and cout; end tongbu_behave; 底层文件 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;
entity counter is port( clk: in std_logic; enable: in std_logic; load: in std_logic; co: out std_logic; data: in std_logic_vector(7 downto 0); q: buffer std_logic_vector(7 downto 0)
); end counter; architecture counter_behave of counter is signal pulse: std_logic; begin process(load,data,clk,enable) begin if load='1'then q <= data; elsif clk'event and clk='1'then if enable='1'then q <= q-1; else pulse <= '0'; end if; end if; end process; co <= pulse; end counter_behave;
仿真出来是这样的e [img=0,30]file:///C:UsersAdministratorAppDataRoamingTencentUsers759090627QQWinTempRichOleU0Y[@}AGES)GB8GFEUB)R(L.png[/img]
|
|
相关推荐
3个回答
|
|
请描述一下你的问题是什么,程序与波形是看不到问题的
|
|
|
|
这个程序编译可以通过?
|
|
|
|
没有问题描述,也没有您的仿真文件没法定位问题。
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1367 浏览 1 评论
助力AIoT应用:在米尔FPGA开发板上实现Tiny YOLO V4
1046 浏览 0 评论
2442 浏览 1 评论
2146 浏览 0 评论
矩阵4x4个按键,如何把识别结果按编号01-16(十进制)显示在两个七段数码管上?
2408 浏览 0 评论
1897 浏览 50 评论
6018 浏览 113 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 01:43 , Processed in 0.746744 second(s), Total 79, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号