From 111d703989aacc6f278ca0b67cf7d918aadfd34b Mon Sep 17 00:00:00 2001 From: galmes Date: Mon, 16 Feb 2004 15:22:47 +0000 Subject: Ajout d'un modèle pour module. Pas pu le tester ni simuler --- 2004/n/fpga/src/modele/bch_modele.vhd | 62 +++++++++++++++++++++++++++++++++++ 2004/n/fpga/src/modele/modele.vhd | 49 +++++++++++++++++++++++++++ 2004/n/fpga/src/modele/nono_const.vhd | 50 ++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 2004/n/fpga/src/modele/bch_modele.vhd create mode 100644 2004/n/fpga/src/modele/modele.vhd create mode 100644 2004/n/fpga/src/modele/nono_const.vhd (limited to '2004/n') diff --git a/2004/n/fpga/src/modele/bch_modele.vhd b/2004/n/fpga/src/modele/bch_modele.vhd new file mode 100644 index 0000000..a7f1f48 --- /dev/null +++ b/2004/n/fpga/src/modele/bch_modele.vhd @@ -0,0 +1,62 @@ +-- modele.vhd +-- Eurobot 2004 : APB Team +-- Auteur : Pierre-André Galmes +-- Fichier modèle pour la déclaration de module. + +library ieee; +use ieee.std_logic_1164.all; +use work.nono_const.all + + +entity bch_modele is +end bch_modele; + +architecture sim1 of bch_modele is + + component modele + generic ( + -- adresses des différents registres du module. + A_REG1 : T_ADDRESS := A_REG_IO_DIRECTION; + A_REG2 : T_ADDRESS := A_REG_IO_DATA; + A_REG3 : T_ADDRESS := A_REG_IO_INTERRUPT_MASK + -- si autre choses à déclarer... + ); + port ( + rst : in std_logic; + clk : in std_logic; + rw : in std_logic; -- read / write + bus_data : inout std_logic_vector ((NB_BIT_DATA - 1) downto 0); + bus_address : in std_logic_vector ((NB_BIT_ADDRESS - 1) downto 0) + ); + end modele; + + -- définiton des signaux + signal rst : std_logic; + signal clk : std_logic; + signal rw : std_logic; -- read / write + signal bus_data : std_logic_vector ((NB_BIT_DATA - 1) downto 0); + signal bus_address : std_logic_vector ((NB_BIT_ADDRESS - 1) downto 0) + +begin + U1 : modele port map ( + rst => rst, + clk => clk, + rw => rw, + bus_data => bus_data, + bus_address => bus_address + ); + + rst <= '1', '0' after CK_PERIOD; + clk <= not clk after CK_PERIOD/2; + rw <= '0'; + bus_address <= A_REG_IO_DIRECTION, + A_REG_IO_DATA after 3*CK_PERIOD, + A_REG_IO_INTERRUPT_MASK after 5*CK_PERIOD; +end sim1; + +configuration cf1_bch_modele of bch_modele is + for sim1 + for all : modele use entity work.modele(test_modele); end for; + end for; +end cf1_bch_modele; + diff --git a/2004/n/fpga/src/modele/modele.vhd b/2004/n/fpga/src/modele/modele.vhd new file mode 100644 index 0000000..701ccbc --- /dev/null +++ b/2004/n/fpga/src/modele/modele.vhd @@ -0,0 +1,49 @@ +-- modele.vhd +-- Eurobot 2004 : APB Team +-- Auteur : Pierre-André Galmes +-- Fichier modèle pour la déclaration de module. + +library ieee; +use ieee.std_logic_1164.all; + +use work.nono_const.all + +entity modele is + generic ( + -- adresses des différents registres du module. + A_REG1 : T_ADDRESS := A_REG_IO_DIRECTION; + A_REG2 : T_ADDRESS := A_REG_IO_DATA; + A_REG3 : T_ADDRESS := A_REG_IO_INTERRUPT_MASK + -- si autre choses à déclarer... + ); + port ( + rst : in std_logic; + clk : in std_logic; + + -- XXX : savoir si read = 0 ou 1 !! + rw : in std_logic; -- read (0) / write (1) + + bus_data : inout std_logic_vector ((NB_BIT_DATA - 1) downto 0); + bus_address : in std_logic_vector ((NB_BIT_ADDRESS - 1) downto 0) + ); +end entity; + +architecture test_modele of modele is +begin + process (rst, clk) + begin + if (rst = '1') then + bus_data <= x"00"; + elsif (ck'event and ck = '1') then + if (bus_address = A_REG1) then + bus_data <= "01"; + else + if (bus_address = A_REG2) then + bus_data <= "02"; + elsif (bus_address = A_REG2) then + bus_data <= "03"; + end if; + end if; + end if; + end process; +end test_modele; diff --git a/2004/n/fpga/src/modele/nono_const.vhd b/2004/n/fpga/src/modele/nono_const.vhd new file mode 100644 index 0000000..5ad355b --- /dev/null +++ b/2004/n/fpga/src/modele/nono_const.vhd @@ -0,0 +1,50 @@ +-- nono_const.vhd +-- Eurobot 2004 : APB Team +-- Auteur : Pierre-André Galmes +-- Fichier de déclaration de constantes. + +-- RQ : pour une indentation bien sous vim : +-- 1 - ":set shiftwidth=4" +-- 2 - se placer sous "package nono_const is" +-- 3 - tapez : = puis shift+G + +library ieee; +use ieee.std_logic_1164.all; + +package nono_const is + + -- Temps d'une période d'horloge + constant CK_PERIOD : time := 20 ns; + + -- Taille d'une addresse sur la carte + -- RQ : 10 = nb suffisant + -- 12 = 3 digit en héxa + constant NB_BIT_ADDRESS : integer := 10; + + -- Taille des données sur la carte + constant NB_BIT_DATA : integer := 8; + + -- Définition d'un nouveau type : ADDRESS + subtype T_ADDRESS is std_logic_vector ((NB_BIT_ADDRESS - 1) downto 0); + + -- Les différentes banques d'adresses (4 x 256) + -- Rq pour Pierre : ça va influer sur le bloc de gestion du bus + constant START_ADDR_B0 : T_ADDRESS := "0000000000"; + constant START_ADDR_B1 : T_ADDRESS := "0100000000"; + constant START_ADDR_B2 : T_ADDRESS := "1000000000"; + constant START_ADDR_B3 : T_ADDRESS := "1100000000"; + + -- Les addresses des différents registres. + + -- gestion des interruptions + constant A_INTERRUPT_MANAGER : T_ADDRESS := START_ADDR_B0 + x"00"; + -- Bloc d'IO + constant A_REG_IO_DIRECTION : T_ADDRESS := START_ADDR_B0 + x"01"; + constant A_REG_IO_DATA : T_ADDRESS := START_ADDR_B0 + x"02"; + constant A_REG_IO_INTERRUPT_MASK : T_ADDRESS := START_ADDR_B0 + x"03"; + -- Bloc port série + -- Bloc caméra + -- Bloc PWM + -- Bloc I²C + -- Bloc servo-moteurs +end nono_const; -- cgit v1.2.3