summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src
diff options
context:
space:
mode:
authorgalmes2004-03-30 17:31:17 +0000
committergalmes2004-03-30 17:31:17 +0000
commit1194121c52330fd2a8b4ff44859adf8a0ba33d61 (patch)
tree9cdb64a107e290c25621907e4a22424ace8bb1b3 /2004/n/fpga/src
parent8e39188d2a674e7cc3ab0639c62e3e680bbed8fe (diff)
Gpio : blocs pour la détections de changements d'états. Utilisé pour la
version 2 des gpio.
Diffstat (limited to '2004/n/fpga/src')
-rw-r--r--2004/n/fpga/src/gpio/gpio_it_detect_down.vhd58
-rw-r--r--2004/n/fpga/src/gpio/gpio_it_detect_up.vhd58
2 files changed, 116 insertions, 0 deletions
diff --git a/2004/n/fpga/src/gpio/gpio_it_detect_down.vhd b/2004/n/fpga/src/gpio/gpio_it_detect_down.vhd
new file mode 100644
index 0000000..ec0bfe4
--- /dev/null
+++ b/2004/n/fpga/src/gpio/gpio_it_detect_down.vhd
@@ -0,0 +1,58 @@
+-- gpio_it_detect_down.vhd
+-- Eurobot 2004 : APB Team
+-- Auteur : Pierre-André Galmes
+-- detecteur de changement d'état (front descendant) avec masque.
+
+-- Remarque :
+-- masque : si bit à 1 => générer une interruption.
+-- si bit à 0 => ne pas générer d'interruption.
+
+library ieee;
+use ieee.std_logic_1164.all;
+
+use work.isa_const.all;
+use work.nono_const.all;
+
+
+entity gpio_it_detect_down 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_down is
+ -- Signal interne
+ signal state_p : T_DATA; -- état passé
+
+begin
+
+ -- process séquentiel
+ process (rst, clk, data_in)
+ begin
+ if (rst = '1') then
+ -- ne pas déclencher d'it après rst.
+ state_p <= data_in;
+ it_detected <= '0';
+ elsif (clk'event and clk = '1') then
+ -- détection d'un front descendant.
+ if ((state_p(0) = '1' and data_in(0) = '0' and it_mask(0) = '1')
+ or (state_p(1) = '1' and data_in(1) = '0' and it_mask(1) = '1')
+ or (state_p(2) = '1' and data_in(2) = '0' and it_mask(2) = '1')
+ or (state_p(3) = '1' and data_in(3) = '0' and it_mask(3) = '1')
+ or (state_p(4) = '1' and data_in(4) = '0' and it_mask(4) = '1')
+ or (state_p(5) = '1' and data_in(5) = '0' and it_mask(5) = '1')
+ or (state_p(6) = '1' and data_in(6) = '0' and it_mask(6) = '1')
+ or (state_p(7) = '1' and data_in(7) = '0' and it_mask(7) = '1'))
+ then
+ -- on émet le signal d'interruption.
+ it_detected <= '1';
+ end if;
+ state_p <= data_in;
+ end if;
+ end process;
+
+end RTL;
diff --git a/2004/n/fpga/src/gpio/gpio_it_detect_up.vhd b/2004/n/fpga/src/gpio/gpio_it_detect_up.vhd
new file mode 100644
index 0000000..382533a
--- /dev/null
+++ b/2004/n/fpga/src/gpio/gpio_it_detect_up.vhd
@@ -0,0 +1,58 @@
+-- gpio_it_detect_up.vhd
+-- Eurobot 2004 : APB Team
+-- Auteur : Pierre-André Galmes
+-- detecteur de changement d'état (front montant) avec masque.
+
+-- Remarque :
+-- masque : si bit à 1 => générer une interruption.
+-- si bit à 0 => ne pas générer d'interruption.
+
+library ieee;
+use ieee.std_logic_1164.all;
+
+use work.isa_const.all;
+use work.nono_const.all;
+
+
+entity gpio_it_detect_up 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_up is
+ -- Signal interne
+ signal state_p : T_DATA; -- état passé
+
+begin
+
+ -- process séquentiel
+ process (rst, clk, data_in)
+ begin
+ if (rst = '1') then
+ -- ne pas déclencher d'it après rst.
+ state_p <= data_in;
+ it_detected <= '0';
+ elsif (clk'event and clk = '1') then
+ -- détection d'un front descendant.
+ if ((state_p(0) = '0' and data_in(0) = '1' and it_mask(0) = '1')
+ or (state_p(1) = '0' and data_in(1) = '1' and it_mask(1) = '1')
+ or (state_p(2) = '0' and data_in(2) = '1' and it_mask(2) = '1')
+ or (state_p(3) = '0' and data_in(3) = '1' and it_mask(3) = '1')
+ or (state_p(4) = '0' and data_in(4) = '1' and it_mask(4) = '1')
+ or (state_p(5) = '0' and data_in(5) = '1' and it_mask(5) = '1')
+ or (state_p(6) = '0' and data_in(6) = '1' and it_mask(6) = '1')
+ or (state_p(7) = '0' and data_in(7) = '1' and it_mask(7) = '1'))
+ then
+ -- on émet le signal d'interruption.
+ it_detected <= '1';
+ end if;
+ state_p <= data_in;
+ end if;
+ end process;
+
+end RTL;