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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [commandEncoder.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:      if_func_C
18
-- Date:        23:00:30 10/04/2011
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 commandEcoder is
29
        port (
30
                -- data
31
                data : in std_logic_vector (7 downto 0);
32
                -- status byte
33
                status_byte : in std_logic_vector (7 downto 0);
34
                -- PPR command data
35
                ppBitValue : in std_logic;
36
                ppLineNumber : in std_logic_vector (2 downto 0);
37
                -- func states
38
                APRS : in std_logic; -- affirmative poll response state
39
                CACS : in std_logic; -- controller active state (C)
40
                -- commands
41
                ATN : in std_logic;
42
                END_OF : in std_logic;
43
                IDY : in std_logic;
44
                DAC : in std_logic;
45
                RFD : in std_logic;
46
                DAV : in std_logic;
47
                IFC : in std_logic;
48
                REN : in std_logic;
49
                SRQ : in std_logic; -- request for service
50
                DAB : in std_logic;
51
                EOS : in std_logic;
52
                RQS : in std_logic; -- part of STB
53
                STB : in std_logic;
54
                TCT : in std_logic;
55
                PPR : in std_logic;
56
                -------------------------------------------
57
                -- data lines -----------------------------
58
                -------------------------------------------
59
                DO : out std_logic_vector (7 downto 0);
60
                output_valid : out std_logic;
61
                -------------------------------------------
62
                -- control lines --------------------------
63
                -------------------------------------------
64
                -- DAV line
65
                DAV_line : out std_logic;
66
                -- NRFD line
67
                NRFD_line : out std_logic;
68
                -- NDAC line
69
                NDAC_line : out std_logic;
70
                -- ATN line
71
                ATN_line : out std_logic;
72
                -- EOI line
73
                EOI_line : out std_logic;
74
                -- SRQ line
75
                SRQ_line : out std_logic;
76
                -- IFC line
77
                IFC_line : out std_logic;
78
                -- REN line
79
                REN_line : out std_logic
80
        );
81
end commandEcoder;
82
 
83
architecture arch of commandEcoder is
84
 
85
        signal modified_status_byte : std_logic_vector (7 downto 0);
86
        signal PPR_resp : std_logic_vector (7 downto 0);
87
 
88
begin
89
 
90
        ATN_line <= (ATN or IDY) and not END_OF;
91
        EOI_line <= END_OF or IDY;
92
        DAV_line <= DAV;
93
        NRFD_line <= not RFD;
94
        NDAC_line <= not DAC;
95
        SRQ_line <= SRQ;
96
        IFC_line <= IFC;
97
        REN_line <= REN;
98
 
99
        output_valid <= STB or DAB or EOS or TCT or PPR or CACS;
100
 
101
        DO <=
102
                data when DAB='1' or EOS='1' or CACS='1' else
103
                "00001001" when TCT='1' else
104
                PPR_resp when PPR='1' else
105
                modified_status_byte when STB='1' else
106
                "00000000";
107
 
108
        -- modifies status byte
109
        process (status_byte, APRS) begin
110
                modified_status_byte <= status_byte;
111
                modified_status_byte(6) <= APRS;
112
        end process;
113
 
114
        -- sets PPR response
115
        process (ppBitValue, ppLineNumber) begin
116
 
117
                PPR_resp <= "00000000";
118
 
119
                case ppLineNumber is
120
                        ------------------
121
                        when "000" =>
122
                                PPR_resp(0) <= ppBitValue;
123
                        ------------------
124
                        when "001" =>
125
                                PPR_resp(1) <= ppBitValue;
126
                        ------------------
127
                        when "010" =>
128
                                PPR_resp(2) <= ppBitValue;
129
                        ------------------
130
                        when "011" =>
131
                                PPR_resp(3) <= ppBitValue;
132
                        ------------------
133
                        when "100" =>
134
                                PPR_resp(4) <= ppBitValue;
135
                        ------------------
136
                        when "101" =>
137
                                PPR_resp(5) <= ppBitValue;
138
                        ------------------
139
                        when "110" =>
140
                                PPR_resp(6) <= ppBitValue;
141
                        ------------------
142
                        when others =>
143
                                PPR_resp(7) <= ppBitValue;
144
                end case;
145
        end process;
146
 
147
end arch;
148
 

powered by: WebSVN 2.1.0

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