summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/gpio/gpio_it_detect.vhd
diff options
context:
space:
mode:
authorgalmes2004-02-24 21:30:40 +0000
committergalmes2004-02-24 21:30:40 +0000
commit3a46e687fadd28f93b3a67063e535615770a966d (patch)
tree34754ade1fc5c013c08c3701fbdcbca1382f44c4 /2004/n/fpga/src/gpio/gpio_it_detect.vhd
parentf8ee5b24be92c6709781e17c6f8ff358f5986558 (diff)
Ajout de plein de fichier pour faire les gpio
Diffstat (limited to '2004/n/fpga/src/gpio/gpio_it_detect.vhd')
-rw-r--r--2004/n/fpga/src/gpio/gpio_it_detect.vhd55
1 files changed, 55 insertions, 0 deletions
diff --git a/2004/n/fpga/src/gpio/gpio_it_detect.vhd b/2004/n/fpga/src/gpio/gpio_it_detect.vhd
new file mode 100644
index 0000000..1f1d69b
--- /dev/null
+++ b/2004/n/fpga/src/gpio/gpio_it_detect.vhd
@@ -0,0 +1,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;