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 3

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

Line No. Rev Author Line
1 3 Andrewski
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    01:04:57 10/03/2011 
6
-- Design Name: 
7
-- Module Name:    if_func_RL - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
use work.utilPkg.all;
24
 
25
 
26
entity if_func_RL is
27
        port(
28
                -- device inputs
29
                clk : in std_logic; -- clock
30
                pon : in std_logic; -- power on
31
                rtl : in std_logic; -- return to local
32
                -- state inputs
33
                ACDS : in std_logic; -- listener active state (AH)
34
                LADS : in std_logic; -- listener addressed state (L or LE)
35
                -- instructions
36
                REN : in std_logic; -- remote enable
37
                LLO : in std_logic; -- local lockout
38
                MLA : in std_logic; -- my listen address
39
                GTL : in std_logic; -- go to local
40
                -- reported state
41
                LOCS : out std_logic; -- local state
42
                LWLS : out std_logic -- local with lockout state
43
        );
44
end if_func_RL;
45
 
46
architecture Behavioral of if_func_RL is
47
 
48
        -- states
49
        type RL_STATE is (
50
                -- local state
51
                ST_LOCS,
52
                -- remote state
53
                ST_REMS,
54
                -- local with lockout state
55
                ST_LWLS,
56
                -- remote with lockout state
57
                ST_RWLS
58
        );
59
 
60
        -- current state
61
        signal current_state : RL_STATE;
62
 
63
        -- events
64
        signal event0, event1, event2, event3, event4, event5 : boolean;
65
 
66
 
67
begin
68
        -- state machine process
69
        process(pon, clk) begin
70
                if pon = '1' then
71
                        current_state <= ST_LOCS;
72
                elsif rising_edge(clk) then
73
                        case current_state is
74
                                ------------------
75
                                when ST_LOCS =>
76
                                        if event0 then
77
                                                -- no state change
78
                                        elsif event1 then
79
                                                current_state <= ST_REMS;
80
                                        elsif event3 then
81
                                                current_state <= ST_LWLS;
82
                                        end if;
83
                                ------------------
84
                                when ST_REMS =>
85
                                        if event0 then
86
                                                current_state <= ST_LOCS;
87
                                        elsif event2 then
88
                                                current_state <= ST_LOCS;
89
                                        elsif event3 then
90
                                                current_state <= ST_RWLS;
91
                                        end if;
92
                                ------------------
93
                                when ST_RWLS =>
94
                                        if event0 then
95
                                                current_state <= ST_LOCS;
96
                                        elsif event5 then
97
                                                current_state <= ST_LWLS;
98
                                        end if;
99
                                ------------------
100
                                when ST_LWLS =>
101
                                        if event0 then
102
                                                current_state <= ST_LOCS;
103
                                        elsif event4 then
104
                                                current_state <= ST_RWLS;
105
                                        end if;
106
                                ------------------
107
                                when others =>
108
                                        current_state <= ST_LOCS;
109
                        end case;
110
                end if;
111
        end process;
112
 
113
        -- events
114
        event0 <= REN='0';
115
        event1 <= rtl='0' and MLA='1' and ACDS='1';
116
        event2 <=
117
                (GTL='1' and LADS='1' and ACDS='1') or
118
                (rtl='1' and not(LLO='1' and ACDS='1'));
119
        event3 <= LLO='1' and ACDS='1';
120
        event4 <= MLA='1' and ACDS='1';
121
        event5 <= GTL='1' and LADS='1' and ACDS='1';
122
 
123
        -- reported states
124
        LOCS <= to_stdl(current_state = ST_LOCS);
125
        LWLS <= to_stdl(current_state = ST_LWLS);
126
 
127
end Behavioral;
128
 

powered by: WebSVN 2.1.0

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