library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.numeric_std.all; use IEEE.std_logic_unsigned.all; entity DDRV is port ( ALARM_TIME : in std_logic_vector (3 downto 0); CURRENT_TIME : in std_logic_vector (3 downto 0); SHOW_A : in std_logic; ----- DISPLAY : out std_logic_vector (6 downto 0); SOUND_ALARM : out std_logic ); end DDRV; architecture RTL of DDRV is begin process(CURRENT_TIME) is begin case CURRENT_TIME is when "0000" => DISPLAY <= "0000001"; --0 when "0001" => DISPLAY <= "1001111"; --1 when "0010" => DISPLAY <= "0010010"; --2 when "0011" => DISPLAY <= "0000110"; --3 when "0100" => DISPLAY <= "1001100"; --4 when "0101" => DISPLAY <= "0100100"; --5 when "0110" => DISPLAY <= "0100000"; --6 when "0111" => DISPLAY <= "0001111"; --7 when "1000" => DISPLAY <= "0000000"; --8 when "1001" => DISPLAY <= "0000100"; --9 when others => DISPLAY <= "1111111"; --Error end case; end process; process(ALARM_TIME) is begin case ALARM_TIME is when "0000" => DISPLAY <= "0000001"; --0 when "0001" => DISPLAY <= "1001111"; --1 when "0010" => DISPLAY <= "0010010"; --2 when "0011" => DISPLAY <= "0000110"; --3 when "0100" => DISPLAY <= "1001100"; --4 when "0101" => DISPLAY <= "0100100"; --5 when "0110" => DISPLAY <= "0100000"; --6 when "0111" => DISPLAY <= "0001111"; --7 when "1000" => DISPLAY <= "0000000"; --8 when "1001" => DISPLAY <= "0000100"; --9 when others => DISPLAY <= "1111111"; --Error end case; end process; process (ALARM_TIME, CURRENT_TIME, SHOW_A) is begin if SHOW_A = '0' then DISPLAY <= CURRENT_TIME; else DISPLAY <= ALARM_TIME; end if; end process; process (ALARM_TIME, CURRENT_TIME, SHOW_A) is begin if ALARM_TIME = CURRENT_TIME then SOUND_ALARM <= '1'; else SOUND_ALARM <= '0'; end if; end process; end RTL;