summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2004/n/fpga/src/decodisa/bch_decodisa.vhd140
-rw-r--r--2004/n/fpga/src/decodisa/decodisa.vhd97
2 files changed, 138 insertions, 99 deletions
diff --git a/2004/n/fpga/src/decodisa/bch_decodisa.vhd b/2004/n/fpga/src/decodisa/bch_decodisa.vhd
index 91a6bc9..be1d071 100644
--- a/2004/n/fpga/src/decodisa/bch_decodisa.vhd
+++ b/2004/n/fpga/src/decodisa/bch_decodisa.vhd
@@ -1,63 +1,77 @@
-
--- VHDL Test Bench Created from source file decodisa.vhd -- 02:25:56 03/17/2004
---
--- Notes:
--- This testbench has been automatically generated using types std_logic and
--- std_logic_vector for the ports of the unit under test. Xilinx recommends
--- that these types always be used for the top-level I/O of a design in order
--- to guarantee that the testbench will bind correctly to the post-implementation
--- simulation model.
---
-LIBRARY ieee;
-use ieee.std_logic_1164.all;
-use ieee.std_logic_arith.all;
-use ieee.std_logic_unsigned.all;
-
-ENTITY decodisa_bch IS
-END decodisa_bch;
-
-ARCHITECTURE behavior OF decodisa_bch IS
-
- COMPONENT decodisa
- PORT(
- adr_bus : IN std_logic_vector(23 downto 0);
- AEN : IN std_logic;
- IOR : IN std_logic;
- IOW : IN std_logic;
- cs : OUT std_logic_vector(255 downto 0);
- rw : OUT std_logic;
- clk : OUT std_logic
- );
- END COMPONENT;
-
- SIGNAL adr_bus : std_logic_vector(23 downto 0):=(others => '0');
- SIGNAL AEN : std_logic:='0';
- SIGNAL IORosc : std_logic:='0';
- SIGNAL IOWosc : std_logic:='0';
- SIGNAL IOR : std_logic:='0';
- SIGNAL IOW : std_logic:='0';
- SIGNAL cs : std_logic_vector(255 downto 0);
- SIGNAL rw : std_logic;
- SIGNAL clk : std_logic;
-
-BEGIN
-
- uut: decodisa PORT MAP(
- adr_bus => adr_bus,
- AEN => AEN,
- IOR => IOR,
- IOW => IOW,
- cs => cs,
- rw => rw,
- clk => clk
- );
-
-adr_bus <= conv_std_logic_vector(unsigned(adr_bus) + 1 , 24) after 120 ns;
-aen<= not aen after 13000 ns;
-iorosc<= not iorosc after 7000 ns;
-iowosc<= not iowosc after 5000 ns;
-
-ior<=not(iorosc and not aen);
-iow<=not(iowosc and not aen);
-
-END;
+-- bch_decodeur4.vhd
+-- Eurobot 2004 : APB Team
+-- Auteur : Pierre-André Galmes
+-- Test du decodeur4.
+
+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 bch_decodeur4 is
+end bch_decodeur4;
+
+architecture sim1 of bch_decodeur4 is
+
+ component decodeur4
+ generic (
+ -- adresses des différents registres du module.
+ A_REG0 : T_ADDRESS;
+ A_REG1 : T_ADDRESS;
+ A_REG2 : T_ADDRESS;
+ A_REG3 : T_ADDRESS
+ -- si autre choses à déclarer...
+ );
+ port (
+ -- TODO : utile la clock ?
+ --clk : in std_logic;
+ bus_address : in T_ADDRESS;
+ enable0 : out std_logic;
+ enable1 : out std_logic;
+ enable2 : out std_logic;
+ enable3 : out std_logic
+ );
+ end component;
+
+ -- définiton des signaux
+ --signal clk : std_logic := '0';
+ signal bus_address : T_ADDRESS;
+ signal enable0 : std_logic;
+ signal enable1 : std_logic;
+ signal enable2 : std_logic;
+ signal enable3 : std_logic;
+
+begin
+ U1 : decodeur4
+ generic map (
+ -- Définition des addresses.
+ A_REG0 => A_IO1_REG_DATA,
+ A_REG1 => A_IO1_REG_DIRECTION,
+ A_REG2 => A_IO1_REG_INTERRUPT_MASK,
+ A_REG3 => A_IO1_READ_OUTPUT
+ )
+ port map (
+ bus_address => bus_address,
+ enable0 => enable0,
+ enable1 => enable1,
+ enable2 => enable2,
+ enable3 => enable3
+ );
+
+ --clk <= not clk after (CK_PERIOD/2);
+ bus_address <= A_IO1_REG_DIRECTION,
+ A_IO1_READ_OUTPUT after 3*CK_PERIOD,
+ A_IO1_REG_INTERRUPT_MASK after 5*CK_PERIOD,
+ A_IO1_REG_DATA after 7*CK_PERIOD;
+end sim1;
+
+
+configuration cf1_bch_decodeur4 of bch_decodeur4 is
+ for sim1
+ for all : decodeur4 use entity work.decodeur4(RTL); end for;
+ end for;
+end cf1_bch_decodeur4;
+
diff --git a/2004/n/fpga/src/decodisa/decodisa.vhd b/2004/n/fpga/src/decodisa/decodisa.vhd
index e75005f..463e767 100644
--- a/2004/n/fpga/src/decodisa/decodisa.vhd
+++ b/2004/n/fpga/src/decodisa/decodisa.vhd
@@ -1,36 +1,61 @@
--- Décodeur de bus ISA pour le fpga robot
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.std_logic_unsigned.all;
-
-
-entity decodisa is
-generic(
- myISA_adress: integer :=1234;
- adr_bus_bit: integer :=10
- );
-port(
- ISA_clk: in std_logic;
- ISA_RW: in std_logic; -- 1=read 0=write
- ISA_adr_bus: in std_logic_vector(20 downto 0);
-
- clk: out std_logic;
- RW: out std_logic;
- adr_bus: out std_logic_vector(20 downto 0);
- );
-end entity;
-
-
---
-architecture rtl of decodisa is
-signal myAdr: std_logic_vector(10 downto 0) := conv_std_logic_vector(integer(myISA_adress));
-
-begin
-process(ISA_adr_bus)
- if(ISA_adr_bus=myAdr) then
- adr_bus<=ISA_adr_bus;
- else
- adr_bus<=(others <= '0');
- end if;
-end process;
-
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+use IEEE.STD_LOGIC_ARITH.ALL;
+use IEEE.STD_LOGIC_UNSIGNED.ALL;
+
+
+
+entity decodisa is
+port(
+ adr_bus: in std_logic_vector(23 downto 0);
+ AEN:in std_logic;
+ IOR:in std_logic;
+ IOW:in std_logic;
+
+ cs: out std_logic_vector(255 downto 0);
+ rw: out std_logic;
+ clk: out std_logic
+);
+constant adr_reseau:std_logic_vector:="0000000000000001";
+constant W_reseau:integer:=16;
+constant W_sous_reseau:integer:=8; -- Attention : si changement sur ces valeurs,=> modifier le core !!!
+end decodisa;
+
+architecture rtl of decodisa is
+
+component decodadr
+ port (
+ S: IN std_logic_VECTOR((W_sous_reseau-1) downto 0);
+ O: OUT std_logic_VECTOR(255 downto 0);
+ EN: IN std_logic);
+end component;
+
+component decodsig
+port(
+ AEN:in std_logic;
+ IOR:in std_logic;
+ IOW:in std_logic;
+ rw: out std_logic;
+ clk: out std_logic);
+end component;
+
+signal reg_select : std_logic;
+
+begin
+dsig:decodsig
+port map(
+ AEN=>AEN,
+ IOR=>IOR,
+ IOW=>IOW,
+ rw=>rw,
+ clk=>clk);
+
+dadrL:decodadr
+port map(
+ S=>adr_bus((W_sous_reseau - 1) downto 0),
+ O=>cs,
+ EN=>reg_select);
+
+reg_select<='1' when (adr_bus((W_reseau - 1) downto W_sous_reseau)=adr_reseau) else '0';
+
+end rtl;