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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [gpibInterface.vhd] - Blame information for rev 6

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

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2
-- Entity:      gpibInterface
3
-- Date:        13:34 15/10/2011
4
-- Author:      apaluch
5
--------------------------------------------------------------------------------
6
library IEEE;
7
 
8
use IEEE.STD_LOGIC_1164.ALL;
9
 
10
use work.gpibComponents.all;
11
 
12
entity gpibInterface is
13
        port (
14
                clk : in std_logic;
15
                reset : std_logic;
16
                -- application interface
17
                isLE : in std_logic;
18
                isTE : in std_logic;
19
                lpeUsed : in std_logic;
20
                fixedPpLine : in std_logic_vector (2 downto 0);
21
                eosUsed : in std_logic;
22
                eosMark : in std_logic_vector (7 downto 0);
23
                myListAddr : in std_logic_vector (4 downto 0);
24
                myTalkAddr : in std_logic_vector (4 downto 0);
25
                secAddrMask : in std_logic_vector (31 downto 0);
26
                data : in std_logic_vector (7 downto 0);
27
                status_byte : in std_logic_vector (7 downto 0);
28
                T1 : in std_logic_vector (7 downto 0);
29
                -- local commands to interface
30
                rdy : in std_logic; -- ready for next message (AH)
31
                nba : in std_logic; -- new byte available (SH)
32
                ltn : in std_logic; -- listen (L, LE)
33
                lun : in std_logic; -- local unlisten (L, LE)
34
                lon : in std_logic; -- listen only (L, LE)
35
                ton : in std_logic; -- talk only (T, TE)
36
                endOf : in std_logic; -- end of byte string (T, TE)
37
                gts : in std_logic; -- go to standby (C)
38
                rpp : in std_logic; -- request parallel poll (C)
39
                tcs : in std_logic; -- take control synchronously (C, AH)
40
                tca : in std_logic; -- take control asynchronously (C)
41
                sic : in std_logic; -- send interface clear (C)
42
                rsc : in std_logic; -- request system control (C)
43
                sre : in std_logic; -- send remote enable (C)
44
                rtl : in std_logic; -- return to local (RL)
45
                rsv : in std_logic; -- request service (SR)
46
                ist : in std_logic; -- individual status (PP)
47
                lpe : in std_logic; -- local poll enable (PP)
48
 
49
                -- local commands from interface
50
                dvd : out std_logic; -- data valid (AH)
51
                wnc : out std_logic; -- wait for new cycle (SH)
52
                tac : out std_logic; -- talker active (T, TE)
53
                lac : out std_logic; -- listener active (L, LE)
54
                cwrc : out std_logic; -- controller write commands
55
                cwrd : out std_logic; -- controller write data
56
                clr : out std_logic; -- clear device (DC)
57
                trg : out std_logic; -- trigger device (DT)
58
                atl : out std_logic; -- addressed to listen (T or TE)
59
                att : out std_logic; -- addressed to talk(L or LE)
60
                mla : out std_logic; -- my listen addres decoded (L or LE)
61
                lsb : out std_logic; -- last byte
62
                spa : out std_logic; -- seriall poll active
63
                ppr : out std_logic; -- parallel poll ready
64
                sreq : out std_logic; -- service requested
65
                isLocal : out std_logic; -- device is local controlled
66
                currentSecAddr : out std_logic_vector (4 downto 0); -- current sec addr
67
                -- interface signals
68
                DI : in std_logic_vector (7 downto 0);
69
                DO : out std_logic_vector (7 downto 0);
70
                output_valid : out std_logic;
71
                -- attention
72
                ATN_in : in std_logic;
73
                ATN_out : out std_logic;
74
                -- data valid
75
                DAV_in : in std_logic;
76
                DAV_out : out std_logic;
77
                -- not ready for data
78
                NRFD_in : in std_logic;
79
                NRFD_out : out std_logic;
80
                -- no data accepted
81
                NDAC_in : in std_logic;
82
                NDAC_out : out std_logic;
83
                -- end or identify
84
                EOI_in : in std_logic;
85
                EOI_out : out std_logic;
86
                -- service request
87
                SRQ_in : in std_logic;
88
                SRQ_out : out std_logic;
89
                -- interface clear
90
                IFC_in : in std_logic;
91
                IFC_out : out std_logic;
92
                -- remote enable
93
                REN_in : in std_logic;
94
                REN_out : out std_logic
95
                ;debug1 : out std_logic
96
        );
97
end gpibInterface;
98
 
99
architecture Behavioral of gpibInterface is
100
 
101
        -- function states
102
        signal LACS, LADS, SPAS, TACS, CACS, CSBS, CPPS, CTRS, CSRS, SACS, ACDS,
103
                TPAS, APRS, LPAS, TADS, ANRS, STRS, SDYS, PPAS, LOCS, LWLS : std_logic;
104
 
105
        -- decoded remote commands
106
        signal ATN_dec, DAC_dec, DAV_dec, END_c_dec, IDY_dec, IFC_dec, REN_dec,
107
                RFD_dec, SRQ_dec : std_logic;
108
        signal ACG_dec, DAB_dec, DCL_dec, EOS_dec, GET_dec, GTL_dec, LAG_dec,
109
                LLO_dec, MLA_dec, MTA_dec, MSA_dec, NUL_dec, OSA_dec, OTA_dec, PCG_dec,
110
                PPC_dec, PPE_dec, PPD_dec, PPR_dec, PPU_dec, RQS_dec, SCG_dec, SDC_dec,
111
                SPD_dec, SPE_dec, STB_dec, TAG_dec, TCT_dec, UCG_dec, UNL_dec,
112
                UNT_dec : std_logic;
113
 
114
        -- encoded remote commands
115
        signal ATN_enc, DAC_enc, RFD_enc, DAV_enc, END_OF_enc, IFC_enc, IDY_enc,
116
                REN_enc, RQS_enc, DAB_enc, EOS_enc, STB_enc, TCT_enc, SRQ_enc,
117
                PPR_enc : std_logic;
118
 
119
        -- PPR command data
120
        signal ppBitValue : std_logic;
121
        signal ppLineNumber : std_logic_vector (2 downto 0);
122
 
123
        -- internal signals
124
        signal secAddrDetected : std_logic;
125
 
126
begin
127
 
128
        dvd <= ACDS;
129
        cwrc <= CACS;
130
        cwrd <= CSBS;
131
        atl <= LADS or LACS;
132
        lac <= LACS;
133
        att <= TACS or TADS or SPAS;
134
        mla <= MLA_dec;
135
        lsb <= ((eosUsed and EOS_dec) or END_c_dec) and ACDS; -- dvd = ACDS
136
        spa <= SPAS;
137
        ppr <= CPPS;
138
        sreq <= CSRS and SACS;
139
        isLocal <= LOCS or LWLS;
140
 
141
 
142
        -- acceptor handshake
143
        AH: if_func_AH port map(
144
                clk => clk,
145
                -----------------------------------------------------------------------
146
                pon => reset, rdy => rdy, tcs => tcs,
147
                -----------------------------------------------------------------------
148
                LACS => LACS, LADS => LADS,
149
                -----------------------------------------------------------------------
150
                ATN => ATN_dec, DAV => DAV_dec,
151
                -----------------------------------------------------------------------
152
                RFD => RFD_enc, DAC=> DAC_enc,
153
                -----------------------------------------------------------------------
154
                ANRS => ANRS, ACDS => ACDS
155
        );
156
 
157
        -- source handshake
158
        SH: if_func_SH port map(
159
                clk => clk,
160
                -----------------------------------------------------------------------
161
                T1 => T1,
162
                -----------------------------------------------------------------------
163
                pon => reset, nba => nba,
164
                -----------------------------------------------------------------------
165
                TACS => TACS, SPAS => SPAS, CACS => CACS, CTRS => CTRS,
166
                -----------------------------------------------------------------------
167
                ATN => ATN_dec, DAC => DAC_dec, RFD => RFD_dec,
168
                -----------------------------------------------------------------------
169
                DAV => DAV_enc,
170
                -----------------------------------------------------------------------
171
                wnc => wnc,
172
                -----------------------------------------------------------------------
173
                STRS => STRS, SDYS => SDYS
174
        );
175
 
176
        -- listener, extended listener
177
        L_LE: if_func_L_LE port map(
178
                clk => clk,
179
                -----------------------------------------------------------------------
180
                isLE => isLE,
181
                -----------------------------------------------------------------------
182
                pon => reset, ltn => ltn, lun => lun, lon => lon,
183
                -----------------------------------------------------------------------
184
                ACDS => ACDS, CACS => CACS, TPAS => TPAS,
185
                -----------------------------------------------------------------------
186
                ATN => ATN_dec, IFC => IFC_dec, MLA => MLA_dec, MTA => MTA_dec,
187
                UNL => UNL_dec, PCG => PCG_dec, MSA => MSA_dec,
188
                -----------------------------------------------------------------------
189
                LACS => LACS, LADS => LADS, LPAS => LPAS, debug1 => debug1
190
        );
191
 
192
        -- talker, extended talker
193
        T_TE: if_func_T_TE port map(
194
                clk => clk,
195
                -----------------------------------------------------------------------
196
                isTE => isTE,
197
                -----------------------------------------------------------------------
198
                pon => reset, ton => ton, endOf => endOf,
199
                -----------------------------------------------------------------------
200
                ACDS => ACDS, APRS => APRS, LPAS => LPAS,
201
                -----------------------------------------------------------------------
202
                ATN => ATN_dec, IFC => IFC_dec, SPE => SPE_dec, SPD => SPD_dec,
203
                MTA => MTA_dec, OTA => OTA_dec, MLA => MLA_dec, OSA => OSA_dec,
204
                MSA => MSA_dec, PCG => PCG_dec,
205
                -----------------------------------------------------------------------
206
                END_OF => END_OF_enc, RQS => RQS_enc, DAB => DAB_enc, EOS => EOS_enc,
207
                STB => STB_enc,
208
                -----------------------------------------------------------------------
209
                tac => tac,
210
                -----------------------------------------------------------------------
211
                SPAS => SPAS, TPAS => TPAS, TADS => TADS, TACS => TACS
212
        );
213
 
214
        -- controller
215
        C: if_func_C  port map(
216
                clk => clk,
217
                -----------------------------------------------------------------------
218
                pon => reset, gts => gts, rpp => rpp, tcs => tcs, tca => tca,
219
                sic => sic, rsc => rsc, sre => sre,
220
                -----------------------------------------------------------------------
221
                TADS => TADS, ACDS => ACDS, ANRS => ANRS, STRS => STRS, SDYS => SDYS,
222
                -----------------------------------------------------------------------
223
                ATN_in => ATN_dec, IFC_in => IFC_dec, TCT_in => TCT_dec,
224
                SRQ_in => SRQ_dec,
225
                -----------------------------------------------------------------------
226
                ATN_out => ATN_enc, IFC_out => IFC_enc, TCT_out => TCT_enc,
227
                IDY_out => IDY_enc, REN_out => REN_enc,
228
                -----------------------------------------------------------------------
229
                CACS => CACS, CTRS => CTRS, CSBS => CSBS, CPPS => CPPS, CSRS => CSRS,
230
                SACS => SACS
231
        );
232
 
233
        -- device clear
234
        DC: if_func_DC port map(
235
                clk => clk,
236
                -----------------------------------------------------------------------
237
                LADS => LADS, ACDS => ACDS,
238
                -----------------------------------------------------------------------
239
                DCL => DCL_dec, SDC => SDC_dec,
240
                -----------------------------------------------------------------------
241
                clr => clr
242
        );
243
 
244
        -- device trigger
245
        DT: if_func_DT port map(
246
                clk => clk,
247
                -----------------------------------------------------------------------
248
                LADS => LADS, ACDS => ACDS,
249
                -----------------------------------------------------------------------
250
                GET => GET_dec,
251
                -----------------------------------------------------------------------
252
                trg => trg
253
        );
254
 
255
        PP: if_func_PP port map(
256
                clk => clk,
257
                -----------------------------------------------------------------------
258
                lpeUsed => lpeUsed, fixedPpLine => fixedPpLine,
259
                -----------------------------------------------------------------------
260
                pon => reset, lpe => lpe, ist => ist,
261
                -----------------------------------------------------------------------
262
                ACDS => ACDS, LADS => LADS,
263
                -----------------------------------------------------------------------
264
                dio_data => DI(3 downto 0),
265
                -----------------------------------------------------------------------
266
                IDY => IDY_dec, PPE => PPE_dec, PPD => PPD_dec, PPC => PPC_dec,
267
                PPU => PPU_dec, PCG => PCG_dec,
268
                -----------------------------------------------------------------------
269
                PPR => PPR_enc, ppBitValue => ppBitValue, ppLineNumber => ppLineNumber,
270
                -----------------------------------------------------------------------
271
                PPAS => PPAS
272
        );
273
 
274
        RL: if_func_RL port map(
275
                clk => clk,
276
                -----------------------------------------------------------------------
277
                pon => reset, rtl => rtl,
278
                -----------------------------------------------------------------------
279
                ACDS => ACDS, LADS => LADS,
280
                -----------------------------------------------------------------------
281
                REN => REN_dec, LLO => LLO_dec, MLA => MLA_dec, GTL => GTL_dec,
282
                -----------------------------------------------------------------------
283
                LOCS => LOCS, LWLS => LWLS
284
        );
285
 
286
        SR: if_func_SR port map(
287
                clk => clk,
288
                -----------------------------------------------------------------------
289
                pon => reset, rsv => rsv,
290
                -----------------------------------------------------------------------
291
                SPAS => SPAS,
292
                -----------------------------------------------------------------------
293
                SRQ => SRQ_enc,
294
                -----------------------------------------------------------------------
295
                APRS => APRS
296
        );
297
 
298
        COMM_ENC: commandEcoder port map (
299
                        data => data, status_byte => status_byte,
300
                        -------------------------------------------------------------------
301
                        ppBitValue => ppBitValue, ppLineNumber => ppLineNumber,
302
                        -------------------------------------------------------------------
303
                        APRS => APRS, CACS => CACS,
304
                        -------------------------------------------------------------------
305
                        ATN => ATN_enc, END_OF => END_OF_enc, IDY => IDY_enc,
306
                        DAC => DAC_enc, RFD => RFD_enc, DAV => DAV_enc, IFC => IFC_enc,
307
                        REN => REN_enc, SRQ => SRQ_enc, DAB => DAB_enc, EOS => EOS_enc,
308
                        RQS => RQS_enc, STB => STB_enc, TCT => TCT_enc, PPR => PPR_enc,
309
                        -------------------------------------------------------------------
310
                        DO => DO, output_valid => output_valid,
311
                        -------------------------------------------------------------------
312
                        DAV_line => DAV_out, NRFD_line => NRFD_out, NDAC_line => NDAC_out,
313
                        ATN_line => ATN_out, EOI_line => EOI_out, SRQ_line => SRQ_out,
314
                        IFC_line => IFC_out, REN_line => REN_out
315
        );
316
 
317
        -- command decoder
318
        COMM_DEC: commandDecoder port map (
319
                DI => DI, DAV_line => DAV_in, NRFD_line => NRFD_in,
320
                NDAC_line => NDAC_in, ATN_line => ATN_in, EOI_line => EOI_in,
321
                SRQ_line => SRQ_in, IFC_line => IFC_in, REN_line => REN_in,
322
                -----------------------------------------------------------------------
323
                eosMark => eosMark, eosUsed =>eosUsed, myListAddr => myListAddr,
324
                myTalkAddr => myTalkAddr, secAddrDetected => secAddrDetected,
325
                -----------------------------------------------------------------------
326
                SPAS => SPAS,
327
                -----------------------------------------------------------------------
328
                ATN => ATN_dec, DAC => DAC_dec, DAV => DAV_dec, END_c => END_c_dec,
329
                IDY => IDY_dec, IFC => IFC_dec, REN => REN_dec, RFD => RFD_dec,
330
                SRQ => SRQ_dec,
331
                -----------------------------------------------------------------------
332
                ACG => ACG_dec, DAB => DAB_dec, DCL => DCL_dec, EOS => EOS_dec,
333
                GET => GET_dec, GTL => GTL_dec, LAG => LAG_dec, LLO => LLO_dec,
334
                MLA => MLA_dec, MTA => MTA_dec, MSA => MSA_dec, NUL => NUL_dec,
335
                OSA => OSA_dec, OTA => OTA_dec, PCG => PCG_dec, PPC => PPC_dec,
336
                PPE => PPE_dec, PPD => PPD_dec, PPR => PPR_dec, PPU => PPU_dec,
337
                RQS => RQS_dec, SCG => SCG_dec, SDC => SDC_dec, SPD => SPD_dec,
338
                SPE => SPE_dec, STB => STB_dec, TAG => TAG_dec, TCT => TCT_dec,
339
                UCG => UCG_dec, UNL => UNL_dec, UNT => UNT_dec
340
        );
341
 
342
        SECAD: SecondaryAddressDecoder port map (
343
                secAddrMask => secAddrMask, DI => DI(4 downto 0),
344
                secAddrDetected => secAddrDetected
345
        );
346
 
347
        SECADS: SecAddrSaver port map (
348
                reset => reset,
349
                TADS => TADS, TPAS => TPAS, LADS => LADS, LPAS => LPAS,
350
                MSA_Dec => MSA_Dec, DI => DI(4 downto 0),
351
                currentSecAddr => currentSecAddr
352
        );
353
 
354
end Behavioral;
355
 

powered by: WebSVN 2.1.0

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