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

📄 statusselect.vhd

📁 vhdl语言编写的交通灯程序
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;

entity StatusSelect is
	port(
		clk,show:in std_logic;
		sel:out std_logic_vector(2 downto 0);
		voice:out std_logic
		);
end StatusSelect;

architecture StatusSelect_arc of StatusSelect is

signal temp:std_logic_vector(2 downto 0);

begin
	process(clk,show)
	variable t:integer range 0 to 499999;
	variable a:std_logic;
	begin
		if(clk'event and clk='1')then
		case show is
		when '0' =>
			voice<='0';
			case temp is
				when "000"=>temp<="001";
				when "001"=>temp<="010";
				when "010"=>temp<="011";
				when "011"=>temp<="000";
				when others=>temp<="000";
			end case;
		when others =>
			voice<=a;
			if(t=499999)then
				t:=0;
				a:=not a;

			else
				t:=t+1;
			end if;
			if (a='1') then 
				case temp is
					when "000"=>temp<="001";
					when "001"=>temp<="010";
					when "010"=>temp<="011";
					when "011"=>temp<="000";
					when others=>temp<="000";
				end case;
			else
				temp<="111";
			end if;
		end case;
		end if;
		sel<=temp;
	end process;
end ;

⌨️ 快捷键说明

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