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

Subversion Repositories gpib_controller

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2 13 Andrewski
--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
--------------------------------------------------------------------------------
17 3 Andrewski
-- Entity: commandDecoder
18
-- Date:2011-10-07  
19 13 Andrewski
-- Author: Andrzej Paluch
20 3 Andrewski
--------------------------------------------------------------------------------
21
library ieee;
22
 
23
use ieee.std_logic_1164.all;
24
 
25
use work.utilPkg.all;
26
 
27
 
28
entity commandDecoder is
29
        port (
30
 
31
                -------------------------------------------
32
                -- data lines -----------------------------
33
                -------------------------------------------
34
                DI : in std_logic_vector (7 downto 0);
35
 
36
                -------------------------------------------
37
                -- control lines --------------------------
38
                -------------------------------------------
39
                -- DAV line
40
                DAV_line : in std_logic;
41
                -- NRFD line
42
                NRFD_line : in std_logic;
43
                -- NDAC line
44
                NDAC_line : in std_logic;
45
                -- ATN line
46
                ATN_line : in std_logic;
47
                -- EOI line
48
                EOI_line : in std_logic;
49
                -- SRQ line
50
                SRQ_line : in std_logic;
51
                -- IFC line
52
                IFC_line : in std_logic;
53
                -- REN line
54
                REN_line : in std_logic;
55
 
56
                -------------------------------------------
57
                -- internal settiongs ---------------------
58
                -------------------------------------------
59
                -- eos mark
60
                eosMark : in std_logic_vector (7 downto 0);
61
                -- eos used
62
                eosUsed : in std_logic;
63
                -- my listen address
64
                myListAddr : in std_logic_vector (4 downto 0);
65
                -- my talk address
66
                myTalkAddr : in std_logic_vector (4 downto 0);
67
                -- secondary address detected
68
                secAddrDetected : in std_logic;
69
 
70
                -------------------------------------------
71
                -- internal states ------------------------
72
                -------------------------------------------
73
                -- serial poll active state (T or TE)
74
                SPAS : in std_logic;
75
 
76
                -------------------------------------------
77
                -- single line commands -------------------
78
                -------------------------------------------
79
                -- attention
80
                ATN : out std_logic;
81
                -- data accepted
82
                DAC : out std_logic;
83
                -- data valid
84
                DAV : out std_logic;
85
                -- end
86
                END_c : out std_logic;
87
                -- identify
88
                IDY : out std_logic;
89
                -- interface clear
90
                IFC : out std_logic;
91
                -- remote enable
92
                REN : out std_logic;
93
                -- ready for data
94
                RFD : out std_logic;
95
                -- service request
96
                SRQ : out std_logic;
97
 
98
                -------------------------------------------
99
                -- multi line commands --------------------
100
                -------------------------------------------
101
                -- addressed command group
102
                ACG : out std_logic;
103
                -- data byte
104
                DAB : out std_logic;
105
                -- device clear
106
                DCL : out std_logic;
107
                -- end of string
108
                EOS : out std_logic;
109
                -- group execute trigger
110
                GET : out std_logic;
111
                -- go to local
112
                GTL : out std_logic;
113
                -- listen address group
114
                LAG : out std_logic;
115
                -- local lockout
116
                LLO : out std_logic;
117
                -- my listen address
118
                MLA : out std_logic;
119
                -- my talk address
120
                MTA : out std_logic;
121
                -- my secondary address
122
                MSA : out std_logic;
123
                -- null byte
124
                NUL : out std_logic;
125
                -- other secondary address
126
                OSA : out std_logic;
127
                -- other talk address
128
                OTA : out std_logic;
129
                -- primary command group
130
                PCG : out std_logic;
131
                -- parallel poll configure
132
                PPC : out std_logic;
133
                -- parallel poll enable
134
                PPE : out std_logic;
135
                -- parallel poll disable
136
                PPD : out std_logic;
137
                -- parallel poll response
138
                PPR : out std_logic;
139
                -- parallel poll unconfigure
140
                PPU : out std_logic;
141
                -- request service
142
                RQS : out std_logic;
143
                -- secondary command group
144
                SCG : out std_logic;
145
                -- selected device clear
146
                SDC : out std_logic;
147
                -- serial poll disable
148
                SPD : out std_logic;
149
                -- serial poll enable
150
                SPE : out std_logic;
151
                -- status byte
152
                STB : out std_logic;
153
                -- talk address group
154
                TAG : out std_logic;
155
                -- take control
156
                TCT : out std_logic;
157
                -- universal command group
158
                UCG : out std_logic;
159
                -- unlisten
160
                UNL : out std_logic;
161
                -- untalk
162
                UNT : out std_logic
163
        );
164
end commandDecoder;
165
 
166
architecture arch of commandDecoder is
167
 
168
        signal ATN_int, IDY_int : std_logic;
169
        signal SCG_int, MSA_int, TAG_int, MTA_int, ACG_int, UCG_int,
170
                LAG_int, STB_int : std_logic;
171
 
172
begin
173
 
174
        --------------------------------------
175
        -- single line
176
        --------------------------------------
177
        ATN_int <= ATN_line;
178
        ATN <= ATN_int;
179
        ----------------------
180
        DAC <= not NDAC_line;
181
        ----------------------
182
        DAV <= DAV_line;
183
        ----------------------
184
        END_c <= not ATN_line and EOI_line;
185
        ----------------------
186
        IDY_int <= ATN_line and EOI_line;
187
        IDY <= IDY_int;
188
        ----------------------
189
        IFC <= IFC_line;
190
        ----------------------
191
        REN <= REN_line;
192
        ----------------------
193
        RFD <= not NRFD_line;
194
        ----------------------
195
        SRQ <= SRQ_line;
196
 
197
        ---------------------------------------
198
        -- multiple line
199
        ---------------------------------------
200
        ACG_int <= ATN_int and to_stdl(DI(6 downto 4) = "000");
201
        ACG <= ACG_int;
202
        ---------------------------------------
203
        DAB <= not ATN_int and ((eosUsed and to_stdl(DI /= eosMark)) or not eosUsed);
204
        ---------------------------------------
205
        DCL <= ATN_int and to_stdl(DI(6 downto 0) = "0010100");
206
        ---------------------------------------
207
        EOS <= not ATN_int and eosUsed and to_stdl(DI = eosMark);
208
        ---------------------------------------
209
        GET <= ATN_int and to_stdl(DI(6 downto 0) = "0001000");
210
        ---------------------------------------
211
        GTL <= ATN_int and to_stdl(DI(6 downto 0) = "0000001");
212
        ---------------------------------------
213
        LAG_int <= ATN_int and to_stdl(DI(6 downto 5) = "01");
214
        LAG <= LAG_int;
215
        ---------------------------------------
216
        LLO <= ATN_int and to_stdl(DI(6 downto 0) = "0010001");
217
        ---------------------------------------
218
        MLA <= LAG_int and to_stdl(DI(4 downto 0) = myListAddr);
219
        ---------------------------------------
220
        MTA_int <= TAG_int and to_stdl(DI(4 downto 0) = myTalkAddr);
221
        MTA <= MTA_int;
222
        ---------------------------------------
223
        MSA_int <= SCG_int and secAddrDetected;
224
        MSA <= MSA_int;
225
        ---------------------------------------
226
        NUL <= ATN_int and to_stdl(DI = "00000000");
227
        ---------------------------------------
228
        OSA <= SCG_int and not MSA_int;
229
        ---------------------------------------
230
        OTA <= TAG_int and not MTA_int;
231
        ---------------------------------------
232
        PCG <= ACG_int or UCG_int or LAG_int or TAG_int;
233
        ---------------------------------------
234
        PPC <= ATN_int and to_stdl(DI(6 downto 0) = "0000101");
235
        ---------------------------------------
236
        PPE <= ATN_int and to_stdl(DI(6 downto 4) = "110");
237
        ---------------------------------------
238
        PPD <= ATN_int and to_stdl(DI(6 downto 4) = "111"); -- "-1110000" ?
239
        ---------------------------------------
240
        PPR <= ATN_int and IDY_int;
241
        ---------------------------------------
242
        PPU <= ATN_int and to_stdl(DI(6 downto 0) = "0010101");
243
        ---------------------------------------
244
        RQS <= STB_int and to_stdl(DI(6) = '1');
245
        ---------------------------------------
246
        SCG_int <= ATN_int and to_stdl(DI(6 downto 5) = "11");
247
        SCG <= SCG_int;
248
        ---------------------------------------
249
        SDC <= ATN_int and to_stdl(DI(6 downto 0) = "0000100");
250
        ---------------------------------------
251
        SPD <= ATN_int and to_stdl(DI(6 downto 0) = "0011001");
252
        ---------------------------------------
253
        SPE <= ATN_int and to_stdl(DI(6 downto 0) = "0011000");
254
        ---------------------------------------
255
        STB_int <= not ATN_int and SPAS;
256
        STB <= STB_int;
257
        ---------------------------------------
258
        TAG_int <= ATN_int and to_stdl(DI(6 downto 5) = "10");
259
        TAG <= TAG_int;
260
        ---------------------------------------
261
        TCT <= ATN_int and to_stdl(DI(6 downto 0) = "0001001");
262
        ---------------------------------------
263
        UCG_int <= ATN_int and to_stdl(DI(6 downto 4) = "001");
264
        UCG <= UCG_int;
265
        ---------------------------------------
266
        UNL <= ATN_int and to_stdl(DI(6 downto 0) = "0111111");
267
        ---------------------------------------
268
        UNT <= ATN_int and to_stdl(DI(6 downto 0) = "1011111");
269
 
270
end arch;
271
 

powered by: WebSVN 2.1.0

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