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; DISP_CURRENT : out std_logic_vector (6 downto 0); DISP_ALARM : out std_logic_vector (6 downto 0) ); end DDRV; architecture RTL of DDRV is signal DISP_CURRENT : std_logic_vector (6 downto 0); signal DISP_ALARM : std_logic_vector (6 downto 0); begin process(CURRENT_TIME) begin case CURRENT_TIME is when "0000" => DISP_CURRENT <= "0000001"; --0 when "0001" => DISP_CURRENT= "1001111"; --1 when "0010" => DISP_CURRENT <= "0010010"; --2 when "0011" => DISP_CURRENT <= "0000110"; --3 when "0100" => DISP_CURRENT <= "1001100"; --4 when "0101" => DISP_CURRENT <= "0100100"; --5 when "0110" => DISP_CURRENT <= "0100000"; --6 when "0111" => DISP_CURRENT <= "0001111"; --7 when "1000" => DISP_CURRENT <= "0000000"; --8 when "1001" => DISP_CURRENT <= "0000100"; --9 when others => DISP_CURRENT <= "1111111"; --Error end case; end process; process(ALARM_TIME) begin case ALARM_TIME is when "0000" => DISP_ALARM <= "0000001"; --0 when "0001" => DISP_ALARM <= "1001111"; --1 when "0010" => DISP_ALARM <= "0010010"; --2 when "0011" => DISP_ALARM <= "0000110"; --3 when "0100" => DISP_ALARM <= "1001100"; --4 when "0101" => DISP_ALARM <= "0100100"; --5 when "0110" => DISP_ALARM <= "0100000"; --6 when "0111" => DISP_ALARM <= "0001111"; --7 when "1000" => DISP_ALARM <= "0000000"; --8 when "1001" => DISP_ALARM <= "0000100"; --9 when others => DISP_ALARM <= "1111111"; --Error end case; end process; process (SHOW_A) is begin if SHOW_A = '0' then DISPLAY <= DISP_CURRENT; else DISPLAY <= DISP_ALARM; end if; end process; process is begin if DISP_ALARM = DISP_CURRENT then SOUND_ALARM <= '1'; else SOUND_ALARM <= '0'; end if; end process; end RTL;