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 9

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

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2
-- Entity:      if_func_C
3
-- Date:        23:00:30 10/04/2011
4
-- Author:      apaluch
5
--------------------------------------------------------------------------------
6
library ieee;
7
 
8
use ieee.std_logic_1164.all;
9
 
10
use work.utilPkg.all;
11
 
12
 
13
entity commandEcoder is
14
        port (
15
                -- data
16
                data : in std_logic_vector (7 downto 0);
17
                -- status byte
18
                status_byte : in std_logic_vector (7 downto 0);
19
                -- PPR command data
20
                ppBitValue : in std_logic;
21
                ppLineNumber : in std_logic_vector (2 downto 0);
22
                -- func states
23
                APRS : in std_logic; -- affirmative poll response state
24
                CACS : in std_logic; -- controller active state (C)
25
                -- commands
26
                ATN : in std_logic;
27
                END_OF : in std_logic;
28
                IDY : in std_logic;
29
                DAC : in std_logic;
30
                RFD : in std_logic;
31
                DAV : in std_logic;
32
                IFC : in std_logic;
33
                REN : in std_logic;
34
                SRQ : in std_logic; -- request for service
35
                DAB : in std_logic;
36
                EOS : in std_logic;
37
                RQS : in std_logic; -- part of STB
38
                STB : in std_logic;
39
                TCT : in std_logic;
40
                PPR : in std_logic;
41
                -------------------------------------------
42
                -- data lines -----------------------------
43
                -------------------------------------------
44
                DO : out std_logic_vector (7 downto 0);
45
                output_valid : out std_logic;
46
                -------------------------------------------
47
                -- control lines --------------------------
48
                -------------------------------------------
49
                -- DAV line
50
                DAV_line : out std_logic;
51
                -- NRFD line
52
                NRFD_line : out std_logic;
53
                -- NDAC line
54
                NDAC_line : out std_logic;
55
                -- ATN line
56
                ATN_line : out std_logic;
57
                -- EOI line
58
                EOI_line : out std_logic;
59
                -- SRQ line
60
                SRQ_line : out std_logic;
61
                -- IFC line
62
                IFC_line : out std_logic;
63
                -- REN line
64
                REN_line : out std_logic
65
        );
66
end commandEcoder;
67
 
68
architecture arch of commandEcoder is
69
 
70
        signal modified_status_byte : std_logic_vector (7 downto 0);
71
        signal PPR_resp : std_logic_vector (7 downto 0);
72
 
73
begin
74
 
75
        ATN_line <= (ATN or IDY) and not END_OF;
76
        EOI_line <= END_OF or IDY;
77
        DAV_line <= DAV;
78
        NRFD_line <= not RFD;
79
        NDAC_line <= not DAC;
80
        SRQ_line <= SRQ;
81
        IFC_line <= IFC;
82
        REN_line <= REN;
83
 
84
        output_valid <= STB or DAB or EOS or TCT or PPR or CACS;
85
 
86
        DO <=
87
                data when DAB='1' or EOS='1' or CACS='1' else
88
                "00001001" when TCT='1' else
89
                PPR_resp when PPR='1' else
90
                modified_status_byte when STB='1' else
91
                "00000000";
92
 
93
        -- modifies status byte
94
        process (status_byte, APRS) begin
95
                modified_status_byte <= status_byte;
96
                modified_status_byte(6) <= APRS;
97
        end process;
98
 
99
        -- sets PPR response
100
        process (ppBitValue, ppLineNumber) begin
101
 
102
                PPR_resp <= "00000000";
103
 
104
                case ppLineNumber is
105
                        ------------------
106
                        when "000" =>
107
                                PPR_resp(0) <= ppBitValue;
108
                        ------------------
109
                        when "001" =>
110
                                PPR_resp(1) <= ppBitValue;
111
                        ------------------
112
                        when "010" =>
113
                                PPR_resp(2) <= ppBitValue;
114
                        ------------------
115
                        when "011" =>
116
                                PPR_resp(3) <= ppBitValue;
117
                        ------------------
118
                        when "100" =>
119
                                PPR_resp(4) <= ppBitValue;
120
                        ------------------
121
                        when "101" =>
122
                                PPR_resp(5) <= ppBitValue;
123
                        ------------------
124
                        when "110" =>
125
                                PPR_resp(6) <= ppBitValue;
126
                        ------------------
127
                        when others =>
128
                                PPR_resp(7) <= ppBitValue;
129
                end case;
130
        end process;
131
 
132
end arch;
133
 

powered by: WebSVN 2.1.0

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