1 | library IEEE;
|
2 | use IEEE.STD_LOGIC_1164.all;
|
3 | use IEEE.numeric_std.all;
|
4 | use IEEE.std_logic_unsigned.all;
|
5 |
|
6 | entity DDR is
|
7 | port (
|
8 | ALARM_TIME : in std_logic_vector (3 downto 0);
|
9 | CURRENT_TIME : in std_logic_vector (3 downto 0);
|
10 | SHOW_A : in std_logic;
|
11 | -----
|
12 | DISPLAY : out std_logic_vector (6 downto 0);
|
13 | SOUND_ALARM : out std_logic
|
14 | );
|
15 | end DDR;
|
16 |
|
17 | architecture RTL of DDR is
|
18 |
|
19 | signal DISP_CURRENT : std_logic_vector (6 downto 0);
|
20 | signal DISP_ALARM : std_logic_vector (6 downto 0);
|
21 |
|
22 | begin
|
23 | DISP_CURRENT <= "0111111" when CURRENT_TIME="0000" else --0
|
24 | "0000110" when CURRENT_TIME="0001" else --1
|
25 | "1011011" when CURRENT_TIME="0010" else --2
|
26 | "1001111" when CURRENT_TIME="0011" else --3
|
27 | "1100110" when CURRENT_TIME="0100" else --4
|
28 | "1101101" when CURRENT_TIME="0101" else --5
|
29 | "1111101" when CURRENT_TIME="0110" else --6
|
30 | "0000111" when CURRENT_TIME="0111" else --7
|
31 | "1111111" when CURRENT_TIME="1000" else --8
|
32 | "1101111" when CURRENT_TIME="1001" else --9
|
33 | "1100011" ;
|
34 |
|
35 | DISP_ALARM <= "0111111" when ALARM_TIME="0000" else --0
|
36 | "0000110" when ALARM_TIME="0001" else --1
|
37 | "1011011" when ALARM_TIME="0010" else --2
|
38 | "1001111" when ALARM_TIME="0011" else --3
|
39 | "1100110" when ALARM_TIME="0100" else --4
|
40 | "1101101" when ALARM_TIME="0101" else --5
|
41 | "1111101" when ALARM_TIME="0110" else --6
|
42 | "0000111" when ALARM_TIME="0111" else --7
|
43 | "1111111" when ALARM_TIME="1000" else --8
|
44 | "1101111" when ALARM_TIME="1001" else --9
|
45 | "1100011" ;
|
46 |
|
47 | process (DISP_ALARM, SHOW_A, DISP_CURRENT) is
|
48 | begin
|
49 | if SHOW_A = '1' then
|
50 | DISPLAY <= DISP_ALARM;
|
51 | else
|
52 | DISPLAY <= DISP_CURRENT;
|
53 | end if;
|
54 | end process;
|
55 |
|
56 | --DISPLAY <= DISP_ALARM when SHOW_A = '1' else DISP_CURRENT;
|
57 |
|
58 | SOUND_ALARM <= '1' when DISP_ALARM = DISP_CURRENT else '0';
|
59 |
|
60 | end RTL;
|