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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [if_func_RL.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 Andrewski
--------------------------------------------------------------------------------
2
--This file is part of fpga_gpib_controller.
3
--
4
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
--
9
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
 
14
-- You should have received a copy of the GNU General Public License
15
-- along with Fpga_gpib_controller.  If not, see <http://www.gnu.org/licenses/>.
16 3 Andrewski
----------------------------------------------------------------------------------
17 13 Andrewski
-- Author: Andrzej Paluch
18 3 Andrewski
-- 
19
-- Create Date:    01:04:57 10/03/2011 
20
-- Design Name: 
21
-- Module Name:    if_func_RL - Behavioral 
22
-- Project Name: 
23
-- Target Devices: 
24
-- Tool versions: 
25
-- Description: 
26
--
27
-- Dependencies: 
28
--
29
-- Revision: 
30
-- Revision 0.01 - File Created
31
-- Additional Comments: 
32
--
33
----------------------------------------------------------------------------------
34
library IEEE;
35
use IEEE.STD_LOGIC_1164.ALL;
36
 
37
use work.utilPkg.all;
38
 
39
 
40
entity if_func_RL is
41
        port(
42
                -- device inputs
43
                clk : in std_logic; -- clock
44
                pon : in std_logic; -- power on
45
                rtl : in std_logic; -- return to local
46
                -- state inputs
47
                ACDS : in std_logic; -- listener active state (AH)
48
                LADS : in std_logic; -- listener addressed state (L or LE)
49
                -- instructions
50
                REN : in std_logic; -- remote enable
51
                LLO : in std_logic; -- local lockout
52
                MLA : in std_logic; -- my listen address
53
                GTL : in std_logic; -- go to local
54
                -- reported state
55
                LOCS : out std_logic; -- local state
56
                LWLS : out std_logic -- local with lockout state
57
        );
58
end if_func_RL;
59
 
60
architecture Behavioral of if_func_RL is
61
 
62
        -- states
63
        type RL_STATE is (
64
                -- local state
65
                ST_LOCS,
66
                -- remote state
67
                ST_REMS,
68
                -- local with lockout state
69
                ST_LWLS,
70
                -- remote with lockout state
71
                ST_RWLS
72
        );
73
 
74
        -- current state
75
        signal current_state : RL_STATE;
76
 
77
        -- events
78
        signal event0, event1, event2, event3, event4, event5 : boolean;
79
 
80
 
81
begin
82
        -- state machine process
83
        process(pon, clk) begin
84
                if pon = '1' then
85
                        current_state <= ST_LOCS;
86
                elsif rising_edge(clk) then
87
                        case current_state is
88
                                ------------------
89
                                when ST_LOCS =>
90
                                        if event0 then
91
                                                -- no state change
92
                                        elsif event1 then
93
                                                current_state <= ST_REMS;
94
                                        elsif event3 then
95
                                                current_state <= ST_LWLS;
96
                                        end if;
97
                                ------------------
98
                                when ST_REMS =>
99
                                        if event0 then
100
                                                current_state <= ST_LOCS;
101
                                        elsif event2 then
102
                                                current_state <= ST_LOCS;
103
                                        elsif event3 then
104
                                                current_state <= ST_RWLS;
105
                                        end if;
106
                                ------------------
107
                                when ST_RWLS =>
108
                                        if event0 then
109
                                                current_state <= ST_LOCS;
110
                                        elsif event5 then
111
                                                current_state <= ST_LWLS;
112
                                        end if;
113
                                ------------------
114
                                when ST_LWLS =>
115
                                        if event0 then
116
                                                current_state <= ST_LOCS;
117
                                        elsif event4 then
118
                                                current_state <= ST_RWLS;
119
                                        end if;
120
                                ------------------
121
                                when others =>
122
                                        current_state <= ST_LOCS;
123
                        end case;
124
                end if;
125
        end process;
126
 
127
        -- events
128
        event0 <= REN='0';
129
        event1 <= rtl='0' and MLA='1' and ACDS='1';
130
        event2 <=
131
                (GTL='1' and LADS='1' and ACDS='1') or
132
                (rtl='1' and not(LLO='1' and ACDS='1'));
133
        event3 <= LLO='1' and ACDS='1';
134
        event4 <= MLA='1' and ACDS='1';
135
        event5 <= GTL='1' and LADS='1' and ACDS='1';
136
 
137
        -- reported states
138
        LOCS <= to_stdl(current_state = ST_LOCS);
139
        LWLS <= to_stdl(current_state = ST_LWLS);
140
 
141
end Behavioral;
142
 

powered by: WebSVN 2.1.0

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