summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/interrupt/conserv.vhd
diff options
context:
space:
mode:
Diffstat (limited to '2004/n/fpga/src/interrupt/conserv.vhd')
-rw-r--r--2004/n/fpga/src/interrupt/conserv.vhd53
1 files changed, 53 insertions, 0 deletions
diff --git a/2004/n/fpga/src/interrupt/conserv.vhd b/2004/n/fpga/src/interrupt/conserv.vhd
new file mode 100644
index 0000000..e3511ee
--- /dev/null
+++ b/2004/n/fpga/src/interrupt/conserv.vhd
@@ -0,0 +1,53 @@
+-- bascule.vhd
+-- Eurobot 2004 : APB Team
+-- Auteur : Pierre-André Galmes
+-- Bascule 8 bits avec signal de détection des changements.
+
+-- Remarque :
+-- masque : si bit à 1 => on détecte l'interruption.
+-- si bit à 0 => on détecte pas l'interruption.
+
+
+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 bascule is
+ port (
+ clk : in std_logic;
+ rst : in std_logic;
+ data_in : in T_DATA;
+ data_out : out T_DATA;
+ it_detected : out std_logic
+ );
+end entity;
+
+architecture RTL of bascule is
+begin
+ -- process séquentiel
+ process (rst, clk)
+ begin
+ if (rst = '1') then
+ -- ne pas déclencher d'it après rst.
+ data_out <= x"00";
+ it_detected <= '0';
+ elsif (clk'event and clk = '1') then
+ if (data_in(0) = '1') then data_out(0) <= '1'; end if;
+ if (data_in(1) = '1') then data_out(1) <= '1'; end if;
+ if (data_in(2) = '1') then data_out(2) <= '1'; end if;
+ if (data_in(3) = '1') then data_out(3) <= '1'; end if;
+ if (data_in(4) = '1') then data_out(4) <= '1'; end if;
+ if (data_in(5) = '1') then data_out(5) <= '1'; end if;
+ if (data_in(6) = '1') then data_out(6) <= '1'; end if;
+ if (data_in(7) = '1') then data_out(7) <= '1'; end if;
+ -- Détection des interruptions.
+ if (data_in /= x"00") then it_detected <= '1'; end if;
+ end if;
+ end process;
+
+end RTL;