Quartus II 实现实用计数器设计(74LS160计数器)

期末裸考系列之实用计数器设计(74LS160计数器)

案例为计数10

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt10 is
	port (clk, rst, en, load : std_logic;
	data : in std_logic_vector(3 downto 0);
	dout : out std_logic_vector(3 downto 0);
	cont : out std_logic);
end entity;

architecture one of cnt10 is 
begin 
	process(clk, rst, en, load)
		variable q : std_logic_vector(3 downto 0);
	begin 
		if rst = '0' then Q := (others => '0');
		elsif clk'event and clk = '1' then 
			if en = '1' then 
				if (load = '0') then q := data; else 
					if q<9 then q := q+1;
						else q :=(others => '0');
					end if;
				end if;
			end if;
		end if;
	if q = "1001" then cont <= '1';
		else cont <= '0';
	end if;
	dout <= q;
	end process;
end one;

  • 10
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值