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