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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [common/] [gpibComponents.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:      components
18
-- Date:        23:15 10/12/2011
19 13 Andrewski
-- Author: Andrzej Paluch
20 3 Andrewski
--------------------------------------------------------------------------------
21
library IEEE;
22
use IEEE.STD_LOGIC_1164.ALL;
23
 
24
package gpibComponents is
25
 
26
        component if_func_AH is
27
                port(
28
                        -- device inputs
29
                        clk : in std_logic; -- clock
30
                        pon : in std_logic; -- power on
31
                        rdy : in std_logic; -- ready for next message
32
                        tcs : in std_logic; -- take control synchronously
33
                        -- state inputs
34
                        LACS : in std_logic; -- listener active state
35
                        LADS : in std_logic; -- listener addressed state
36
                        -- interface inputs
37
                        ATN : in std_logic; -- attention
38
                        DAV : in std_logic; -- data accepted
39
                        -- interface outputs
40
                        RFD : out std_logic; -- ready for data
41
                        DAC : out std_logic; -- data accepted
42
                        -- reported state
43
                        ANRS : out std_logic; -- acceptor not ready state
44
                        ACDS : out std_logic -- accept data state
45
                );
46
        end component;
47
 
48
        component if_func_SH is
49
                port(
50
                        -- device inputs
51
                        clk : in std_logic; -- clock
52
                        -- settingd
53
                        T1 : in std_logic_vector (7 downto 0);
54
                        -- local commands
55
                        pon : in std_logic; -- power on
56
                        nba : in std_logic; -- new byte available
57
                        -- state inputs
58
                        TACS : in std_logic; -- talker active state
59
                        SPAS : in std_logic; -- seriall poll active state
60
                        CACS : in std_logic; -- controller active state
61
                        CTRS : in std_logic; -- controller transfer state
62
                        -- interface inputs
63
                        ATN : in std_logic; -- attention
64
                        DAC : in std_logic; -- data accepted
65
                        RFD : in std_logic; -- ready for data
66
                        -- remote instructions
67
                        DAV : out std_logic; -- data address valid
68
                        -- device outputs
69
                        wnc : out std_logic; -- wait for new cycle
70
                        -- reported states
71
                        STRS : out std_logic; -- source transfer state
72
                        SDYS : out std_logic -- source delay state
73
                );
74
        end component;
75
 
76
        component if_func_L_LE is
77
                port(
78
                        -- clock
79
                        clk : in std_logic; -- clock
80
                        -- function settings
81
                        isLE : in std_logic;
82
                        -- local commands
83
                        pon : in std_logic; -- power on
84
                        ltn : in std_logic; -- listen
85
                        lun : in std_logic; -- local unlisten
86
                        lon : in std_logic; -- listen only
87
                        -- state inputs
88
                        ACDS : in std_logic; -- accept data state (AH)
89
                        CACS : in std_logic; -- controller active state (C)
90
                        TPAS : in std_logic; -- talker primary address state (T)
91
                        -- remote commands
92
                        ATN : in std_logic; -- attention
93
                        IFC : in std_logic; -- interface clear
94
                        MLA : in std_logic; -- my listen address
95
                        MTA : in std_logic; -- my talk address
96
                        UNL : in std_logic; -- unlisten
97
                        PCG : in std_logic; -- primary command group
98
                        MSA : in std_logic; -- my secondary address
99
                        -- reported states
100
                        LACS : out std_logic; -- listener active state
101
                        LADS : out std_logic; -- listener addressed state
102
                        LPAS : out std_logic -- listener primary addressed state
103
                        ;debug1 : out std_logic
104
                );
105
        end component;
106
 
107
        component if_func_T_TE is
108
                port(
109
                        -- clock
110
                        clk : in std_logic; -- clock
111
                        -- function settings
112
                        isTE : in std_logic;
113
                        -- local instruction inputs
114
                        pon : in std_logic; -- power on
115
                        ton : in std_logic; -- talk only
116
                        endOf : in std_logic; -- end of byte string
117
                        -- state inputs
118
                        ACDS : in std_logic; -- accept data state (AH)
119
                        APRS : in std_logic; -- affirmative poll response
120
                        LPAS : in std_logic; -- listener primary state (LE)
121
                        -- remote instruction inputs
122
                        ATN : in std_logic; -- attention
123
                        IFC : in std_logic; -- interface clear
124
                        SPE : in std_logic; -- serial poll enable
125
                        SPD : in std_logic; -- serial poll disable
126
                        MTA : in std_logic; -- my talk address
127
                        OTA : in std_logic; -- other talk address
128
                        MLA : in std_logic; -- my listen address
129
                        OSA : in std_logic; -- other secondary address
130
                        MSA : in std_logic; -- my secondary address
131
                        PCG : in std_logic; -- primary command group
132
                        -- remote instruction outputs
133
                        END_OF : out std_logic; -- end of data
134
                        RQS : out std_logic; -- data accepted
135
                        DAB : out std_logic; -- data byte
136
                        EOS : out std_logic; -- end of string
137
                        STB : out std_logic; -- status byte
138
                        -- local instruction outputs
139
                        tac : out std_logic; -- talker active
140
                        -- reported states
141
                        SPAS : out std_logic; -- serial poll active state
142
                        TPAS : out std_logic; -- transmitter active state
143
                        TADS : out std_logic; -- talker addressed state
144
                        TACS : out std_logic -- talker active state
145
                );
146
        end component;
147
 
148
        component if_func_C is
149
                port(
150
                        -- device inputs
151
                        clk : in std_logic; -- clock
152
                        pon : in std_logic; -- power on
153
                        gts : in std_logic; -- go to standby
154
                        rpp : in std_logic; -- request parallel poll
155
                        tcs : in std_logic; -- take control synchronously
156
                        tca : in std_logic; -- take control asynchronously
157
                        sic : in std_logic; -- send interface clear
158
                        rsc : in std_logic; -- request system control
159
                        sre : in std_logic; -- send remote enable
160
                        -- state inputs
161
                        TADS : in std_logic; -- talker addressed state (T or TE)
162
                        ACDS : in std_logic; -- accept data state (AH)
163
                        ANRS : in std_logic; -- acceptor not ready state (AH)
164
                        STRS : in std_logic; -- source transfer state (SH)
165
                        SDYS : in std_logic; -- source delay state (SH)
166
                        -- command inputs
167
                        ATN_in : in std_logic; -- attention
168
                        IFC_in : in std_logic; -- interface clear
169
                        TCT_in : in std_logic; -- take control
170
                        SRQ_in : in std_logic; -- service request
171
                        -- command outputs
172
                        ATN_out : out std_logic; -- attention
173
                        IFC_out : out std_logic; -- interface clear
174
                        TCT_out : out std_logic; -- take control
175
                        IDY_out : out std_logic; -- identify
176
                        REN_out : out std_logic; -- remote enable
177
                        -- reported states
178
                        CACS : out std_logic; -- controller active state
179
                        CTRS : out std_logic; -- controller transfer state
180
                        CSBS : out std_logic; -- controller standby state
181
                        CPPS : out std_logic; -- controller parallel poll state
182
                        CSRS : out std_logic; -- controller service requested state
183
                        SACS : out std_logic -- system control active state
184
                );
185
        end component;
186
 
187
        component if_func_DC is
188
                port(
189
                        -- device inputs
190
                        clk : in std_logic; -- clock
191
                        -- state inputs
192
                        LADS : in std_logic; -- listener addressed state (L or LE)
193
                        ACDS : in std_logic; -- accept data state (AH)
194
                        -- instructions
195
                        DCL : in std_logic; -- my listen address
196
                        SDC : in std_logic; -- unlisten
197
                        -- local instructions
198
                        clr : out std_logic -- clear device
199
                );
200
        end component;
201
 
202
        component if_func_DT is
203
                port(
204
                        -- device inputs
205
                        clk : in std_logic; -- clock
206
                        -- state inputs
207
                        LADS : in std_logic; -- listener addressed state (L or LE)
208
                        ACDS : in std_logic; -- accept data state (AH)
209
                        -- instructions
210
                        GET : in std_logic; -- group execute trigger
211
                        -- local instructions
212
                        trg : out std_logic -- trigger
213
                );
214
        end component;
215
 
216
        component if_func_PP is
217
                port(
218
                        -- device inputs
219
                        clk : in std_logic; -- clock
220
                        -- settings
221
                        lpeUsed : std_logic;
222
                        fixedPpLine : in std_logic_vector (2 downto 0);
223
                        -- local commands
224
                        pon : in std_logic; -- power on
225
                        lpe : in std_logic; -- local poll enable
226
                        ist : in std_logic; -- individual status
227
                        -- state inputs
228
                        ACDS : in std_logic; -- accept data state
229
                        LADS : in std_logic; -- listener address state (L or LE)
230
                        -- data input
231
                        dio_data : in std_logic_vector(3 downto 0); -- byte from data lines
232
                        -- remote command inputs
233
                        IDY : in std_logic; -- identify
234
                        PPE : in std_logic; -- parallel poll enable
235
                        PPD : in std_logic; -- parallel poll disable
236
                        PPC : in std_logic; -- parallel poll configure
237
                        PPU : in std_logic; -- parallel poll unconfigure
238
                        PCG : in std_logic; -- primary command group
239
                        -- remote command outputs
240
                        PPR : out std_logic; -- paralel poll response
241
                        -- PPR command data
242
                        ppBitValue : out std_logic; -- bit value
243
                        ppLineNumber : out std_logic_vector (2 downto 0);
244
                        -- reported states
245
                        PPAS : out std_logic -- parallel poll active state
246
                );
247
        end component;
248
 
249
        component if_func_RL is
250
                port(
251
                        -- device inputs
252
                        clk : in std_logic; -- clock
253
                        pon : in std_logic; -- power on
254
                        rtl : in std_logic; -- return to local
255
                        -- state inputs
256
                        ACDS : in std_logic; -- listener active state (AH)
257
                        LADS : in std_logic; -- listener addressed state (L or LE)
258
                        -- instructions
259
                        REN : in std_logic; -- remote enable
260
                        LLO : in std_logic; -- local lockout
261
                        MLA : in std_logic; -- my listen address
262
                        GTL : in std_logic; -- go to local
263
                        -- reported state
264
                        LOCS : out std_logic; -- local state
265
                        LWLS : out std_logic -- local with lockout state
266
                );
267
        end component;
268
 
269
        component if_func_SR is
270
                port(
271
                        -- device inputs
272
                        clk : in std_logic; -- clock
273
                        pon : in std_logic; -- power on
274
                        rsv : in std_logic; -- service request
275
                        -- state inputs
276
                        SPAS : in std_logic; -- serial poll active state (T or TE)
277
                        -- output instructions
278
                        SRQ : out std_logic; -- service request
279
                        -- reported states
280
                        APRS : out std_logic -- affirmative poll response state
281
                );
282
        end component;
283
 
284
        component commandEcoder is
285
                port (
286
                        -- data
287
                        data : in std_logic_vector (7 downto 0);
288
                        -- status byte
289
                        status_byte : in std_logic_vector (7 downto 0);
290
                        -- PPR command data
291
                        ppBitValue : in std_logic;
292
                        ppLineNumber : in std_logic_vector (2 downto 0);
293
                        -- func states
294
                        APRS : in std_logic; -- affirmative poll response state
295
                        CACS : in std_logic; -- controller active state (C)
296
                        -- commands
297
                        ATN : in std_logic;
298
                        END_OF : in std_logic;
299
                        IDY : in std_logic;
300
                        DAC : in std_logic;
301
                        RFD : in std_logic;
302
                        DAV : in std_logic;
303
                        IFC : in std_logic;
304
                        REN : in std_logic;
305
                        SRQ : in std_logic; -- request for service
306
                        DAB : in std_logic;
307
                        EOS : in std_logic;
308
                        RQS : in std_logic; -- part of STB
309
                        STB : in std_logic;
310
                        TCT : in std_logic;
311
                        PPR : in std_logic;
312
                        -------------------------------------------
313
                        -- data lines -----------------------------
314
                        -------------------------------------------
315
                        DO : out std_logic_vector (7 downto 0);
316
                        output_valid : out std_logic;
317
                        -------------------------------------------
318
                        -- control lines --------------------------
319
                        -------------------------------------------
320
                        -- DAV line
321
                        DAV_line : out std_logic;
322
                        -- NRFD line
323
                        NRFD_line : out std_logic;
324
                        -- NDAC line
325
                        NDAC_line : out std_logic;
326
                        -- ATN line
327
                        ATN_line : out std_logic;
328
                        -- EOI line
329
                        EOI_line : out std_logic;
330
                        -- SRQ line
331
                        SRQ_line : out std_logic;
332
                        -- IFC line
333
                        IFC_line : out std_logic;
334
                        -- REN line
335
                        REN_line : out std_logic
336
        );
337
        end component;
338
 
339
        component commandDecoder is
340
                port (
341
 
342
                        -------------------------------------------
343
                        -- data lines -----------------------------
344
                        -------------------------------------------
345
                        DI : in std_logic_vector (7 downto 0);
346
 
347
                        -------------------------------------------
348
                        -- control lines --------------------------
349
                        -------------------------------------------
350
                        -- DAV line
351
                        DAV_line : in std_logic;
352
                        -- NRFD line
353
                        NRFD_line : in std_logic;
354
                        -- NDAC line
355
                        NDAC_line : in std_logic;
356
                        -- ATN line
357
                        ATN_line : in std_logic;
358
                        -- EOI line
359
                        EOI_line : in std_logic;
360
                        -- SRQ line
361
                        SRQ_line : in std_logic;
362
                        -- IFC line
363
                        IFC_line : in std_logic;
364
                        -- REN line
365
                        REN_line : in std_logic;
366
 
367
                        -------------------------------------------
368
                        -- internal settiongs ---------------------
369
                        -------------------------------------------
370
                        -- eos mark
371
                        eosMark : in std_logic_vector (7 downto 0);
372
                        -- eos used
373
                        eosUsed : in std_logic;
374
                        -- my listen address
375
                        myListAddr : in std_logic_vector (4 downto 0);
376
                        -- my talk address
377
                        myTalkAddr : in std_logic_vector (4 downto 0);
378
                        -- secondary address detected
379
                        secAddrDetected : in std_logic;
380
 
381
                        -------------------------------------------
382
                        -- internal states ------------------------
383
                        -------------------------------------------
384
                        -- serial poll active state (T or TE)
385
                        SPAS : in std_logic;
386
 
387
                        -------------------------------------------
388
                        -- single line commands -------------------
389
                        -------------------------------------------
390
                        -- attention
391
                        ATN : out std_logic;
392
                        -- data accepted
393
                        DAC : out std_logic;
394
                        -- data valid
395
                        DAV : out std_logic;
396
                        -- end
397
                        END_c : out std_logic;
398
                        -- identify
399
                        IDY : out std_logic;
400
                        -- interface clear
401
                        IFC : out std_logic;
402
                        -- remote enable
403
                        REN : out std_logic;
404
                        -- ready for data
405
                        RFD : out std_logic;
406
                        -- service request
407
                        SRQ : out std_logic;
408
 
409
                        -------------------------------------------
410
                        -- multi line commands --------------------
411
                        -------------------------------------------
412
                        -- addressed command group
413
                        ACG : out std_logic;
414
                        -- data byte
415
                        DAB : out std_logic;
416
                        -- device clear
417
                        DCL : out std_logic;
418
                        -- end of string
419
                        EOS : out std_logic;
420
                        -- group execute trigger
421
                        GET : out std_logic;
422
                        -- go to local
423
                        GTL : out std_logic;
424
                        -- listen address group
425
                        LAG : out std_logic;
426
                        -- local lockout
427
                        LLO : out std_logic;
428
                        -- my listen address
429
                        MLA : out std_logic;
430
                        -- my talk address
431
                        MTA : out std_logic;
432
                        -- my secondary address
433
                        MSA : out std_logic;
434
                        -- null byte
435
                        NUL : out std_logic;
436
                        -- other secondary address
437
                        OSA : out std_logic;
438
                        -- other talk address
439
                        OTA : out std_logic;
440
                        -- primary command group
441
                        PCG : out std_logic;
442
                        -- parallel poll configure
443
                        PPC : out std_logic;
444
                        -- parallel poll enable
445
                        PPE : out std_logic;
446
                        -- parallel poll disable
447
                        PPD : out std_logic;
448
                        -- parallel poll response
449
                        PPR : out std_logic;
450
                        -- parallel poll unconfigure
451
                        PPU : out std_logic;
452
                        -- request service
453
                        RQS : out std_logic;
454
                        -- secondary command group
455
                        SCG : out std_logic;
456
                        -- selected device clear
457
                        SDC : out std_logic;
458
                        -- serial poll disable
459
                        SPD : out std_logic;
460
                        -- serial poll enable
461
                        SPE : out std_logic;
462
                        -- status byte
463
                        STB : out std_logic;
464
                        -- talk address group
465
                        TAG : out std_logic;
466
                        -- take control
467
                        TCT : out std_logic;
468
                        -- universal command group
469
                        UCG : out std_logic;
470
                        -- unlisten
471
                        UNL : out std_logic;
472
                        -- untalk
473
                        UNT : out std_logic
474
                );
475
        end component;
476
 
477
        component SecondaryAddressDecoder is
478
                port (
479
                        -- secondary address mask
480
                        secAddrMask : in std_logic_vector (31 downto 0);
481
                        -- data input
482
                        DI : in std_logic_vector (4 downto 0);
483
                        -- secondary address detected
484
                        secAddrDetected : out std_logic
485
                );
486
        end component;
487
 
488
        component SecAddrSaver is
489
                port (
490
                        reset : in std_logic;
491
                        ------------------- gpib ----------------------
492
                        TADS : in std_logic;
493
                        TPAS : in std_logic;
494
                        LADS : in std_logic;
495
                        LPAS : in std_logic;
496
                        MSA_Dec : in std_logic;
497
                        DI : in std_logic_vector(4 downto 0);
498
                        currentSecAddr : out std_logic_vector(4 downto 0)
499
                );
500
        end component;
501
 
502
        component gpibInterface is port (
503
                clk : in std_logic;
504
                reset : std_logic;
505
                -- application interface
506
                isLE : in std_logic;
507
                isTE : in std_logic;
508
                lpeUsed : in std_logic;
509
                fixedPpLine : in std_logic_vector (2 downto 0);
510
                eosUsed : in std_logic;
511
                eosMark : in std_logic_vector (7 downto 0);
512
                myListAddr : in std_logic_vector (4 downto 0);
513
                myTalkAddr : in std_logic_vector (4 downto 0);
514
                secAddrMask : in std_logic_vector (31 downto 0);
515
                data : in std_logic_vector (7 downto 0);
516
                status_byte : in std_logic_vector (7 downto 0);
517
                T1 : in std_logic_vector (7 downto 0);
518
                -- local commands to interface
519
                rdy : in std_logic; -- ready for next message (AH)
520
                nba : in std_logic; -- new byte available (SH)
521
                ltn : in std_logic; -- listen (L, LE)
522
                lun : in std_logic; -- local unlisten (L, LE)
523
                lon : in std_logic; -- listen only (L, LE)
524
                ton : in std_logic; -- talk only (T, TE)
525
                endOf : in std_logic; -- end of byte string (T, TE)
526
                gts : in std_logic; -- go to standby (C)
527
                rpp : in std_logic; -- request parallel poll (C)
528
                tcs : in std_logic; -- take control synchronously (C, AH)
529
                tca : in std_logic; -- take control asynchronously (C)
530
                sic : in std_logic; -- send interface clear (C)
531
                rsc : in std_logic; -- request system control (C)
532
                sre : in std_logic; -- send remote enable (C)
533
                rtl : in std_logic; -- return to local (RL)
534
                rsv : in std_logic; -- request service (SR)
535
                ist : in std_logic; -- individual status (PP)
536
                lpe : in std_logic; -- local poll enable (PP)
537
 
538
                -- local commands from interface
539
                dvd : out std_logic; -- data valid (AH)
540
                wnc : out std_logic; -- wait for new cycle (SH)
541
                tac : out std_logic; -- talker active (T, TE)
542
                lac : out std_logic; -- listener active (L, LE)
543
                cwrc : out std_logic; -- controller write commands
544
                cwrd : out std_logic; -- controller write data
545
                clr : out std_logic; -- clear device (DC)
546
                trg : out std_logic; -- trigger device (DT)
547
                atl : out std_logic; -- addressed to listen (T or TE)
548
                att : out std_logic; -- addressed to talk(L or LE)
549
                mla : out std_logic; -- my listen addres decoded (L or LE)
550
                lsb : out std_logic; -- last byte
551
                spa : out std_logic; -- seriall poll active
552
                ppr : out std_logic; -- parallel poll ready
553
                sreq : out std_logic; -- service requested
554
                isLocal : out std_logic; -- device is local controlled
555
                currentSecAddr : out std_logic_vector (4 downto 0); -- current sec addr
556
                -- interface signals
557
                DI : in std_logic_vector (7 downto 0);
558
                DO : out std_logic_vector (7 downto 0);
559
                output_valid : out std_logic;
560
                -- attention
561
                ATN_in : in std_logic;
562
                ATN_out : out std_logic;
563
                -- data valid
564
                DAV_in : in std_logic;
565
                DAV_out : out std_logic;
566
                -- not ready for data
567
                NRFD_in : in std_logic;
568
                NRFD_out : out std_logic;
569
                -- no data accepted
570
                NDAC_in : in std_logic;
571
                NDAC_out : out std_logic;
572
                -- end or identify
573
                EOI_in : in std_logic;
574
                EOI_out : out std_logic;
575
                -- service request
576
                SRQ_in : in std_logic;
577
                SRQ_out : out std_logic;
578
                -- interface clear
579
                IFC_in : in std_logic;
580
                IFC_out : out std_logic;
581
                -- remote enable
582
                REN_in : in std_logic;
583
                REN_out : out std_logic
584
                ;debug1 : out std_logic
585
        );
586
        end component;
587
 
588
end gpibComponents;

powered by: WebSVN 2.1.0

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