summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/gpio/reg_ioz.vhd
diff options
context:
space:
mode:
Diffstat (limited to '2004/n/fpga/src/gpio/reg_ioz.vhd')
-rw-r--r--2004/n/fpga/src/gpio/reg_ioz.vhd54
1 files changed, 54 insertions, 0 deletions
diff --git a/2004/n/fpga/src/gpio/reg_ioz.vhd b/2004/n/fpga/src/gpio/reg_ioz.vhd
new file mode 100644
index 0000000..22f1730
--- /dev/null
+++ b/2004/n/fpga/src/gpio/reg_ioz.vhd
@@ -0,0 +1,54 @@
+-- reg_ioz.vhd
+-- Eurobot 2004 : APB Team
+-- Auteur : Pierre-André Galmes
+-- Registre dont on peut lire les valeurs sur data_out.
+-- RQ : Ce type de registre a un inconvénient : la haute impédance !
+
+-- Principe :
+-- Si (write et enable) alors sauvegarde entrée et copie entrée sur sortie.
+-- Si (read et enable) alors copie sortie sur entrée.
+-- Si (pas enable) alors copie dernière valeur sauvegardée sur sortie.
+
+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 reg_ioz is
+ port (
+ rst : in std_logic;
+ rw : in std_logic; -- read (ISA_READ) / write (ISA_WRITE)
+ enable : in std_logic;
+ data_in : inout T_DATA;
+ data_out : inout T_DATA
+ );
+end entity;
+
+architecture BEHAV of reg_ioz is
+ -- signal interne
+ signal REG : T_DATA;
+begin
+ -- process
+ process (rst, rw, enable, data_in)
+ begin
+ if (rst = '1') then
+ REG <= x"00";
+ else
+ if (enable = '1') then
+ if (rw = ISA_WRITE) then
+ REG <= data_in;
+ elsif (rw = ISA_READ) then
+ data_in <= data_out;
+ end if;
+ else
+ data_in <= "ZZZZZZZZ";
+ end if;
+ end if;
+ end process;
+
+ data_out <= "ZZZZZZZZ" when (rw = ISA_READ and enable = '1') else REG;
+end BEHAV;