summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/gpio/gpio_it_detect.vhd
blob: 3511c634e55c3f58d76549b4d667502e41c958f6 (plain)
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
-- gpio_it_detect.vhd
-- Eurobot 2004 : APB Team
-- Auteur : Pierre-Andr� Galmes
-- detecteur d'interruption avec masque.


library ieee;
use	ieee.std_logic_1164.all;
--use     ieee.std_logic_arith.all;
--use     ieee.std_logic_unsigned.all;

use	work.isa_const.all;
use	work.nono_const.all;


entity gpio_it_detect is
    port (
	clk : in std_logic;
	rst : in std_logic;
	data_in : in T_DATA;
	it_mask : in T_DATA;
	it_detected : out std_logic
    );
end entity;

architecture RTL of gpio_it_detect is
    -- Constantes
    constant IT_ENABLE : std_logic := '1';
    -- Signal interne
    signal state_p : T_DATA;	-- etat passe

begin
    -- process s�quentiel
    process (rst, clk)
    begin
	if (rst = '1') then
	    state_p <= (others => '0');
	    it_detected <= '0';
	elsif (clk'event and clk = '1') then
	    -- TODO : Ajouter la synchronisation ??????? Pas besoin, non ?????
		
	    if (data_in /= state_p) then
	    	-- bit ayant droit de g�n�rer une interruption ?
	    	if (((data_in xor state_p) and it_mask) /= x"00") then
		    -- on �met le signal d'interruption.
		    it_detected <= '1';
		end if;
	    else
		it_detected <= '0';
		state_p <= data_in;
	    end if;
	end if;
    end process;

end RTL;