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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [commandEncoder.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:      if_func_C
-- Entity:      if_func_C
-- Date:        23:00:30 10/04/2011
-- Date:        23:00:30 10/04/2011
-- 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 commandEcoder is
entity commandEcoder is
        port (
        port (
                -- data
                -- data
                data : in std_logic_vector (7 downto 0);
                data : in std_logic_vector (7 downto 0);
                -- status byte
                -- status byte
                status_byte : in std_logic_vector (7 downto 0);
                status_byte : in std_logic_vector (7 downto 0);
                -- PPR command data
                -- PPR command data
                ppBitValue : in std_logic;
                ppBitValue : in std_logic;
                ppLineNumber : in std_logic_vector (2 downto 0);
                ppLineNumber : in std_logic_vector (2 downto 0);
                -- func states
                -- func states
                APRS : in std_logic; -- affirmative poll response state
                APRS : in std_logic; -- affirmative poll response state
                CACS : in std_logic; -- controller active state (C)
                CACS : in std_logic; -- controller active state (C)
                -- commands
                -- commands
                ATN : in std_logic;
                ATN : in std_logic;
                END_OF : in std_logic;
                END_OF : in std_logic;
                IDY : in std_logic;
                IDY : in std_logic;
                DAC : in std_logic;
                DAC : in std_logic;
                RFD : in std_logic;
                RFD : in std_logic;
                DAV : in std_logic;
                DAV : in std_logic;
                IFC : in std_logic;
                IFC : in std_logic;
                REN : in std_logic;
                REN : in std_logic;
                SRQ : in std_logic; -- request for service
                SRQ : in std_logic; -- request for service
                DAB : in std_logic;
                DAB : in std_logic;
                EOS : in std_logic;
                EOS : in std_logic;
                RQS : in std_logic; -- part of STB
                RQS : in std_logic; -- part of STB
                STB : in std_logic;
                STB : in std_logic;
                TCT : in std_logic;
                TCT : in std_logic;
                PPR : in std_logic;
                PPR : in std_logic;
                -------------------------------------------
                -------------------------------------------
                -- data lines -----------------------------
                -- data lines -----------------------------
                -------------------------------------------
                -------------------------------------------
                DO : out std_logic_vector (7 downto 0);
                DO : out std_logic_vector (7 downto 0);
                output_valid : out std_logic;
                output_valid : out std_logic;
                -------------------------------------------
                -------------------------------------------
                -- control lines --------------------------
                -- control lines --------------------------
                -------------------------------------------
                -------------------------------------------
                -- DAV line
                -- DAV line
                DAV_line : out std_logic;
                DAV_line : out std_logic;
                -- NRFD line
                -- NRFD line
                NRFD_line : out std_logic;
                NRFD_line : out std_logic;
                -- NDAC line
                -- NDAC line
                NDAC_line : out std_logic;
                NDAC_line : out std_logic;
                -- ATN line
                -- ATN line
                ATN_line : out std_logic;
                ATN_line : out std_logic;
                -- EOI line
                -- EOI line
                EOI_line : out std_logic;
                EOI_line : out std_logic;
                -- SRQ line
                -- SRQ line
                SRQ_line : out std_logic;
                SRQ_line : out std_logic;
                -- IFC line
                -- IFC line
                IFC_line : out std_logic;
                IFC_line : out std_logic;
                -- REN line
                -- REN line
                REN_line : out std_logic
                REN_line : out std_logic
        );
        );
end commandEcoder;
end commandEcoder;
 
 
architecture arch of commandEcoder is
architecture arch of commandEcoder is
 
 
        signal modified_status_byte : std_logic_vector (7 downto 0);
        signal modified_status_byte : std_logic_vector (7 downto 0);
        signal PPR_resp : std_logic_vector (7 downto 0);
        signal PPR_resp : std_logic_vector (7 downto 0);
 
 
begin
begin
 
 
        ATN_line <= (ATN or IDY) and not END_OF;
        ATN_line <= (ATN or IDY) and not END_OF;
        EOI_line <= END_OF or IDY;
        EOI_line <= END_OF or IDY;
        DAV_line <= DAV;
        DAV_line <= DAV;
        NRFD_line <= not RFD;
        NRFD_line <= not RFD;
        NDAC_line <= not DAC;
        NDAC_line <= not DAC;
        SRQ_line <= SRQ;
        SRQ_line <= SRQ;
        IFC_line <= IFC;
        IFC_line <= IFC;
        REN_line <= REN;
        REN_line <= REN;
 
 
        output_valid <= STB or DAB or EOS or TCT or PPR or CACS;
        output_valid <= STB or DAB or EOS or TCT or PPR or CACS;
 
 
        DO <=
        DO <=
                data when DAB='1' or EOS='1' or CACS='1' else
                data when DAB='1' or EOS='1' or CACS='1' else
                "00001001" when TCT='1' else
                "00001001" when TCT='1' else
                PPR_resp when PPR='1' else
                PPR_resp when PPR='1' else
                modified_status_byte when STB='1' else
                modified_status_byte when STB='1' else
                "00000000";
                "00000000";
 
 
        -- modifies status byte
        -- modifies status byte
        process (status_byte, APRS) begin
        process (status_byte, APRS) begin
                modified_status_byte <= status_byte;
                modified_status_byte <= status_byte;
                modified_status_byte(6) <= APRS;
                modified_status_byte(6) <= APRS;
        end process;
        end process;
 
 
        -- sets PPR response
        -- sets PPR response
        process (ppBitValue, ppLineNumber) begin
        process (ppBitValue, ppLineNumber) begin
 
 
                PPR_resp <= "00000000";
                PPR_resp <= "00000000";
 
 
                case ppLineNumber is
                case ppLineNumber is
                        ------------------
                        ------------------
                        when "000" =>
                        when "000" =>
                                PPR_resp(0) <= ppBitValue;
                                PPR_resp(0) <= ppBitValue;
                        ------------------
                        ------------------
                        when "001" =>
                        when "001" =>
                                PPR_resp(1) <= ppBitValue;
                                PPR_resp(1) <= ppBitValue;
                        ------------------
                        ------------------
                        when "010" =>
                        when "010" =>
                                PPR_resp(2) <= ppBitValue;
                                PPR_resp(2) <= ppBitValue;
                        ------------------
                        ------------------
                        when "011" =>
                        when "011" =>
                                PPR_resp(3) <= ppBitValue;
                                PPR_resp(3) <= ppBitValue;
                        ------------------
                        ------------------
                        when "100" =>
                        when "100" =>
                                PPR_resp(4) <= ppBitValue;
                                PPR_resp(4) <= ppBitValue;
                        ------------------
                        ------------------
                        when "101" =>
                        when "101" =>
                                PPR_resp(5) <= ppBitValue;
                                PPR_resp(5) <= ppBitValue;
                        ------------------
                        ------------------
                        when "110" =>
                        when "110" =>
                                PPR_resp(6) <= ppBitValue;
                                PPR_resp(6) <= ppBitValue;
                        ------------------
                        ------------------
                        when others =>
                        when others =>
                                PPR_resp(7) <= ppBitValue;
                                PPR_resp(7) <= ppBitValue;
                end case;
                end case;
        end process;
        end process;
 
 
end arch;
end arch;
 
 
 
 

powered by: WebSVN 2.1.0

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