黑夜有人按键
模块说明:当白天黑夜状态量为‘0’并且中间信号strobe有效时,代表有人按键,开始一个30+15秒的状态机,用穷举法列出状态机的状态
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY heiye IS
port ( NUM00,NUM10,NUM20,NUM30: buffer STD_LOGIC_VECTOR(3 DOWNTO 0);
enable: in std_logic;
strobe: in std_logic;
count_day_0: in integer range 0 to 45;
count_day:in std_logic );
end entity heiye;
ARCHITECTURE rtl OF heiye IS
signal num0: STD_LOGIC_VECTOR(3 DOWNTO 0);
signal num1: STD_LOGIC_VECTOR(3 DOWNTO 0);
signal num2: STD_LOGIC_VECTOR(3 DOWNTO 0);
signal num3: STD_LOGIC_VECTOR(3 DOWNTO 0);
begin
P: process(enable)
begin
if enable'event and enable='1' then
if count_day= '1' then
if strobe= '1' then
case count_day_0 is
when 44 => num0<= "0001";
when 43 => num0<= "0001";
when 42 => num0<= "0001";
when 41 => num0<= "0001";
when 40 => num0<= "0001";
when 39 => num0<= "0001";
when 38 => num0<= "0001";
when 37 => num0<= "0001";
when 36 => num0<= "0001";
when 35 => num0<= "0001";
when 34 => num0<= "0001";
when 33 => num0<= "0001";
when 32 => num0<= "0001";
when 31 => num0<= "0001";
when 30 => num0<= "0001";
when 29 => num0<= "0001";
when 28 => num0<= "0001";
when 27 => num0<= "0001";
when 26 => num0<= "0001";
when 25 => num0<= "0001";
when 24 => num0<= "0001";
when 23 => num0<= "0001";
when 22 => num0<= "0001";
when 21 => num0<= "0001";
when 20 => num0<= "0001";
when 19 => num0<= "0001";
when 18 => num0<= "0001";
when 17 => num0<= "0001";
when 16 => num0<= "0010";
when 15 => num0<= "0010";
when 14 => num0<= "0010";
when 13 => num0<= "0011";
when 12 => num0<= "0011";
when 11 => num0<= "0011";
when 10 => num0<= "0011";
when 9 => num0<= "0011";
when 8 => num0<= "0011";
when 7 => num0<= "0011";
when 6 => num0<= "0011";
when 5 => num0<= "0011";
when 4 => num0<= "0011";
when 3 => num0<= "0011";
when 2 => num0<= "0011";
when 1 => num0<= "0011";
when 0 => num0<= "0011";
when others => num0<="XXXX";
end case;
end if;
end if;
end if;
end process P;
PP: process(enable)
begin
if enable'event and enable='1' then
if count_day= '1' then
if strobe= '1' then
case count_day_0 is
when 44 => num1<= "0011";
when 43 => num1<= "0011";
when 42 => num1<= "0011";
when 41 => num1<= "0011";
when 40 => num1<= "0011";
when 39 => num1<= "0011";
when 38 => num1<= "0011";
when 37 => num1<= "0011";
when 36 => num1<= "0011";
when 35 => num1<= "0011";
when 34 => num1<= "0011";
when 33 => num1<= "0011";
when 32 => num1<= "0011";
when 31 => num1<= "0011";
when 30 => num1<= "0011";
when 29 => num1<= "0011";
when 28 => num1<= "0011";
when 27 => num1<= "0011";
when 26 => num1<= "0011";
when 25 => num1<= "0011";
when 24 => num1<= "0011";
when 23 => num1<= "0011";
when 22 => num1<= "0011";
when 21 => num1<= "0011";
when 20 => num1<= "0011";
when 19 => num1<= "0011";
when 18 => num1<= "0011";
when 17 => num1<= "0011";
when 16 => num1<= "0011";
when 15 => num1<= "0011";
when 14 => num1<= "0001";
when 13 => num1<= "0001";
when 12 => num1<= "0001";
when 11 => num1<= "0001";
when 10 => num1<= "0001";
when 9 => num1<= "0001";
when 8 => num1<= "0001";
when 7 => num1<= "0001";
when 6 => num1<= "0001";
when 5 => num1<= "0001";
when 4 => num1<= "0001";
when 3 => num1<= "0001";
when 2 => num1<= "0001";
when 1 => num1<= "0001";
when 0 => num1<= "0001";
when others => num1<="XXXX";
end case;
end if;
end if;
end if;
end process PP;
PPP: process(enable)
begin
if enable'event and enable='1' then
if count_day= '1' then
if strobe= '1' then
case count_day_0 is
when 44 => num2<= "0010";
when 43 => num2<= "0010";
when 42 => num2<= "0010";
when 41 => num2<= "0010";
when 40 => num2<= "0010";
when 39 => num2<= "0010";
when 38 => num2<= "0010";
when 37 => num2<= "0010";
when 36 => num2<= "0010";
when 35 => num2<= "0010";
when 34 => num2<= "0001";
when 33 => num2<= "0001";
when 32 => num2<= "0001";
when 31 => num2<= "0001";
when 30 => num2<= "0001";
when 29 => num2<= "0001";
when 28 => num2<= "0001";
when 27 => num2<= "0001";
when 26 => num2<= "0001";
when 25 => num2<= "0001";
when 24 => num2<= "0000";
when 23 => num2<= "0000";
when 22 => num2<= "0000";
when 21 => num2<= "0000";
when 20 => num2<= "0000";
when 19 => num2<= "0000";
when 18 => num2<= "0000";
when 17 => num2<= "0000";
when 16 => num2<= "0000";
when 15 => num2<= "0000";
when 14 => num2<= "0001";
when 13 => num2<= "0001";
when 12 => num2<= "0001";
when 11 => num2<= "0001";
when 10 => num2<= "0001";
when 9 => num2<= "0000";
when 8 => num2<= "0000";
when 7 => num2<= "0000";
when 6 => num2<= "0000";
when 5 => num2<= "0000";
when 4 => num2<= "0000";
when 3 => num2<= "0000";
when 2 => num2<= "0000";
when 1 => num2<= "0000";
when 0 => num2<= "0000";
when others => num2<="XXXX";
end case;
end if;
end if;
end if;
end process PPP;
PPPP: process(enable)
begin
if enable'event and enable='1' then
if count_day= '1' then
if strobe= '1' then
case count_day_0 is
when 44 => num3<= "1001";
when 43 => num3<= "1000";
when 42 => num3<= "0111";
when 41 => num3<= "0110";
when 40 => num3<= "0101";
when 39 => num3<= "0100";
when 38 => num3<= "0011";
when 37 => num3<= "0010";
when 36 => num3<= "0001";
when 35 => num3<= "0000";
when 34 => num3<= "1001";
when 33 => num3<= "1000";
when 32 => num3<= "0111";
when 31 => num3<= "0110";
when 30 => num3<= "0101";
when 29 => num3<= "0100";
when 28 => num3<= "0011";
when 27 => num3<= "0010";
when 26 => num3<= "0001";
when 25 => num3<= "1001";
when 24 => num3<= "1000";
when 23 => num3<= "0111";
when 22 => num3<= "0110";
when 21 => num3<= "0101";
when 20 => num3<= "0100";
when 19 => num3<= "0011";
when 18 => num3<= "0010";
when 17 => num3<= "0001";
when 16 => num3<= "0000";
when 15 => num3<= "0101";
when 14 => num3<= "0100";
when 13 => num3<= "0011";
when 12 => num3<= "0010";
when 11 => num3<= "0001";
when 10 => num3<= "0000";
when 9 => num3<= "1001";
when 8 => num3<= "1000";
when 7 => num3<= "0111";
when 6 => num3<= "0110";
when 5 => num3<= "0101";
when 4 => num3<= "0100";
when 3 => num3<= "0011";
when 2 => num3<= "0010";
when 1 => num3<= "0001";
when 0 => num3<= "0000";
when others => num3<="XXXX";
end case;
end if;
end if;
end if;
num00 <= num0;
num10 <= num1;
num20 <= num2;
num30 <= num3;
end process PPPP;
end rtl;