025ff1a6
rduhr
7Segment_display ...
|
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
|
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 27.09.2023 17:03:49
-- Design Name:
-- Module Name: display - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity display is
port (
clk_fpga : in STD_LOGIC;
reset : in STD_LOGIC;
aff : out STD_LOGIC_VECTOR(7 downto 0);
an : out STD_LOGIC_VECTOR(3 downto 0)
);
end display;
architecture Behavioral of display is
|
f7d9e147
rduhr
display.vhd
|
47
|
signal count_an : integer range 3 downto 0 := 0;
|
025ff1a6
rduhr
7Segment_display ...
|
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
|
signal clk_enable : integer range 4999 downto 0 := 0;
signal clk_counter : integer range 2999999 downto 0 := 0;
constant nb0 : std_logic_vector(7 downto 0) := "11000000";
constant nb1 : std_logic_vector(7 downto 0) := "11111001";
constant nb2 : std_logic_vector(7 downto 0) := "10100100";
constant nb3 : std_logic_vector(7 downto 0) := "10110000";
constant nb4 : std_logic_vector(7 downto 0) := "10011001";
constant nb5 : std_logic_vector(7 downto 0) := "10010010";
constant nb6 : std_logic_vector(7 downto 0) := "10000010";
constant nb7 : std_logic_vector(7 downto 0) := "11111000";
constant nb8 : std_logic_vector(7 downto 0) := "10000000";
constant nb9 : std_logic_vector(7 downto 0) := "10010000";
constant seg0 : std_logic_vector(3 downto 0) := "1110";
constant seg1 : std_logic_vector(3 downto 0) := "1101";
constant seg2 : std_logic_vector(3 downto 0) := "1011";
constant seg3 : std_logic_vector(3 downto 0) := "0111";
signal chiffre4 : integer range 9 downto 0 := 0;
signal chiffre3 : integer range 9 downto 0 := 0;
signal chiffre2 : integer range 9 downto 0 := 0;
signal chiffre1 : integer range 9 downto 0 := 0;
type mynumbers is array(9 downto 0) of std_logic_vector(7 downto 0);
signal numbers : mynumbers := (nb9,nb8,nb7,nb6,nb5,nb4,nb3,nb2,nb1,nb0);
begin
|
46eee1ff
rduhr
7Segment_display ...
|
74
|
-- display process
|
025ff1a6
rduhr
7Segment_display ...
|
75
76
77
|
process(clk_fpga)
begin
if clk_fpga'event and clk_fpga = '1' then
|
025ff1a6
rduhr
7Segment_display ...
|
78
79
|
if clk_enable = 4999 then
clk_enable <= 0;
|
f7d9e147
rduhr
display.vhd
|
80
|
if count_an = 0 then
|
025ff1a6
rduhr
7Segment_display ...
|
81
82
|
aff <= numbers(chiffre4);
an <= seg0;
|
f7d9e147
rduhr
display.vhd
|
83
84
|
count_an <= count_an + 1;
elsif count_an = 1 then
|
025ff1a6
rduhr
7Segment_display ...
|
85
86
|
aff <= numbers(chiffre3);
an <= seg1;
|
f7d9e147
rduhr
display.vhd
|
87
88
|
count_an <= count_an + 1;
elsif count_an = 2 then
|
025ff1a6
rduhr
7Segment_display ...
|
89
90
|
aff <= numbers(chiffre2);
an <= seg2;
|
f7d9e147
rduhr
display.vhd
|
91
92
|
count_an <= count_an + 1;
elsif count_an = 3 then
|
025ff1a6
rduhr
7Segment_display ...
|
93
94
|
aff <= numbers(chiffre1);
an <= seg3;
|
f7d9e147
rduhr
display.vhd
|
95
|
count_an <= 0;
|
025ff1a6
rduhr
7Segment_display ...
|
96
97
98
|
end if;
else
clk_enable <= clk_enable + 1;
|
cdbcafa7
rduhr
7Segment_display ...
|
99
100
101
102
103
104
105
106
|
end if;
end if;
end process;
-- process counter
process(clk_fpga)
begin
if clk_fpga'event and clk_fpga = '1' then
|
025ff1a6
rduhr
7Segment_display ...
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
if clk_counter = 2999999 then
clk_counter <= 0;
if reset = '1' then
chiffre1 <= 0;
chiffre2 <= 0;
chiffre3 <= 0;
chiffre4 <= 0;
else if chiffre4 = 9 then
chiffre4 <= 0;
if chiffre3 = 9 then
chiffre3 <= 0;
if chiffre2 = 9 then
chiffre2 <= 0;
if chiffre1 = 9 then
chiffre1 <= 0;
else
chiffre1 <= chiffre1 + 1;
end if;
else
chiffre2 <= chiffre2 + 1;
end if;
else
chiffre3 <= chiffre3 + 1;
end if;
else
chiffre4 <= chiffre4 + 1;
end if;
else
clk_counter <= clk_counter + 1;
end if;
end if;
end process;
|
f7d9e147
rduhr
display.vhd
|
139
|
end Behavioral;
|