⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 count4.vhd

📁 一个用VHDL编写的秒表程序
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity count4 is
	port(reset	:in std_logic;
		enable	:in std_logic;
		clk		:in std_logic;
		cout	:out std_logic;
		q		:out std_logic_vector(1 downto 0)
		);
end count4;
architecture rtl of count4 is
	signal q_temp	:	std_logic_vector(1 downto 0);
begin
	process(clk)
	begin
		if(clk'event and clk='1')then
			if(reset='1')then
				q_temp<=(others=>'0');
			elsif(enable='1')then
				if(q_temp="11")then
					q_temp<=(others=>'0');
				else
					q_temp<=q_temp+1;
				end if;
			end if;
		end if;
		q<=q_temp;
	end process;
	cout<='1' when q_temp="11" and enable='1' else '0';
end rtl;

⌨️ 快捷键说明

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