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

Subversion Repositories t400

[/] [t400/] [trunk/] [rtl/] [vhdl/] [t400_mnemonic_pack-p.vhd] - Blame information for rev 179

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 169 arniml
-------------------------------------------------------------------------------
2
--
3 179 arniml
-- $Id: t400_mnemonic_pack-p.vhd 179 2009-04-01 19:48:38Z arniml $
4 169 arniml
--
5
-- Copyright (c) 2008, Arnim Laeuger (arniml@opencores.org)
6
--
7
-- All rights reserved
8
--
9
-------------------------------------------------------------------------------
10
 
11
use work.t400_pack.byte_t;
12
 
13
package t400_mnemonic_pack is
14
 
15
  -- Mnemonics ----------------------------------------------------------------
16
  type    mnemonic_t is (-- Arithmetic instructions
17
                         MN_ASC,
18
                         MN_ADD,
19
                         MN_ADT,
20
                         MN_AISC,
21
                         MN_CASC,
22
                         MN_CLRA,
23
                         MN_COMP,
24
                         MN_NOP,
25
                         MN_C,
26
                         MN_XOR,
27
                         -- Transfer of control instructions
28
                         MN_JID,
29
                         MN_JMP,
30
                         MN_JP_JSRP,
31
                         MN_JSR,
32
                         MN_RET,
33
                         MN_RETSK,
34
                         -- Memory reference instructions
35
                         MN_LD,
36
                         MN_LDD_XAD,
37
                         MN_LQID,
38
                         MN_RMB,
39
                         MN_SMB,
40
                         MN_STII,
41
                         MN_X,
42
                         MN_XDS,
43
                         MN_XIS,
44
                         -- Register reference instructions
45
                         MN_CAB,
46
                         MN_CBA,
47
                         MN_LBI,
48
                         MN_XABR,
49
                         -- Test instructions
50
                         MN_SKC,
51
                         MN_SKE,
52
                         MN_SKMBZ,
53
                         MN_SKT,
54
                         -- Input/output instructions
55
                         MN_EXT,
56
                         MN_XAS);
57
 
58
  type mnemonic_rec_t is
59
    record
60
      mnemonic   : mnemonic_t;
61
      multi_byte : boolean;
62
    end record;
63
 
64
  function decode_opcode_f(opcode   : in byte_t;
65
                           opt_type : in integer) return
66
    mnemonic_rec_t;
67
 
68
end t400_mnemonic_pack;
69
 
70
 
71
library ieee;
72
use ieee.std_logic_1164.all;
73
 
74
use work.t400_opt_pack.t400_opt_type_410_c;
75
 
76
package body t400_mnemonic_pack is
77
 
78
  function decode_opcode_f(opcode   : in byte_t;
79
                           opt_type : in integer) return
80
    mnemonic_rec_t is
81
    variable t41x_type_v  : boolean;
82
    variable mnemonic_v   : mnemonic_t;
83
    variable multi_byte_v : boolean;
84
    variable result_v     : mnemonic_rec_t;
85
  begin
86
    -- default assignment
87
    mnemonic_v   := MN_NOP;
88
    multi_byte_v := false;
89
    -- determine type
90
    t41x_type_v  := opt_type = t400_opt_type_410_c;
91
 
92
    case opcode is
93
      -- Mnemonic ASC----------------------------------------------------------
94
      when "00110000" =>
95
        mnemonic_v   := MN_ASC;
96
 
97
      -- Mnemonic ADD ---------------------------------------------------------
98
      when "00110001" =>
99
        mnemonic_v   := MN_ADD;
100
 
101
      -- Mnemonic ADT ---------------------------------------------------------
102
      when "01001010" =>
103
        if not t41x_type_v then
104
          mnemonic_v := MN_ADT;
105
        end if;
106
 
107
      -- Mnemonic AISC --------------------------------------------------------
108
      when "01010001" | "01010010" | "01010011" |
109
           "01010100" | "01010101" | "01010110" | "01010111" |
110
           "01011000" | "01011001" | "01011010" | "01011011" |
111
           "01011100" | "01011101" | "01011110" | "01011111" =>
112
        mnemonic_v   := MN_AISC;
113
 
114
      -- Mnemonic CASC --------------------------------------------------------
115
      when "00010000" =>
116
        if not t41x_type_v then
117
          mnemonic_v := MN_CASC;
118
        end if;
119
 
120
      -- Mnemonic CLRA --------------------------------------------------------
121
      when "00000000" =>
122
        mnemonic_v   := MN_CLRA;
123
 
124
      -- Mnemonic COMP --------------------------------------------------------
125
      when "01000000" =>
126
        mnemonic_v   := MN_COMP;
127
 
128
      -- Mnemonic NOP ---------------------------------------------------------
129
      when "01000100" =>
130
        mnemonic_v   := MN_NOP;
131
 
132
      -- Mnemonic C -----------------------------------------------------------
133
      when "00110010" |                                         -- RC
134
           "00100010" =>                                        -- SC
135
        mnemonic_v   := MN_C;
136
 
137
      -- Mnemonic XOR ---------------------------------------------------------
138
      when "00000010" =>
139
        mnemonic_v   := MN_XOR;
140
 
141
      -- Mnemonic JID ---------------------------------------------------------
142
      when "11111111" =>
143
        mnemonic_v   := MN_JID;
144
 
145
      -- Mnemonic JMP ---------------------------------------------------------
146
      when "01100000" | "01100001" | "01100010" | "01100011" =>
147
        mnemonic_v   := MN_JMP;
148
        multi_byte_v := true;
149
 
150
      -- Mnemonic JP_JSRP -----------------------------------------------------
151
      when "10000000" | "10000001" | "10000010" | "10000011" |
152
           "10000100" | "10000101" | "10000110" | "10000111" |
153
           "10001000" | "10001001" | "10001010" | "10001011" |
154
           "10001100" | "10001101" | "10001110" | "10001111" |
155
           "10010000" | "10010001" | "10010010" | "10010011" |
156
           "10010100" | "10010101" | "10010110" | "10010111" |
157
           "10011000" | "10011001" | "10011010" | "10011011" |
158
           "10011100" | "10011101" | "10011110" | "10011111" |
159
           "10100000" | "10100001" | "10100010" | "10100011" |
160
           "10100100" | "10100101" | "10100110" | "10100111" |
161
           "10101000" | "10101001" | "10101010" | "10101011" |
162
           "10101100" | "10101101" | "10101110" | "10101111" |
163
           "10110000" | "10110001" | "10110010" | "10110011" |
164
           "10110100" | "10110101" | "10110110" | "10110111" |
165
           "10111000" | "10111001" | "10111010" | "10111011" |
166
           "10111100" | "10111101" | "10111110" |
167
           "11000000" | "11000001" | "11000010" | "11000011" |
168
           "11000100" | "11000101" | "11000110" | "11000111" |
169
           "11001000" | "11001001" | "11001010" | "11001011" |
170
           "11001100" | "11001101" | "11001110" | "11001111" |
171
           "11010000" | "11010001" | "11010010" | "11010011" |
172
           "11010100" | "11010101" | "11010110" | "11010111" |
173
           "11011000" | "11011001" | "11011010" | "11011011" |
174
           "11011100" | "11011101" | "11011110" | "11011111" |
175
           "11100000" | "11100001" | "11100010" | "11100011" |
176
           "11100100" | "11100101" | "11100110" | "11100111" |
177
           "11101000" | "11101001" | "11101010" | "11101011" |
178
           "11101100" | "11101101" | "11101110" | "11101111" |
179
           "11110000" | "11110001" | "11110010" | "11110011" |
180
           "11110100" | "11110101" | "11110110" | "11110111" |
181
           "11111000" | "11111001" | "11111010" | "11111011" |
182
           "11111100" | "11111101" | "11111110" =>
183
        mnemonic_v   := MN_JP_JSRP;
184
 
185
      -- Mnemonic JSR ---------------------------------------------------------
186
      when "01101000" | "01101001" | "01101010" | "01101011" =>
187
        mnemonic_v   := MN_JSR;
188
        multi_byte_v := true;
189
 
190
      -- Mnemonic RET ---------------------------------------------------------
191
      when "01001000" =>
192
        mnemonic_v   := MN_RET;
193
 
194
      -- Mnemonic RETSK -------------------------------------------------------
195
      when "01001001" =>
196
        mnemonic_v   := MN_RETSK;
197
 
198
      -- Mnemonic LD ----------------------------------------------------------
199
      when "00000101" | "00010101" | "00100101" | "00110101" =>
200
        mnemonic_v   := MN_LD;
201
 
202
      -- Mnemonic LDD_XAD -----------------------------------------------------
203
      when "00100011" =>
204
        mnemonic_v   := MN_LDD_XAD;
205
        multi_byte_v := true;
206
 
207
      -- Mnemonic LQID --------------------------------------------------------
208
      when "10111111" =>
209
        mnemonic_v   := MN_LQID;
210
 
211
      -- Mnemonic RMB ---------------------------------------------------------
212
      when "01001100" | "01000101" | "01000010" | "01000011" =>
213
        mnemonic_v   := MN_RMB;
214
 
215
      -- Mnemonic SMB ---------------------------------------------------------
216
      when "01001101" | "01000111" | "01000110" | "01001011" =>
217
        mnemonic_v   := MN_SMB;
218
 
219
      -- Mnemonic STII --------------------------------------------------------
220
      when "01110000" | "01110001" | "01110010" | "01110011" |
221
           "01110100" | "01110101" | "01110110" | "01110111" |
222
           "01111000" | "01111001" | "01111010" | "01111011" |
223
           "01111100" | "01111101" | "01111110" | "01111111" =>
224
        mnemonic_v   := MN_STII;
225
 
226
      -- Mnemonic X -----------------------------------------------------------
227
      when "00000110" | "00010110" | "00100110" | "00110110" =>
228
        mnemonic_v   := MN_X;
229
 
230
      -- Mnemonic XDS ---------------------------------------------------------
231
      when "00000111" | "00010111" | "00100111" | "00110111" =>
232
        mnemonic_v   := MN_XDS;
233
 
234
      -- Mnemonic XIS ---------------------------------------------------------
235
      when "00000100" | "00010100" | "00100100" | "00110100" =>
236
        mnemonic_v   := MN_XIS;
237
 
238
      -- Mnemonic CAB ---------------------------------------------------------
239
      when "01010000" =>
240
        mnemonic_v   := MN_CAB;
241
 
242
      -- Mnemonic CBA ---------------------------------------------------------
243
      when "01001110" =>
244
        mnemonic_v   := MN_CBA;
245
 
246
      -- Mnemonic LBI ---------------------------------------------------------
247
      when "00001000" | "00001001" | "00001010" | "00001011" |
248
           "00001100" | "00001101" | "00001110" | "00001111" |
249
           "00011000" | "00011001" | "00011010" | "00011011" |
250
           "00011100" | "00011101" | "00011110" | "00011111" |
251
           "00101000" | "00101001" | "00101010" | "00101011" |
252
           "00101100" | "00101101" | "00101110" | "00101111" |
253
           "00111000" | "00111001" | "00111010" | "00111011" |
254
           "00111100" | "00111101" | "00111110" | "00111111" =>
255
        mnemonic_v   := MN_LBI;
256
 
257
      -- Mnemonic XABR --------------------------------------------------------
258
      when "00010010" =>
259
        if not t41x_type_v then
260
          mnemonic_v := MN_XABR;
261
        end if;
262
 
263
      -- Mnemonic SKC ---------------------------------------------------------
264
      when "00100000" =>
265
        mnemonic_v   := MN_SKC;
266
 
267
      -- Mnemonic SKE ---------------------------------------------------------
268
      when "00100001" =>
269
        mnemonic_v   := MN_SKE;
270
 
271
      -- Mnemonic SKMBZ -------------------------------------------------------
272
      when "00000001" | "00010001" | "00000011" | "00010011" =>
273
        mnemonic_v   := MN_SKMBZ;
274
 
275
      -- Mnemonic SKT ---------------------------------------------------------
276
      when "01000001" =>
277
        if not t41x_type_v then
278
          mnemonic_v := MN_SKT;
279
        end if;
280
 
281
      -- Mnemonic XAS ---------------------------------------------------------
282
      when "01001111" =>
283
        mnemonic_v   := MN_XAS;
284
 
285
      -- Mnemonic EXT ---------------------------------------------------------
286
      when "00110011" =>
287
        mnemonic_v   := MN_EXT;
288
        multi_byte_v := true;
289
 
290
 
291
      when others =>
292
        null;
293
    end case;
294
 
295
    result_v.mnemonic   := mnemonic_v;
296
    result_v.multi_byte := multi_byte_v;
297
 
298
    return result_v;
299
  end;
300
 
301
end t400_mnemonic_pack;

powered by: WebSVN 2.1.0

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