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

📄 control.vhd

📁 用层次化设计完成倒计时装置 输入:16位二进制倒计时起始数字、倒计时起始数字的输入使能信号、 倒计时开始信号、复位信号、1MHz时钟信号、10Hz时钟信号。 输出:数码管数据信号及宣统信号
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;

entity control is
port(
	clk: in std_logic;
	reset: in std_logic;
	start: in std_logic;
	s_over: in std_logic;
	s_state: out std_logic_vector (1 downto 0)
	);
end control;

architecture behaver of control is
	type mystate is (s0,s1,s2);
	signal last_state,current_state,next_state: mystate;
begin
	process (clk)
	begin
		if clk'event and clk='1' then
			case current_state is
				when s0 => next_state<=s1;	last_state<=s2;
				when s1 => next_state<=s2;	last_state<=s0;
				when s2 => next_state<=s0;	last_state<=s1;
			end case;
		end if;
	end process;
	
	process (clk,reset,start,s_over)
	begin
		if reset='0' then
			current_state<=s0;
			s_state<="00";
		elsif clk'event and clk='1' then
			case current_state is
				when s0 =>
					s_state<="00";
					if start='0' then
						current_state<=next_state;
					end if;					
				when s1 =>
					s_state<="01";
					if s_over='1' then
						current_state<=next_state;
					end if;
				when s2 =>
					s_state<="11";
					if start'event and start='0' then
						current_state<=last_state;
					end if;
			end case;
		end if;
	end process;
end  behaver;

⌨️ 快捷键说明

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