-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpulsadores.vhd
64 lines (56 loc) · 1.54 KB
/
pulsadores.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
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all; --Esta libreria sera necesaria si usais conversiones TO_INTEGER
USE ieee.std_logic_unsigned.all; --Esta libreria sera necesaria si usais conversiones CONV_INTEGER
ENTITY pulsadores IS
PORT (clk : IN STD_LOGIC;
boot : IN STD_LOGIC;
inta : IN STD_LOGIC;
keys : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
intr: OUT STD_LOGIC;
read_key : OUT STD_LOGIC_VECTOR(3 downto 0)
);
END pulsadores;
ARCHITECTURE Structure OF pulsadores IS
signal intr_s : STD_LOGIC := '0';
signal pulse : std_logic := '0';
signal keys_mem : std_logic_vector(3 downto 0) := "1111";
BEGIN
process (clk, boot, keys, inta) begin
if boot = '1' then
intr_s <= '0';
pulse <= '0';
keys_mem <= "1111";
elsif rising_edge(clk) then
if inta = '1' then
intr_s <= '0';
elsif keys /= "1111" and pulse = '0' then
pulse <= '1';
intr_s <= '1';
keys_mem <= keys;
elsif keys = "1111" then
pulse <= '0';
end if;
end if;
end process;
--divisor_clk_20 : PROCESS(clk,inta,keys)
-- begin
--
-- if rising_edge(clk) then
--
-- if inta = '1' then
-- intr_s <= '0';
--
-- elsif intr_s = '0' and keys /= "0000" and pulse = '0' then
-- keys_mem <= keys;
-- intr_s <= '1';
-- pulse <= '1';
-- elsif keys = "0000" then
-- pulse <= '0';
--
-- end if;
-- end if;
-- end process;
intr <= intr_s;
read_key <= keys_mem;
END Structure;