-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCD15min.vhd
More file actions
executable file
·88 lines (78 loc) · 2.29 KB
/
Copy pathCD15min.vhd
File metadata and controls
executable file
·88 lines (78 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity CD15min is
Port(
CLK,Rstb : in std_logic;
i1s : in std_logic;
I15,iRe : in std_logic;
o15Digit1,o15Digit2,o15Digit3,o15Digit4 : out std_logic_vector(3 downto 0)
);
End CD15min;
Architecture Behavioral of CD15min is
signal rCnt : std_logic := '0';
signal w15Digit1 : std_logic_vector(3 downto 0) := "0001";
signal w15Digit2 : std_logic_vector(3 downto 0) := "0101";
signal w15Digit3,w15Digit4 : std_logic_vector(3 downto 0);
Begin
o15Digit1 <= w15Digit1;
o15Digit2 <= w15Digit2;
o15Digit3 <= w15Digit3;
o15Digit4 <= w15Digit4;
u_15min : Process(CLK,Rstb,I15,iRe)
Begin
if(Rstb='0' or iRe='0') then
w15Digit1 <= "0001";
w15Digit2 <= "0101";
w15Digit3 <= (others => '0');
w15Digit4 <= (others => '0');
rCnt <= '0';
elsif(rising_edge(CLK) and I15='0') then
-- Digit1 15 min Halftime --
if(i1s='1' and w15Digit1=0) then
w15Digit1 <= (others => '0');
elsif(i1s='1' and w15Digit2=0 and w15Digit3=0 and w15Digit4=0) then
w15Digit1 <= w15Digit1 - 1;
else
w15Digit1 <= w15Digit1;
end if;
-- Digit2 15 min --
if(i1s='1' and w15Digit1=0 and w15Digit2=0 and rCnt='1') then
w15Digit2 <= (others => '0');
elsif(i1s='1' and w15Digit2=0 and w15Digit3=0 and w15Digit4=0) then
w15Digit2 <= "1001";
rCnt <= '1';
elsif(i1s='1' and w15Digit3=0 and w15Digit4=0) then
w15Digit2 <= w15Digit2 - 1;
else
w15Digit2 <= w15Digit2;
end if;
-- Digit3 15 min --
if(i1s='1' and w15Digit1=0 and w15Digit2=0 and w15Digit3=0) then
w15Digit3 <= (others => '0');
elsif(i1s='1' and w15Digit3=0 and w15Digit4=0) then
w15Digit3 <= "0101";
elsif(i1s='1' and w15Digit4=0) then
w15Digit3 <= w15Digit3 - 1;
else
w15Digit3 <= w15Digit3;
end if;
-- Digit4 15 min --
if(i1s='1' and w15Digit1=0 and w15Digit2=0 and w15Digit3=0 and w15Digit4=0) then
w15Digit4 <= (others => '0');
elsif(i1s='1' and w15Digit4=0) then
w15Digit4 <= "1001";
elsif(i1s='1') then
w15Digit4 <= w15Digit4 - 1;
else
w15Digit4 <= w15Digit4;
end if;
else
w15Digit1 <= w15Digit1;
w15Digit2 <= w15Digit2;
w15Digit3 <= w15Digit3;
w15Digit4 <= w15Digit4;
end if;
end Process;
End Behavioral;