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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib_helper/] [SerialPollCoordinator.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2
-- Entity: SerialPollCoordinator
3
-- Date:2011-11-03  
4
-- Author: Administrator     
5
--
6
-- Description ${cursor}
7
--------------------------------------------------------------------------------
8
library ieee;
9
use ieee.std_logic_1164.all;
10
use ieee.std_logic_unsigned.all;
11
 
12
 
13
library ieee;
14
use ieee.std_logic_1164.all;
15
use ieee.std_logic_unsigned.all;
16
 
17
entity SerialPollCoordinator is
18
        port (
19
                -- clock
20
                clk : in std_logic;
21
                -- reset
22
                reset : in std_logic;
23
                -- data accepted
24
                DAC : in std_logic;
25
                -- receive status byte
26
                rec_stb : in std_logic;
27
                -- attention in
28
                ATN_in : in std_logic;
29
                -- attention out
30
                ATN_out : out std_logic;
31
                -- output valid in
32
                output_valid_in : in std_logic;
33
                -- output valid out
34
                output_valid_out : out std_logic;
35
                -- stb received
36
                stb_received : out std_logic
37
        );
38
end SerialPollCoordinator;
39
 
40
architecture arch of SerialPollCoordinator is
41
 
42
        -- serial poll coordinator states
43
        type SPC_STATE is (
44
                ST_IDLE,
45
                ST_WAIT_DAC,
46
                ST_WAIT_REC_STB_0
47
        );
48
 
49
        signal current_state : SPC_STATE;
50
 
51
begin
52
 
53
        ATN_out <= '0' when current_state = ST_WAIT_DAC else ATN_in;
54
        output_valid_out <= '0' when current_state = ST_WAIT_DAC else output_valid_in;
55
        stb_received <= '1' when current_state = ST_WAIT_REC_STB_0 else '0';
56
 
57
        process (clk, reset) begin
58
                if reset = '1' then
59
                        current_state <= ST_IDLE;
60
                elsif rising_edge(clk) then
61
                        case current_state is
62
                                when ST_IDLE =>
63
                                        if rec_stb='1' then
64
                                                current_state <= ST_WAIT_DAC;
65
                                        end if;
66
                                when ST_WAIT_DAC =>
67
                                        if DAC='1' then
68
                                                current_state <= ST_WAIT_REC_STB_0;
69
                                        elsif rec_stb='0' then
70
                                                current_state <= ST_IDLE;
71
                                        end if;
72
                                when ST_WAIT_REC_STB_0 =>
73
                                        if rec_stb='0' then
74
                                                current_state <= ST_IDLE;
75
                                        end if;
76
                                when others =>
77
                                        current_state <= ST_IDLE;
78
                        end case;
79
                end if;
80
        end process;
81
 
82
end arch;
83
 

powered by: WebSVN 2.1.0

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