cnt10bcd.vhd

来自「这是一个很实用的」· VHDL 代码 · 共 31 行

VHD
31
字号
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity cnt10bcd is
    Port (	clkin	:in std_logic;
			co		:out std_logic;
    		qout	:out std_logic_vector(3 downto 0)
			);
end cnt10bcd;

architecture behavioral of cnt10bcd is
signal	cnt10	:std_logic_vector(3 downto 0);
begin
	process(clkin)
	begin
		if clkin'event and clkin='1' then
			if	cnt10="1001"	then
				cnt10<="0000";
				co<='1';
			else
				cnt10<=cnt10 + 1;
				co<='0';
			end if;
		end if;
	end process;
	qout<=cnt10;

end behavioral;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?