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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib_helper/] [SerialPollCoordinator.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: SerialPollCoordinator
-- Entity: SerialPollCoordinator
-- Date:2011-11-03  
-- Date:2011-11-03  
-- Author: Administrator     
-- Author: Andrzej Paluch
--
--
-- Description ${cursor}
-- Description ${cursor}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
 
 
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
 
 
entity SerialPollCoordinator is
entity SerialPollCoordinator is
        port (
        port (
                -- clock
                -- clock
                clk : in std_logic;
                clk : in std_logic;
                -- reset
                -- reset
                reset : in std_logic;
                reset : in std_logic;
                -- data accepted
                -- data accepted
                DAC : in std_logic;
                DAC : in std_logic;
                -- receive status byte
                -- receive status byte
                rec_stb : in std_logic;
                rec_stb : in std_logic;
                -- attention in
                -- attention in
                ATN_in : in std_logic;
                ATN_in : in std_logic;
                -- attention out
                -- attention out
                ATN_out : out std_logic;
                ATN_out : out std_logic;
                -- output valid in
                -- output valid in
                output_valid_in : in std_logic;
                output_valid_in : in std_logic;
                -- output valid out
                -- output valid out
                output_valid_out : out std_logic;
                output_valid_out : out std_logic;
                -- stb received
                -- stb received
                stb_received : out std_logic
                stb_received : out std_logic
        );
        );
end SerialPollCoordinator;
end SerialPollCoordinator;
 
 
architecture arch of SerialPollCoordinator is
architecture arch of SerialPollCoordinator is
 
 
        -- serial poll coordinator states
        -- serial poll coordinator states
        type SPC_STATE is (
        type SPC_STATE is (
                ST_IDLE,
                ST_IDLE,
                ST_WAIT_DAC,
                ST_WAIT_DAC,
                ST_WAIT_REC_STB_0
                ST_WAIT_REC_STB_0
        );
        );
 
 
        signal current_state : SPC_STATE;
        signal current_state : SPC_STATE;
 
 
begin
begin
 
 
        ATN_out <= '0' when current_state = ST_WAIT_DAC else ATN_in;
        ATN_out <= '0' when current_state = ST_WAIT_DAC else ATN_in;
        output_valid_out <= '0' when current_state = ST_WAIT_DAC else output_valid_in;
        output_valid_out <= '0' when current_state = ST_WAIT_DAC else output_valid_in;
        stb_received <= '1' when current_state = ST_WAIT_REC_STB_0 else '0';
        stb_received <= '1' when current_state = ST_WAIT_REC_STB_0 else '0';
 
 
        process (clk, reset) begin
        process (clk, reset) begin
                if reset = '1' then
                if reset = '1' then
                        current_state <= ST_IDLE;
                        current_state <= ST_IDLE;
                elsif rising_edge(clk) then
                elsif rising_edge(clk) then
                        case current_state is
                        case current_state is
                                when ST_IDLE =>
                                when ST_IDLE =>
                                        if rec_stb='1' then
                                        if rec_stb='1' then
                                                current_state <= ST_WAIT_DAC;
                                                current_state <= ST_WAIT_DAC;
                                        end if;
                                        end if;
                                when ST_WAIT_DAC =>
                                when ST_WAIT_DAC =>
                                        if DAC='1' then
                                        if DAC='1' then
                                                current_state <= ST_WAIT_REC_STB_0;
                                                current_state <= ST_WAIT_REC_STB_0;
                                        elsif rec_stb='0' then
                                        elsif rec_stb='0' then
                                                current_state <= ST_IDLE;
                                                current_state <= ST_IDLE;
                                        end if;
                                        end if;
                                when ST_WAIT_REC_STB_0 =>
                                when ST_WAIT_REC_STB_0 =>
                                        if rec_stb='0' then
                                        if rec_stb='0' then
                                                current_state <= ST_IDLE;
                                                current_state <= ST_IDLE;
                                        end if;
                                        end if;
                                when others =>
                                when others =>
                                        current_state <= ST_IDLE;
                                        current_state <= ST_IDLE;
                        end case;
                        end case;
                end if;
                end if;
        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.