-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEtatFeu.vhd
67 lines (61 loc) · 1.35 KB
/
EtatFeu.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
library IEEE;
use ieee.std_logic_1164.all;
use work.all;
use ieee.numeric_std.all;
entity EtatFeu is
port(
clkS, stdby : in std_logic;
clkOut : out std_logic;
maxV : in integer;
signal dizaine, unite : out std_logic_vector(0 to 3);
signal valeur : out integer);
end EtatFeu;
architecture structural of EtatFeu is
signal count : integer := 0;
signal count2 : integer := maxV;
signal maxVtest : integer;
signal temp, temp2 : integer;
begin
process(clkS, stdby)
variable passage : std_logic := '1';
variable count3 : std_logic := '0';
begin
if rising_edge(clkS) then
if stdby = '0' then
if passage = '1' then
count <= 0;
count2 <= maxV;
passage := '0';
else
--if count = maxV then
--count <= 0;
--clkOut <= '1';
--else
--count <= count +1;
--clkOut <= '0';
--end if;
if count2 = 1 then
--count2 <= maxV;
count2 <= -10;
passage := '1';
clkOut <= '1';
else
count2 <= count2 -1;
clkOut <= '0';
end if;
end if;
elsif stdby ='1' then
temp <= 0;
temp2 <= 0;
passage := '1';
end if;
end if;
if stdby = '0' then
temp <= count2 /10;
temp2 <= count2 mod 10;
dizaine <= std_logic_vector(to_unsigned(temp, 4));
unite <= std_logic_vector(to_unsigned(temp2, 4));
end if;
valeur <= count2;
end process;
end structural;