OpenCores
URL https://opencores.org/ocsvn/gpib_controller/gpib_controller/trunk

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [commandDecoder.vhd] - Diff between revs 3 and 13

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 13
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
 
--This file is part of fpga_gpib_controller.
 
--
 
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
 
-- it under the terms of the GNU General Public License as published by
 
-- the Free Software Foundation, either version 3 of the License, or
 
-- (at your option) any later version.
 
--
 
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
 
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
-- GNU General Public License for more details.
 
 
 
-- You should have received a copy of the GNU General Public License
 
-- along with Fpga_gpib_controller.  If not, see <http://www.gnu.org/licenses/>.
 
--------------------------------------------------------------------------------
-- Entity: commandDecoder
-- Entity: commandDecoder
-- Date:2011-10-07  
-- Date:2011-10-07  
-- Author: apaluch
-- Author: Andrzej Paluch
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
library ieee;
library ieee;
 
 
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
 
 
use work.utilPkg.all;
use work.utilPkg.all;
 
 
 
 
entity commandDecoder is
entity commandDecoder is
        port (
        port (
 
 
                -------------------------------------------
                -------------------------------------------
                -- data lines -----------------------------
                -- data lines -----------------------------
                -------------------------------------------
                -------------------------------------------
                DI : in std_logic_vector (7 downto 0);
                DI : in std_logic_vector (7 downto 0);
 
 
                -------------------------------------------
                -------------------------------------------
                -- control lines --------------------------
                -- control lines --------------------------
                -------------------------------------------
                -------------------------------------------
                -- DAV line
                -- DAV line
                DAV_line : in std_logic;
                DAV_line : in std_logic;
                -- NRFD line
                -- NRFD line
                NRFD_line : in std_logic;
                NRFD_line : in std_logic;
                -- NDAC line
                -- NDAC line
                NDAC_line : in std_logic;
                NDAC_line : in std_logic;
                -- ATN line
                -- ATN line
                ATN_line : in std_logic;
                ATN_line : in std_logic;
                -- EOI line
                -- EOI line
                EOI_line : in std_logic;
                EOI_line : in std_logic;
                -- SRQ line
                -- SRQ line
                SRQ_line : in std_logic;
                SRQ_line : in std_logic;
                -- IFC line
                -- IFC line
                IFC_line : in std_logic;
                IFC_line : in std_logic;
                -- REN line
                -- REN line
                REN_line : in std_logic;
                REN_line : in std_logic;
 
 
                -------------------------------------------
                -------------------------------------------
                -- internal settiongs ---------------------
                -- internal settiongs ---------------------
                -------------------------------------------
                -------------------------------------------
                -- eos mark
                -- eos mark
                eosMark : in std_logic_vector (7 downto 0);
                eosMark : in std_logic_vector (7 downto 0);
                -- eos used
                -- eos used
                eosUsed : in std_logic;
                eosUsed : in std_logic;
                -- my listen address
                -- my listen address
                myListAddr : in std_logic_vector (4 downto 0);
                myListAddr : in std_logic_vector (4 downto 0);
                -- my talk address
                -- my talk address
                myTalkAddr : in std_logic_vector (4 downto 0);
                myTalkAddr : in std_logic_vector (4 downto 0);
                -- secondary address detected
                -- secondary address detected
                secAddrDetected : in std_logic;
                secAddrDetected : in std_logic;
 
 
                -------------------------------------------
                -------------------------------------------
                -- internal states ------------------------
                -- internal states ------------------------
                -------------------------------------------
                -------------------------------------------
                -- serial poll active state (T or TE)
                -- serial poll active state (T or TE)
                SPAS : in std_logic;
                SPAS : in std_logic;
 
 
                -------------------------------------------
                -------------------------------------------
                -- single line commands -------------------
                -- single line commands -------------------
                -------------------------------------------
                -------------------------------------------
                -- attention
                -- attention
                ATN : out std_logic;
                ATN : out std_logic;
                -- data accepted
                -- data accepted
                DAC : out std_logic;
                DAC : out std_logic;
                -- data valid
                -- data valid
                DAV : out std_logic;
                DAV : out std_logic;
                -- end
                -- end
                END_c : out std_logic;
                END_c : out std_logic;
                -- identify
                -- identify
                IDY : out std_logic;
                IDY : out std_logic;
                -- interface clear
                -- interface clear
                IFC : out std_logic;
                IFC : out std_logic;
                -- remote enable
                -- remote enable
                REN : out std_logic;
                REN : out std_logic;
                -- ready for data
                -- ready for data
                RFD : out std_logic;
                RFD : out std_logic;
                -- service request
                -- service request
                SRQ : out std_logic;
                SRQ : out std_logic;
 
 
                -------------------------------------------
                -------------------------------------------
                -- multi line commands --------------------
                -- multi line commands --------------------
                -------------------------------------------
                -------------------------------------------
                -- addressed command group
                -- addressed command group
                ACG : out std_logic;
                ACG : out std_logic;
                -- data byte
                -- data byte
                DAB : out std_logic;
                DAB : out std_logic;
                -- device clear
                -- device clear
                DCL : out std_logic;
                DCL : out std_logic;
                -- end of string
                -- end of string
                EOS : out std_logic;
                EOS : out std_logic;
                -- group execute trigger
                -- group execute trigger
                GET : out std_logic;
                GET : out std_logic;
                -- go to local
                -- go to local
                GTL : out std_logic;
                GTL : out std_logic;
                -- listen address group
                -- listen address group
                LAG : out std_logic;
                LAG : out std_logic;
                -- local lockout
                -- local lockout
                LLO : out std_logic;
                LLO : out std_logic;
                -- my listen address
                -- my listen address
                MLA : out std_logic;
                MLA : out std_logic;
                -- my talk address
                -- my talk address
                MTA : out std_logic;
                MTA : out std_logic;
                -- my secondary address
                -- my secondary address
                MSA : out std_logic;
                MSA : out std_logic;
                -- null byte
                -- null byte
                NUL : out std_logic;
                NUL : out std_logic;
                -- other secondary address
                -- other secondary address
                OSA : out std_logic;
                OSA : out std_logic;
                -- other talk address
                -- other talk address
                OTA : out std_logic;
                OTA : out std_logic;
                -- primary command group
                -- primary command group
                PCG : out std_logic;
                PCG : out std_logic;
                -- parallel poll configure
                -- parallel poll configure
                PPC : out std_logic;
                PPC : out std_logic;
                -- parallel poll enable
                -- parallel poll enable
                PPE : out std_logic;
                PPE : out std_logic;
                -- parallel poll disable
                -- parallel poll disable
                PPD : out std_logic;
                PPD : out std_logic;
                -- parallel poll response
                -- parallel poll response
                PPR : out std_logic;
                PPR : out std_logic;
                -- parallel poll unconfigure
                -- parallel poll unconfigure
                PPU : out std_logic;
                PPU : out std_logic;
                -- request service
                -- request service
                RQS : out std_logic;
                RQS : out std_logic;
                -- secondary command group
                -- secondary command group
                SCG : out std_logic;
                SCG : out std_logic;
                -- selected device clear
                -- selected device clear
                SDC : out std_logic;
                SDC : out std_logic;
                -- serial poll disable
                -- serial poll disable
                SPD : out std_logic;
                SPD : out std_logic;
                -- serial poll enable
                -- serial poll enable
                SPE : out std_logic;
                SPE : out std_logic;
                -- status byte
                -- status byte
                STB : out std_logic;
                STB : out std_logic;
                -- talk address group
                -- talk address group
                TAG : out std_logic;
                TAG : out std_logic;
                -- take control
                -- take control
                TCT : out std_logic;
                TCT : out std_logic;
                -- universal command group
                -- universal command group
                UCG : out std_logic;
                UCG : out std_logic;
                -- unlisten
                -- unlisten
                UNL : out std_logic;
                UNL : out std_logic;
                -- untalk
                -- untalk
                UNT : out std_logic
                UNT : out std_logic
        );
        );
end commandDecoder;
end commandDecoder;
 
 
architecture arch of commandDecoder is
architecture arch of commandDecoder is
 
 
        signal ATN_int, IDY_int : std_logic;
        signal ATN_int, IDY_int : std_logic;
        signal SCG_int, MSA_int, TAG_int, MTA_int, ACG_int, UCG_int,
        signal SCG_int, MSA_int, TAG_int, MTA_int, ACG_int, UCG_int,
                LAG_int, STB_int : std_logic;
                LAG_int, STB_int : std_logic;
 
 
begin
begin
 
 
        --------------------------------------
        --------------------------------------
        -- single line
        -- single line
        --------------------------------------
        --------------------------------------
        ATN_int <= ATN_line;
        ATN_int <= ATN_line;
        ATN <= ATN_int;
        ATN <= ATN_int;
        ----------------------
        ----------------------
        DAC <= not NDAC_line;
        DAC <= not NDAC_line;
        ----------------------
        ----------------------
        DAV <= DAV_line;
        DAV <= DAV_line;
        ----------------------
        ----------------------
        END_c <= not ATN_line and EOI_line;
        END_c <= not ATN_line and EOI_line;
        ----------------------
        ----------------------
        IDY_int <= ATN_line and EOI_line;
        IDY_int <= ATN_line and EOI_line;
        IDY <= IDY_int;
        IDY <= IDY_int;
        ----------------------
        ----------------------
        IFC <= IFC_line;
        IFC <= IFC_line;
        ----------------------
        ----------------------
        REN <= REN_line;
        REN <= REN_line;
        ----------------------
        ----------------------
        RFD <= not NRFD_line;
        RFD <= not NRFD_line;
        ----------------------
        ----------------------
        SRQ <= SRQ_line;
        SRQ <= SRQ_line;
 
 
        ---------------------------------------
        ---------------------------------------
        -- multiple line
        -- multiple line
        ---------------------------------------
        ---------------------------------------
        ACG_int <= ATN_int and to_stdl(DI(6 downto 4) = "000");
        ACG_int <= ATN_int and to_stdl(DI(6 downto 4) = "000");
        ACG <= ACG_int;
        ACG <= ACG_int;
        ---------------------------------------
        ---------------------------------------
        DAB <= not ATN_int and ((eosUsed and to_stdl(DI /= eosMark)) or not eosUsed);
        DAB <= not ATN_int and ((eosUsed and to_stdl(DI /= eosMark)) or not eosUsed);
        ---------------------------------------
        ---------------------------------------
        DCL <= ATN_int and to_stdl(DI(6 downto 0) = "0010100");
        DCL <= ATN_int and to_stdl(DI(6 downto 0) = "0010100");
        ---------------------------------------
        ---------------------------------------
        EOS <= not ATN_int and eosUsed and to_stdl(DI = eosMark);
        EOS <= not ATN_int and eosUsed and to_stdl(DI = eosMark);
        ---------------------------------------
        ---------------------------------------
        GET <= ATN_int and to_stdl(DI(6 downto 0) = "0001000");
        GET <= ATN_int and to_stdl(DI(6 downto 0) = "0001000");
        ---------------------------------------
        ---------------------------------------
        GTL <= ATN_int and to_stdl(DI(6 downto 0) = "0000001");
        GTL <= ATN_int and to_stdl(DI(6 downto 0) = "0000001");
        ---------------------------------------
        ---------------------------------------
        LAG_int <= ATN_int and to_stdl(DI(6 downto 5) = "01");
        LAG_int <= ATN_int and to_stdl(DI(6 downto 5) = "01");
        LAG <= LAG_int;
        LAG <= LAG_int;
        ---------------------------------------
        ---------------------------------------
        LLO <= ATN_int and to_stdl(DI(6 downto 0) = "0010001");
        LLO <= ATN_int and to_stdl(DI(6 downto 0) = "0010001");
        ---------------------------------------
        ---------------------------------------
        MLA <= LAG_int and to_stdl(DI(4 downto 0) = myListAddr);
        MLA <= LAG_int and to_stdl(DI(4 downto 0) = myListAddr);
        ---------------------------------------
        ---------------------------------------
        MTA_int <= TAG_int and to_stdl(DI(4 downto 0) = myTalkAddr);
        MTA_int <= TAG_int and to_stdl(DI(4 downto 0) = myTalkAddr);
        MTA <= MTA_int;
        MTA <= MTA_int;
        ---------------------------------------
        ---------------------------------------
        MSA_int <= SCG_int and secAddrDetected;
        MSA_int <= SCG_int and secAddrDetected;
        MSA <= MSA_int;
        MSA <= MSA_int;
        ---------------------------------------
        ---------------------------------------
        NUL <= ATN_int and to_stdl(DI = "00000000");
        NUL <= ATN_int and to_stdl(DI = "00000000");
        ---------------------------------------
        ---------------------------------------
        OSA <= SCG_int and not MSA_int;
        OSA <= SCG_int and not MSA_int;
        ---------------------------------------
        ---------------------------------------
        OTA <= TAG_int and not MTA_int;
        OTA <= TAG_int and not MTA_int;
        ---------------------------------------
        ---------------------------------------
        PCG <= ACG_int or UCG_int or LAG_int or TAG_int;
        PCG <= ACG_int or UCG_int or LAG_int or TAG_int;
        ---------------------------------------
        ---------------------------------------
        PPC <= ATN_int and to_stdl(DI(6 downto 0) = "0000101");
        PPC <= ATN_int and to_stdl(DI(6 downto 0) = "0000101");
        ---------------------------------------
        ---------------------------------------
        PPE <= ATN_int and to_stdl(DI(6 downto 4) = "110");
        PPE <= ATN_int and to_stdl(DI(6 downto 4) = "110");
        ---------------------------------------
        ---------------------------------------
        PPD <= ATN_int and to_stdl(DI(6 downto 4) = "111"); -- "-1110000" ?
        PPD <= ATN_int and to_stdl(DI(6 downto 4) = "111"); -- "-1110000" ?
        ---------------------------------------
        ---------------------------------------
        PPR <= ATN_int and IDY_int;
        PPR <= ATN_int and IDY_int;
        ---------------------------------------
        ---------------------------------------
        PPU <= ATN_int and to_stdl(DI(6 downto 0) = "0010101");
        PPU <= ATN_int and to_stdl(DI(6 downto 0) = "0010101");
        ---------------------------------------
        ---------------------------------------
        RQS <= STB_int and to_stdl(DI(6) = '1');
        RQS <= STB_int and to_stdl(DI(6) = '1');
        ---------------------------------------
        ---------------------------------------
        SCG_int <= ATN_int and to_stdl(DI(6 downto 5) = "11");
        SCG_int <= ATN_int and to_stdl(DI(6 downto 5) = "11");
        SCG <= SCG_int;
        SCG <= SCG_int;
        ---------------------------------------
        ---------------------------------------
        SDC <= ATN_int and to_stdl(DI(6 downto 0) = "0000100");
        SDC <= ATN_int and to_stdl(DI(6 downto 0) = "0000100");
        ---------------------------------------
        ---------------------------------------
        SPD <= ATN_int and to_stdl(DI(6 downto 0) = "0011001");
        SPD <= ATN_int and to_stdl(DI(6 downto 0) = "0011001");
        ---------------------------------------
        ---------------------------------------
        SPE <= ATN_int and to_stdl(DI(6 downto 0) = "0011000");
        SPE <= ATN_int and to_stdl(DI(6 downto 0) = "0011000");
        ---------------------------------------
        ---------------------------------------
        STB_int <= not ATN_int and SPAS;
        STB_int <= not ATN_int and SPAS;
        STB <= STB_int;
        STB <= STB_int;
        ---------------------------------------
        ---------------------------------------
        TAG_int <= ATN_int and to_stdl(DI(6 downto 5) = "10");
        TAG_int <= ATN_int and to_stdl(DI(6 downto 5) = "10");
        TAG <= TAG_int;
        TAG <= TAG_int;
        ---------------------------------------
        ---------------------------------------
        TCT <= ATN_int and to_stdl(DI(6 downto 0) = "0001001");
        TCT <= ATN_int and to_stdl(DI(6 downto 0) = "0001001");
        ---------------------------------------
        ---------------------------------------
        UCG_int <= ATN_int and to_stdl(DI(6 downto 4) = "001");
        UCG_int <= ATN_int and to_stdl(DI(6 downto 4) = "001");
        UCG <= UCG_int;
        UCG <= UCG_int;
        ---------------------------------------
        ---------------------------------------
        UNL <= ATN_int and to_stdl(DI(6 downto 0) = "0111111");
        UNL <= ATN_int and to_stdl(DI(6 downto 0) = "0111111");
        ---------------------------------------
        ---------------------------------------
        UNT <= ATN_int and to_stdl(DI(6 downto 0) = "1011111");
        UNT <= ATN_int and to_stdl(DI(6 downto 0) = "1011111");
 
 
end arch;
end arch;
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.