summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src
diff options
context:
space:
mode:
authorprot2004-03-14 23:12:50 +0000
committerprot2004-03-14 23:12:50 +0000
commit9fe03f9a5b0ced6c9d02f0e75c1fb82fbda75424 (patch)
tree375ccf62c10559cd660b271b21887badf87cdd3a /2004/n/fpga/src
parent35838095563561400ca5e46cc569e9149924578d (diff)
Modif du registre regio
Diffstat (limited to '2004/n/fpga/src')
-rw-r--r--2004/n/fpga/src/registre/registre.vhd175
1 files changed, 68 insertions, 107 deletions
diff --git a/2004/n/fpga/src/registre/registre.vhd b/2004/n/fpga/src/registre/registre.vhd
index 675eb83..2b5301c 100644
--- a/2004/n/fpga/src/registre/registre.vhd
+++ b/2004/n/fpga/src/registre/registre.vhd
@@ -1,110 +1,71 @@
--- txserie.vhd
--- Eurobot 2004 : APB Team
--- Auteur : Pierre Prot
--- registre IO adressable sur bus ISA
-
--- MARCHE
-
--- -------------------------------------------
--- Registre générique à brancher sur un bus
--- -------------------------------------------
---
--- * on peut écrire ou lire dans le registre depuis le bus :
--- . Positionner l'adresse
--- . Mettre 'rw' à 1=>read 0=>write
--- . Front montant sur 'ck'
--- Remarque : on ne peut pas écrire via le bus si 'load' est activé
--- * on peut lire la valeur en permanence sur 'output'
--- * on peut écrire dans le registre en permanence grâce à 'load'. Cette
--- action est prioritaire sur l'écriture via le bus
--- . Mettre 'load' à 1
--- . Ecrire dans 'input' (actualisation immédiate)
--- . Mettre 'load' à 0 pour latcher
-
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.std_logic_arith.all;
-use ieee.std_logic_unsigned.all;
-
-use work.nono_const.all;
-
-entity regIO is
- generic(adr : T_ADDRESS := "0000000001");
- port(
- bus_data: inout T_DATA;
- bus_address: in T_ADDRESS;
- input: in T_DATA;
- output: out T_DATA;
- rw: in std_logic;
- load: in std_logic;
- ck: in std_logic;
- rst: in std_logic
- );
-end entity;
-
-
-architecture rtl of regIO is
-signal REG : T_DATA :=(others => '0');
-
-begin
- p_w:process(ck,rst,load,input)
- begin
+-- txserie.vhd
+-- Eurobot 2004 : APB Team
+-- Auteur : Pierre Prot
+-- registre IO adressable sur bus ISA
- if( rst = '1') then
- REG <= (others => '0');
- bus_data <= (others => 'Z');
+-- MARCHE
- elsif(ck'event and ck='1') then
- if(bus_address=adr) then
- if(rw='0' and load='0') then
- REG<=bus_data;
- bus_data <= (others => 'Z');
- elsif(rw='0' and load='1') then
- bus_data <= (others => 'Z');
- elsif(rw='1') then -- RW=1 : la CM lit => on écrit sur le bus
- bus_data<=REG;
- end if;
- else
- bus_data <= (others => 'Z');
- end if;
- end if;
+-- -------------------------------------------
+-- Registre générique à brancher sur un bus
+-- -------------------------------------------
+--
+-- * on peut écrire ou lire dans le registre depuis le bus :
+-- . Positionner l'adresse
+-- . Mettre 'rw' à 1=>read 0=>write
+-- . Front montant sur 'ck'
+-- Remarque : on ne peut pas écrire via le bus si 'load' est activé
+-- * on peut lire la valeur en permanence sur 'output'
+-- * on peut écrire dans le registre en permanence grâce à 'load'. Cette
+-- action est prioritaire sur l'écriture via le bus
+-- . Mettre 'load' à 1
+-- . Ecrire dans 'input' (actualisation immédiate)
+-- . Mettre 'load' à 0 pour latcher
+
+
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.std_logic_arith.all;
+use ieee.std_logic_unsigned.all;
+
+use work.nono_const.all;
+
+entity regIO is
+ port(
+ cs: in std_logic;
+ bus_data: inout T_DATA:=(others => 'Z');
+ input: in T_DATA;
+ output: out T_DATA;
+ rw: in std_logic;
+ load: in std_logic;
+ ck: in std_logic;
+ rst: in std_logic
+ );
+end entity;
+
+
+architecture rtl of regIO is
+signal REG : T_DATA :=(others => '0');
+
+begin
+ p_w:process(ck,load,input,rst,rw)
+ begin
+ if(rst='1') then
+ REG<=(others => '0');
+ elsif(ck'event and ck='1') then
+ if(cs='1') then
+ if(rw='0' and load='0') then
+ REG<=bus_data;
+ end if;
+ end if;
+ end if;
+
+ -- chargement : prioritaire sur l'écriture via le bus
+ if(load='1' and not(ck='1' and rw='1')) then
+ REG<=input;
+ end if;
+ end process;
+
+ bus_data<=REG when (rw='1' and cs='1' and ck='1' and rst='0') else (others => 'Z');
+ output<=REG;
+end rtl;
--- si la clock est à 0, alors le bus est forcément en Z
- if(ck='0') then
- bus_data <= (others => 'Z');
- end if;
-
--- chargement : prioritaire sur l'écriture via le bus
- if(load='1' and not(ck='1' and rw='1')) then
- REG<=input;
- end if;
- end process p_w;
-
-
--- p_load : process(load,input)
--- begin
--- if(load='1') then
--- REG<=input;
--- end if;
--- end process p_load;
-
--- p_reset : process(rst)
--- begin
--- if(rst'event and rst='1') then
--- REG<=(others => '0');
--- bus_data<=(others => 'Z');
--- end if;
--- end process p_reset;
-
- output<=REG;
-end rtl;
-
-
-
-
-
-
-
-
-