OpenCores
URL https://opencores.org/ocsvn/uos_processor/uos_processor/trunk

Subversion Repositories uos_processor

[/] [vhdl/] [hexto7seg.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 droggen
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 hexto7seg is
7
        port(
8
                clk: in std_logic;
9
                d7: in std_logic_vector(3 downto 0);
10
                d6: in std_logic_vector(3 downto 0);
11
                d5: in std_logic_vector(3 downto 0);
12
                d4: in std_logic_vector(3 downto 0);
13
                d3: in std_logic_vector(3 downto 0);
14
                d2: in std_logic_vector(3 downto 0);
15
                d1: in std_logic_vector(3 downto 0);
16
                d0: in std_logic_vector(3 downto 0);
17
                blink: in std_logic_vector(7 downto 0);
18
                q: out std_logic_vector(6 downto 0);
19
                active : out std_logic_vector(7 downto 0)
20
                );
21
end hexto7seg;
22
 
23
architecture Behavioral of hexto7seg is
24
        signal a: std_logic;
25
        signal b: std_logic;
26
        signal c: std_logic;
27
        signal d: std_logic;
28
        signal qt: std_logic_vector(6 downto 0);
29
        signal ctr: std_logic_vector(2 downto 0);
30
        signal divider: std_logic_vector(25 downto 0);
31
begin
32
 
33
 
34
 
35
        p1: process(clk)
36
   begin
37
                        if rising_edge(clk) then
38
                                divider<=divider+1;
39
                        end if;
40
   end process;
41
        p2: process(clk)
42
   begin
43
                        if rising_edge(clk) then
44
                                if  divider(9 downto 0)="0000000000"  then
45
                                        ctr<=ctr+1;
46
                                end if;
47
                        end if;
48
   end process;
49
 
50
        -- input mux
51
        with ctr select
52
        a <=    d0(3) when "000",
53
                        d1(3) when "001",
54
                        d2(3) when "010",
55
                        d3(3) when "011",
56
                        d4(3) when "100",
57
                        d5(3) when "101",
58
                        d6(3) when "110",
59
                        d7(3) when others;
60
        with ctr select
61
        b <=    d0(2) when "000",
62
                        d1(2) when "001",
63
                        d2(2) when "010",
64
                        d3(2) when "011",
65
                        d4(2) when "100",
66
                        d5(2) when "101",
67
                        d6(2) when "110",
68
                        d7(2) when others;
69
        with ctr select
70
        c <=    d0(1) when "000",
71
                        d1(1) when "001",
72
                        d2(1) when "010",
73
                        d3(1) when "011",
74
                        d4(1) when "100",
75
                        d5(1) when "101",
76
                        d6(1) when "110",
77
                        d7(1) when others;
78
        with ctr select
79
        d <=    d0(0) when "000",
80
                        d1(0) when "001",
81
                        d2(0) when "010",
82
                        d3(0) when "011",
83
                        d4(0) when "100",
84
                        d5(0) when "101",
85
                        d6(0) when "110",
86
                        d7(0) when others;
87
 
88
        -- Output mux
89
        with ctr select
90
        active <=       "11111110" when "000",
91
                                        "11111101" when "001",
92
                                        "11111011" when "010",
93
                                        "11110111" when "011",
94
                                        "11101111" when "100",
95
                                        "11011111" when "101",
96
                                        "10111111" when "110",
97
                                        "01111111" when others;
98
 
99
        -- Blinking
100
        q(0) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(0);
101
        q(1) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(1);
102
        q(2) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(2);
103
        q(3) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(3);
104
        q(4) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(4);
105
        q(5) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(5);
106
        q(6) <= (blink(to_integer(unsigned(ctr))) and divider(25)) or qt(6);
107
 
108
 
109
 
110
        qt(0) <= not ( (not a and not b and not c and not d )
111
                                or (not a and not b and c and not d)
112
                                or (not a and not b and c and d)
113
                                or (not a and b and not c and d)
114
                                or (not a and b and c and not d)
115
                                or (not a and b and c and d)
116
                                or (a and not b and not c and not d)
117
                                or (a and not b and not c and d)
118
                                or (a and not b and c and not d)
119
                                or (a and b and not c and not d)
120
                                or (a and b and c and not d)
121
                                or (a and b and c and d) );
122
 
123
        qt(1) <= not ( (not a and not b and not c and not d)
124
                                or (not a and not b and not c and d)
125
                                or (not a and not b and c and not d)
126
                                or (not a and not b and c and c)
127
                                or (not a and b and not c and not d)
128
                                or (not a and b and c and d)
129
                                or (a and not b and not c and not d)
130
                                or (a and not b and not c and d)
131
                                or (a and not b and c and not d)
132
                                or (a and b and not c and d) );
133
 
134
        qt(2) <=        not ( (not a and not b and not c and not d)
135
                                or (not a and not b and not c and d)
136
                                or (not a and not b and c and d)
137
                                or (not a and b and not c and not d)
138
                                or (not a and b and not c and d)
139
                                or (not a and b and c and not d)
140
                                or (not a and b and c and d)
141
                                or (a and not b and not c and not d)
142
                                or (a and not b and not c and d)
143
                                or (a and not b and c and not d)
144
                                or (a and not b and c and d)
145
                                or (a and b and not c and d) );
146
        qt(3) <=        not ((not a and not b and not c and not d)
147
                                or (not a and not b and c and not d)
148
                                or (not a and not b and c and d)
149
                                or (not a and b and not c and d)
150
                                or (not a and b and c and not d)
151
                                or (a and not b and not c and not d)
152
                                or (a and not b and c and d)
153
                                or (a and b and not c and not d)
154
                                or (a and b and not c and d)
155
                                or (a and b and c and not d) );
156
 
157
        --qt(4) <=      not ((not a and not b and not c and not d)
158
        --                      or (not a and not b and c and not d)
159
        --                      or (not a and b and c and not d)
160
        --                      or (a and not b and not c and not d)
161
        --                      or (a and not b and c and not d)
162
        --                      or (a and not b and c and d)
163
        --                      or (a and b and not c and not d)
164
        --                      or (a and b and not c and d)
165
        --                      or (a and b and c and not d)
166
        --                      or (a and b and c and d) );
167
 
168
 
169
 
170
        --qt(5) <=      not ((not a and not b and not c and not d)
171
        --                      or (not a and b and not c and not d)
172
        --                      or (not a and b and not c and d)
173
        --                      or (not a and b and c and not d)
174
        --                      or (a and not b and not c and not d)
175
        --                      or (a and not b and not c and d)
176
        --                      or (a and not b and c and not d)
177
        --                      or (a and not b and c and d)
178
        --                      or (a and b and not c and not d)
179
        --                      or      (a and b and c and not d)
180
        --                      or (a and b and c and d) );
181
 
182
 
183
        --qt(6) <=      not ((not a and not b and c and not d)
184
        --                      or (not a and not b and c and d)
185
        --                      or (not a and b and not c and not d)
186
        --                      or (not a and b and not c and d)
187
        --                      or (not a and b and c and not d)
188
        --                      or (a and not b and not c and not d)
189
        --                      or (a and not b and not c and d)
190
        --                      or (a and not b and c and not d)
191
        --                      or (a and not b and c and d)
192
        --                      or (a and b and not c and d)
193
        --                      or (a and b and c and not d)
194
        --                      or (a and b and c and d) );
195
 
196
        -- Minimized expression:
197
 
198
        qt(4) <= not( (a and b) or (a and c) or (c and not d) or (not b and not d) );
199
        qt(5) <= not( (b and not d) or (not a and b and not c) or (a and not b) or (a and c) or (not c and not d) );
200
        qt(6) <= not( (not a and b and not c) or (a and not b) or (a and d) or (not b and c and d) or (c and not d) );
201
 
202
 
203
end Behavioral;
204
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.