-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTLC.vhd
115 lines (105 loc) · 4.25 KB
/
TLC.vhd
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_unsigned.ALL;
entity TLC is
port(lrb: in std_logic_vector(2 downto 0);
clk: in std_logic;
lights: out std_logic_vector(7 downto 0));
end TLC;
architecture char of TLC is
signal count: std_logic_vector(26 downto 0);
begin
process(clk, lrb, count)
begin
if rising_edge(clk) then
if lrb = "000" then
lights <= "00000000";
elsif lrb = "001" then
lights <= "11111111";
elsif lrb = "010" then
count <= "000000000000000000000000000";
if count <= "01011111010111100001000000" then
lights <= "00000000";
count <= count + 1;
elsif (count <= "10111110101111000010000000" and count > "01011111010111100001000000") then
lights <= "00001000";
count <= count + 1;
elsif (count <= "100011110000110100011000000" and count > "10111110101111000010000000") then
lights <= "00001100";
count <= count + 1;
elsif (count <= "101111101011110000100000000" and count > "100011110000110100011000000") then
lights <= "00001110";
count <= count + 1;
elsif (count <= "111011100110101100101000000" and count > "101111101011110000100000000") then
lights <= "00001111";
count <= count + 1;
end if;
elsif lrb = "011" then
count <= "000000000000000000000000000";
if count <= "001011111010111100001000000" then
lights <= "11110000";
count <= count + 1;
elsif (count <= "10111110101111000010000000" and count > "01011111010111100001000000") then
lights <= "11111000";
count <= count + 1;
elsif (count <= "100011110000110100011000000" and count > "10111110101111000010000000") then
lights <= "11111100";
count <= count + 1;
elsif (count <= "101111101011110000100000000" and count > "100011110000110100011000000") then
lights <= "11111110";
count <= count + 1;
elsif (count <= "111011100110101100101000000" and count > "101111101011110000100000000") then
lights <= "11111111";
count <= count + 1;
end if;
elsif lrb = "100" then
count <= "000000000000000000000000000";
if count <= "001011111010111100001000000" then
lights <= "00000000";
count <= count + 1;
elsif (count <= "10111110101111000010000000" and count > "01011111010111100001000000") then
lights <= "00010000";
count <= count + 1;
elsif (count <= "100011110000110100011000000" and count > "10111110101111000010000000") then
lights <= "00110000";
count <= count + 1;
elsif (count <= "101111101011110000100000000" and count > "100011110000110100011000000") then
lights <= "01110000";
count <= count + 1;
elsif (count <= "111011100110101100101000000" and count > "101111101011110000100000000") then
lights <= "11110000";
count <= count + 1;
end if;
elsif lrb = "101" then
count <= "000000000000000000000000000";
if count <= "001011111010111100001000000" then
lights <= "00001111";
count <= count + 1;
elsif (count <= "10111110101111000010000000" and count > "01011111010111100001000000") then
lights <= "00011111";
count <= count + 1;
elsif (count <= "100011110000110100011000000" and count > "10111110101111000010000000") then
lights <= "00111111";
count <= count + 1;
elsif (count <= "101111101011110000100000000" and count > "100011110000110100011000000") then
lights <= "01111111";
count <= count + 1;
elsif (count <= "111011100110101100101000000" and count > "101111101011110000100000000") then
lights <= "11111111";
count <= count + 1;
end if;
elsif lrb = "110" then
count <= "000000000000000000000000000";
if (count <= "001011111010111100001000000") then
lights <= "00000000";
count <= count + 1;
elsif (count <= "010111110101111000010000000" and count > "001011111010111100001000000") then
lights <= "11111111";
count <= count + 1;
end if;
elsif lrb = "111" then
lights <= "11111111";
end if;
end if;
end process;
end char;