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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [if_func_PP.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_PP - 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
entity if_func_PP is
40
        port(
41
                -- device inputs
42
                clk : in std_logic; -- clock
43
                -- settings
44
                lpeUsed : std_logic;
45
                fixedPpLine : in std_logic_vector (2 downto 0);
46
                -- local commands
47
                pon : in std_logic; -- power on
48
                lpe : in std_logic; -- local poll enable
49
                ist : in std_logic; -- individual status
50
                -- state inputs
51
                ACDS : in std_logic; -- accept data state
52
                LADS : in std_logic; -- listener address state (L or LE)
53
                -- data input
54
                dio_data : in std_logic_vector(3 downto 0); -- byte from data lines
55
                -- remote command inputs
56
                IDY : in std_logic; -- identify
57
                PPE : in std_logic; -- parallel poll enable
58
                PPD : in std_logic; -- parallel poll disable
59
                PPC : in std_logic; -- parallel poll configure
60
                PPU : in std_logic; -- parallel poll unconfigure
61
                PCG : in std_logic; -- primary command group
62
                -- remote command outputs
63
                PPR : out std_logic; -- paralel poll response
64
                -- PPR command data
65
                ppBitValue : out std_logic; -- bit value
66
                ppLineNumber : out std_logic_vector (2 downto 0);
67
                -- reported states
68
                PPAS : out std_logic -- parallel poll active state
69
        );
70
end if_func_PP;
71
 
72
architecture Behavioral of if_func_PP is
73
 
74
        -- states
75
        type PP_STATE_1 is (
76
                -- parallel poll idle state
77
                ST_PPIS,
78
                -- parallel poll standby state
79
                ST_PPSS,
80
                -- parallel poll active state
81
                ST_PPAS
82
        );
83
 
84
        -- states
85
        type PP_STATE_2 is (
86
                -- parallel poll unaddressed to configure state
87
                ST_PUCS,
88
                -- parallel poll addressed to configure state
89
                ST_PACS
90
        );
91
 
92
        -- current state
93
        signal current_state_1 : PP_STATE_1;
94
        signal current_state_2 : PP_STATE_2;
95
 
96
        -- predicates
97
        signal pred1, pred2, pred3, pred4, pred5 : boolean;
98
 
99
        -- memorized PP metadata
100
        signal S : std_logic;
101
        signal lineAddr : std_logic_vector (2 downto 0);
102
 
103
begin
104
 
105
        -- state machine process - PP_STATE_1
106
        process(pon, clk) begin
107
                if pon = '1' then
108
                        current_state_1 <= ST_PPIS;
109
                elsif rising_edge(clk) then
110
                        case current_state_1 is
111
                                ------------------
112
                                when ST_PPIS =>
113
                                        if pred1 then
114
                                                S <= dio_data(3);
115
                                                lineAddr <= dio_data(2 downto 0);
116
                                                current_state_1 <= ST_PPSS;
117
                                        end if;
118
                                ------------------
119
                                when ST_PPSS =>
120
                                        if pred3 then
121
                                                current_state_1 <= ST_PPAS;
122
                                        elsif pred2 then
123
                                                current_state_1 <= ST_PPIS;
124
                                        end if;
125
                                ------------------
126
                                when ST_PPAS =>
127
                                        if not pred3 then
128
                                                current_state_1 <= ST_PPSS;
129
                                        end if;
130
                                ------------------
131
                                when others =>
132
                                        current_state_1 <= ST_PPIS;
133
                        end case;
134
                end if;
135
        end process;
136
 
137
        -- state machine process - PP_STATE_2
138
        process(pon, clk) begin
139
                if pon = '1' then
140
                        current_state_2 <= ST_PUCS;
141
                elsif rising_edge(clk) then
142
                        case current_state_2 is
143
                                ------------------
144
                                when ST_PUCS =>
145
                                        if pred4 then
146
                                                current_state_2 <= ST_PACS;
147
                                        end if;
148
                                ------------------
149
                                when ST_PACS =>
150
                                        if pred5 then
151
                                                current_state_2 <= ST_PUCS;
152
                                        end if;
153
                                ------------------
154
                                when others =>
155
                                        current_state_2 <= ST_PUCS;
156
                        end case;
157
                end if;
158
        end process;
159
 
160
        ppBitValue <= (not S xor ist) when lpeUsed='0' else ist;
161
        ppLineNumber <= lineAddr when lpeUsed='0' else fixedPpLine;
162
        PPR <= to_stdl(current_state_1 = ST_PPAS);
163
        PPAS <= to_stdl(current_state_1 = ST_PPAS);
164
 
165
        -- predicates
166
        with lpeUsed select
167
                pred1 <=
168
                        is_1(lpe) when '1',
169
                        PPE='1' and current_state_2=ST_PACS and ACDS='1' when others;
170
 
171
        with lpeUsed select
172
                pred2 <=
173
                        is_1(not lpe) when '1',
174
                        ((PPD='1' and current_state_2=ST_PACS) or PPU='1') and ACDS='1'
175
                                when others;
176
 
177
        pred3 <= IDY='1';
178
        pred4 <= PPC='1' and LADS='1' and ACDS='1';
179
        pred5 <= PCG='1' and PPC='0' and ACDS='1';
180
 
181
 
182
end Behavioral;

powered by: WebSVN 2.1.0

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