完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity myfist is port( clk: in std_logic; reset: in std_logic; en: in std_logic; q: out std_logic_vector(3 downto 0)); end myfist; architecture behave of myfist is signal q_n: std_logic_vector(3 downto 0); begin process( clk, reset, en, q_n ) begin if (reset = '1') then q_n <= (others => '0'); elsif rising_edge(clk) then if en = '1' then q_n <= q_n + 1; end if; end if; end process; q <= q_n; end behave; testbench: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity myfist_tb is constant ClockPeriod: time := 40 ns; end myfist_tb; architecture myfist_tb_arch of myfist_tb is component myfist is port (clk: in std_logic; reset : in std_logic; en : in std_logic; q : out std_logic_vector(3 downto 0)); end component; signal clock , reset , en: std_logic; signal q: std_logic_vector(3 downto 0); begin CounterInstance: myfist port map (clock ,reset, en, q); simProcess: process begin reset <= '1'; wait for 50 ns; reset <='0'; wait for 1000 ns; reset <= '0'; end process simprocess; en <= '0' after 0 ns, '1' after 50 ns, '0' after 850 ns, '1' after 900 ns; ClockProcess: process (clock, reset ) begin if (reset ='1') then clock <= '0'; else clock <= not clock after ClockPeriod; end if; end process ClockProcess; end myfist_tb_arch; 功能仿真: 时序仿真:、 |
|
相关推荐
1个回答
|
|
功能仿真:
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1367 浏览 1 评论
助力AIoT应用:在米尔FPGA开发板上实现Tiny YOLO V4
1046 浏览 0 评论
2442 浏览 1 评论
2146 浏览 0 评论
矩阵4x4个按键,如何把识别结果按编号01-16(十进制)显示在两个七段数码管上?
2408 浏览 0 评论
1889 浏览 50 评论
6018 浏览 113 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 16:53 , Processed in 0.702872 second(s), Total 73, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号