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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_3_beta/] [rtl/] [vhdl/] [opc_table.vhd] - Blame information for rev 292

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 arniml
-------------------------------------------------------------------------------
2
--
3
-- The Opcode Decoder Table.
4
-- Decodes the given opcode to instruction mnemonics.
5
-- Also derives the multicycle information.
6
--
7 129 arniml
-- $Id: opc_table.vhd,v 1.3 2004-07-11 16:51:33 arniml Exp $
8 4 arniml
--
9 129 arniml
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
10
--
11 4 arniml
-- All rights reserved
12
--
13
-- Redistribution and use in source and synthezised forms, with or without
14
-- modification, are permitted provided that the following conditions are met:
15
--
16
-- Redistributions of source code must retain the above copyright notice,
17
-- this list of conditions and the following disclaimer.
18
--
19
-- Redistributions in synthesized form must reproduce the above copyright
20
-- notice, this list of conditions and the following disclaimer in the
21
-- documentation and/or other materials provided with the distribution.
22
--
23
-- Neither the name of the author nor the names of other contributors may
24
-- be used to endorse or promote products derived from this software without
25
-- specific prior written permission.
26
--
27
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
31
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37
-- POSSIBILITY OF SUCH DAMAGE.
38
--
39
-- Please report bugs to the author, but before you do so, please
40
-- make sure that this is not a derivative work and that
41
-- you have the latest version of this file.
42
--
43
-- The latest version of this file can be found at:
44
--      http://www.opencores.org/cvsweb.shtml/t48/
45
--
46
-------------------------------------------------------------------------------
47
 
48
library ieee;
49
use ieee.std_logic_1164.all;
50
 
51
use work.t48_pack.word_t;
52
use work.decoder_pack.mnemonic_t;
53
 
54
entity opc_table is
55
 
56
  port (
57
    opcode_i      : in  word_t;
58
    multi_cycle_o : out std_logic;
59
    mnemonic_o    : out mnemonic_t
60
  );
61
 
62
end opc_table;
63
 
64
 
65
use work.decoder_pack.all;
66
 
67
architecture rtl of opc_table is
68
 
69
begin
70
 
71
  -----------------------------------------------------------------------------
72
  -- Process opc_decode
73
  --
74
  -- Purpose:
75
  --  Decode the opcode to the set of mnemonics.
76
  --
77
  opc_decode: process (opcode_i)
78
  begin
79
    -- default assignment
80
    mnemonic_o    <= MN_NOP;
81
    multi_cycle_o <= '0';
82
 
83
    case opcode_i is
84
      -- Mnemonic ADD ---------------------------------------------------------
85
      when "01101000" | "01101001" | "01101010" | "01101011" |  -- ADD A, Rr
86
           "01101100" | "01101101" | "01101110" | "01101111" |  --
87
           "01100000" | "01100001" |                            -- ADD A, @ Rr
88
           "01111000" | "01111001" | "01111010" | "01111011" |  -- ADDC A, Rr
89
           "01111100" | "01111101" | "01111110" | "01111111" |  --
90
           "01110000" | "01110001" =>                           -- ADDC A, @ Rr
91
        mnemonic_o    <= MN_ADD;
92
 
93
      -- Mnemonic ADD_A_DATA --------------------------------------------------
94
      when "00000011" |                                         -- ADD A, data
95
           "00010011" =>                                        -- ADDC A, data
96
        mnemonic_o    <= MN_ADD_A_DATA;
97
        multi_cycle_o <= '1';
98
 
99
      -- Mnemonic ANL ---------------------------------------------------------
100
      when "01011000" | "01011001" | "01011010" | "01011011" |  -- ANL A, Rr
101
           "01011100" | "01011101" | "01011110" | "01011111" |  --
102
           "01010000" | "01010001" =>                           -- ANL A, @ Rr
103
        mnemonic_o    <= MN_ANL;
104
 
105
      -- Mnemonic ANL_A_DATA --------------------------------------------------
106
      when "01010011" =>                                        -- ANL A, data
107
        mnemonic_o    <= MN_ANL_A_DATA;
108
        multi_cycle_o <= '1';
109
 
110
      -- Mnemonic ANL_EXT -----------------------------------------------------
111
      when "10011000" |                                         -- ANL BUS, data
112
           "10011001" | "10011010" =>                           -- ANL PP, data
113
        mnemonic_o    <= MN_ANL_EXT;
114
        multi_cycle_o <= '1';
115
 
116
      -- Mnemonic CALL --------------------------------------------------------
117
      when "00010100" | "00110100" | "01010100" | "01110100" |  -- CALL addr
118
           "10010100" | "10110100" | "11010100" | "11110100" => --
119
        mnemonic_o    <= MN_CALL;
120
        multi_cycle_o <= '1';
121
 
122
      -- Mnemonic CLR_A -------------------------------------------------------
123
      when "00100111" =>                                        -- CLR A
124
        mnemonic_o    <= MN_CLR_A;
125
 
126
      -- Mnemonic CLR_C -------------------------------------------------------
127
      when "10010111" =>                                        -- CLR C
128
        mnemonic_o    <= MN_CLR_C;
129
 
130
      -- Mnemonic CLR_F -------------------------------------------------------
131
      when "10000101" |                                         -- CLR F0
132
           "10100101" =>
133
        mnemonic_o    <= MN_CLR_F;
134
 
135
      -- Mnemonic CPL_A -------------------------------------------------------
136
      when "00110111" =>                                        -- CPL A
137
        mnemonic_o    <= MN_CPL_A;
138
 
139
      -- Mnemonic CPL_C -------------------------------------------------------
140
      when "10100111" =>                                        -- CPL C
141
        mnemonic_o    <= MN_CPL_C;
142
 
143
      -- Mnemonic CPL_F -------------------------------------------------------
144
      when "10010101" |                                         -- CPL F0
145
           "10110101" =>                                        -- CPL F1
146
        mnemonic_o    <= MN_CPL_F;
147
 
148
      -- Mnemonic DA ----------------------------------------------------------
149
      when "01010111" =>                                        -- DA D
150
        mnemonic_o    <= MN_DA;
151
 
152
      -- Mnemonic DEC ---------------------------------------------------------
153
      when "11001000" | "11001001" | "11001010" | "11001011" |  -- DEC Rr
154
           "11001100" | "11001101" | "11001110" | "11001111" |  --
155
           "00000111" =>                                        -- DEC A
156
        mnemonic_o    <= MN_DEC;
157
 
158
      -- Mnemonic DIS_EN_I ----------------------------------------------------
159
      when "00010101" |                                         -- DIS I
160
           "00000101" =>                                        -- EN I
161
        mnemonic_o    <= MN_DIS_EN_I;
162
 
163
      -- Mnemonic DIS_EN_TCNTI ------------------------------------------------
164
      when "00110101" |                                         -- DIS TCNTI
165
           "00100101" =>                                        -- EN TCNTI
166
        mnemonic_o    <= MN_DIS_EN_TCNTI;
167
 
168
      -- Mnemonic DJNZ --------------------------------------------------------
169
      when "11101000" | "11101001" | "11101010" | "11101011" |  -- DJNZ Rr, addr
170
           "11101100" | "11101101" | "11101110" | "11101111" => --
171
        mnemonic_o    <= MN_DJNZ;
172
        multi_cycle_o <= '1';
173
 
174
      -- Mnemonic ENT0_CLK ----------------------------------------------------
175
      when "01110101" =>                                        -- ENT0 CLK
176
        mnemonic_o    <= MN_ENT0_CLK;
177
 
178
      -- Mnemonic IN ----------------------------------------------------------
179
      when "00001001" | "00001010" =>                           -- IN A, Pp
180
        mnemonic_o    <= MN_IN;
181
        multi_cycle_o <= '1';
182
 
183
      -- Mnemonic INC ---------------------------------------------------------
184
      when "00010111" |                                         -- INC A
185
           "00011000" | "00011001" | "00011010" | "00011011" |  -- INC Rr
186
           "00011100" | "00011101" | "00011110" | "00011111" |  --
187
           "00010000" | "00010001" =>                           -- INC @ Rr
188
        mnemonic_o    <= MN_INC;
189
 
190
      -- Mnemonic INS ---------------------------------------------------------
191
      when "00001000" =>                                        -- INS A, BUS
192
        mnemonic_o    <= MN_INS;
193
        multi_cycle_o <= '1';
194
 
195
      -- Mnemonic JBB ---------------------------------------------------------
196
      when "00010010" | "00110010" | "01010010" | "01110010" |  -- JBb addr
197
           "10010010" | "10110010" | "11010010" | "11110010" => --
198
        mnemonic_o    <= MN_JBB;
199
        multi_cycle_o <= '1';
200
 
201
      -- Mnemonic JC ----------------------------------------------------------
202
      when "11110110" |                                         -- JC addr
203
           "11100110" =>                                        -- JNC addr
204
        mnemonic_o    <= MN_JC;
205
        multi_cycle_o <= '1';
206
 
207
      -- Mnemonic JF ----------------------------------------------------------
208
      when "10110110" |                                         -- JF0 addr
209
           "01110110" =>                                        -- JF1 addr
210
        mnemonic_o    <= MN_JF;
211
        multi_cycle_o <= '1';
212
 
213
      -- Mnemonic JMP ---------------------------------------------------------
214
      when "00000100" | "00100100" | "01000100" | "01100100" |  -- JMP addr
215
           "10000100" | "10100100" | "11000100" | "11100100" => --
216
        mnemonic_o    <= MN_JMP;
217
        multi_cycle_o <= '1';
218
 
219
      -- Mnemonic JMPP --------------------------------------------------------
220
      when "10110011" =>                                        -- JMPP @ A
221
        mnemonic_o    <= MN_JMPP;
222
        multi_cycle_o <= '1';
223
 
224
      -- Mnemonic JNI ---------------------------------------------------------
225
      when "10000110" =>                                        -- JNI addr
226
        mnemonic_o    <= MN_JNI;
227
        multi_cycle_o <= '1';
228
 
229
      -- Mnemonic JT ----------------------------------------------------------
230
      when "00100110" |                                         -- JNT0 addr
231
           "01000110" |                                         -- JNT1 addr
232
           "00110110" |                                         -- JT0 addr
233
           "01010110" =>                                        -- JT1 addr
234
        mnemonic_o    <= MN_JT;
235
        multi_cycle_o <= '1';
236
 
237
      -- Mnemonic JTF ---------------------------------------------------------
238
      when "00010110" =>                                        -- JTF addr
239
        mnemonic_o    <= MN_JTF;
240
        multi_cycle_o <= '1';
241
 
242
      -- Mnemonic JZ ----------------------------------------------------------
243
      when "10010110" |                                         -- JNZ addr
244
           "11000110" =>                                        -- JZ addr
245
        mnemonic_o    <= MN_JZ;
246
        multi_cycle_o <= '1';
247
 
248
      -- Mnemonic MOV_A_DATA --------------------------------------------------
249
      when "00100011" =>                                        -- MOV A, data
250
        mnemonic_o    <= MN_MOV_A_DATA;
251
        multi_cycle_o <= '1';
252
 
253
      -- Mnemonic MOV_A_PSW ---------------------------------------------------
254
      when "11000111" =>                                        -- MOV A, PSW
255
        mnemonic_o    <= MN_MOV_A_PSW;
256
 
257
      -- Mnemonic MOV_A_RR ----------------------------------------------------
258
      when "11111000" | "11111001" | "11111010" | "11111011" |  -- MOV A, Rr
259
           "11111100" | "11111101" | "11111110" | "11111111" |  --
260
           "11110000" | "11110001" =>                           -- MOV A, @ Rr
261
        mnemonic_o    <= MN_MOV_A_RR;
262
 
263
      -- Mnemonic MOV_PSW_A ---------------------------------------------------
264
      when "11010111" =>                                        -- MOV PSW, A
265
        mnemonic_o    <= MN_MOV_PSW_A;
266
 
267
      -- Mnemonic MOV_RR ------------------------------------------------------
268
      when "10101000" | "10101001" | "10101010" | "10101011" |  -- MOV Rr, A
269
           "10101100" | "10101101" | "10101110" | "10101111" |  --
270
           "10100000" | "10100001" =>                           -- MOV @ Rr, A
271
        mnemonic_o    <= MN_MOV_RR;
272
 
273
      -- Mnemonic MOV_RR_DATA -------------------------------------------------
274
      when "10111000" | "10111001" | "10111010" | "10111011" |  -- MOV Rr, data
275
           "10111100" | "10111101" | "10111110" | "10111111" |  --
276
           "10110000" | "10110001" =>                           -- MOV @ Rr, data
277
        mnemonic_o    <= MN_MOV_RR_DATA;
278
        multi_cycle_o <= '1';
279
 
280
      -- Mnemonic MOV_T -------------------------------------------------------
281
      when "01100010" |                                         -- MOV T, A
282
           "01000010" =>                                        -- MOV A, T
283
        mnemonic_o    <= MN_MOV_T;
284
 
285 22 arniml
      -- Mnemonic MOVD_A_PP ---------------------------------------------------
286
      when "00001100" | "00001101" | "00001110" | "00001111" => -- MOVD A, Pp
287
        mnemonic_o    <= MN_MOVD_A_PP;
288 4 arniml
        multi_cycle_o <= '1';
289
 
290
      -- Mnemonic MOVP --------------------------------------------------------
291 22 arniml
      when "10100011" |                                         -- MOVP A, @ A
292
           "11100011" =>                                        -- MOVP3 A, @ A
293 4 arniml
        mnemonic_o    <= MN_MOVP;
294
        multi_cycle_o <= '1';
295
 
296
      -- Mnemonic MOVX --------------------------------------------------------
297 22 arniml
      when "10000000" | "10000001" |                            -- MOVX A, @ Rr
298
           "10010000" | "10010001" =>                           -- MOVX @ Rr, A
299 4 arniml
        mnemonic_o    <= MN_MOVX;
300
        multi_cycle_o <= '1';
301
 
302
      -- Mnemonic NOP ---------------------------------------------------------
303 22 arniml
      when "00000000" =>                                        -- NOP
304 4 arniml
        mnemonic_o    <= MN_NOP;
305
 
306
      -- Mnemonic ORL ---------------------------------------------------------
307
      when "01001000" | "01001001" | "01001010" | "01001011" |  -- ORL A, Rr
308
           "01001100" | "01001101" | "01001110" | "01001111" |  --
309
           "01000000" | "01000001" =>                           -- ORL A, @ Rr
310
        mnemonic_o    <= MN_ORL;
311
 
312
      -- Mnemonic ORL_A_DATA --------------------------------------------------
313
      when "01000011" =>                                        -- ORL A, data
314
        mnemonic_o    <= MN_ORL_A_DATA;
315
        multi_cycle_o <= '1';
316
 
317
      -- Mnemonic ORL_EXT -----------------------------------------------------
318
      when "10001000" |                                         -- ORL BUS, data
319
           "10001001" | "10001010" =>                           -- ORL Pp, data
320
        mnemonic_o    <= MN_ORL_EXT;
321
        multi_cycle_o <= '1';
322
 
323 22 arniml
      -- Mnemonic OUTD_PP_A ---------------------------------------------------
324
      when "00111100" | "00111101" | "00111110" | "00111111" |  -- MOVD Pp, A
325
           "10011100" | "10011101" | "10011110" | "10011111" |  -- ANLD PP, A
326
           "10001100" | "10001101" | "10001110" | "10001111" => -- ORLD Pp, A
327
        mnemonic_o    <= MN_OUTD_PP_A;
328 4 arniml
        multi_cycle_o <= '1';
329
 
330
      -- Mnemonic OUTL_EXT ----------------------------------------------------
331
      when "00111001" | "00111010" |                            -- OUTL Pp, A
332
           "00000010" =>                                        -- OUTL BUS, A
333
        mnemonic_o    <= MN_OUTL_EXT;
334
        multi_cycle_o <= '1';
335
 
336
      -- Mnemonic RET ---------------------------------------------------------
337
      when "10000011" |                                         -- RET
338
           "10010011" =>                                        -- RETR
339
        mnemonic_o    <= MN_RET;
340
        multi_cycle_o <= '1';
341
 
342
      -- Mnemonic RL ----------------------------------------------------------
343
      when "11100111" |                                         -- RL A
344
           "11110111" =>                                        -- RLC A
345
        mnemonic_o    <= MN_RL;
346
 
347
      -- Mnemonic RR ----------------------------------------------------------
348
      when "01110111" |                                         -- RR A
349
           "01100111" =>                                        -- RRC A
350
        mnemonic_o    <= MN_RR;
351
 
352
      -- Mnemonic SEL_MB ------------------------------------------------------
353
      when "11100101" |                                         -- SEL MB0
354
           "11110101" =>                                        -- SEL MB1
355
        mnemonic_o    <= MN_SEL_MB;
356
 
357
      -- Mnemonic SEL_RB ------------------------------------------------------
358
      when "11000101" |                                         -- SEL RB0
359
           "11010101" =>                                        -- SEL RB1
360
        mnemonic_o    <= MN_SEL_RB;
361
 
362
      -- Mnemonic STOP_TCNT ---------------------------------------------------
363
      when "01100101" =>                                        -- STOP TCNT
364
        mnemonic_o    <= MN_STOP_TCNT;
365
 
366
      -- Mnemonic START -------------------------------------------------------
367
      when "01000101" |                                         -- STRT CNT
368
           "01010101" =>                                        -- STRT T
369
        mnemonic_o    <= MN_STRT;
370
 
371
      -- Mnemonic SWAP --------------------------------------------------------
372
      when "01000111" =>                                        -- SWAP A
373
        mnemonic_o    <= MN_SWAP;
374
 
375
      -- Mnemonic XCH ---------------------------------------------------------
376
      when "00101000" | "00101001" | "00101010" | "00101011" |  -- XCH A, Rr
377
           "00101100" | "00101101" | "00101110" | "00101111" |  --
378
           "00100000" | "00100001" |                            -- XCH A, @ Rr
379
           "00110000" | "00110001" =>                           -- XCHD A, @ Rr
380
        mnemonic_o    <= MN_XCH;
381
 
382
      -- Mnemonic XRL ---------------------------------------------------------
383
      when "11011000" | "11011001" | "11011010" | "11011011" |  -- XRL A, Rr
384
           "11011100" | "11011101" | "11011110" | "11011111" |  --
385
           "11010000" | "11010001" =>                           -- XRL A, @ Rr
386
        mnemonic_o    <= MN_XRL;
387
 
388
      -- Mnemonic XRL_A_DATA --------------------------------------------------
389
      when "11010011" =>                                        -- XRL A, data
390
        mnemonic_o    <= MN_XRL_A_DATA;
391
        multi_cycle_o <= '1';
392
 
393
      when others =>
394
        -- pragma translate_off
395
        assert now = 0 ns
396
          report "Unknown opcode."
397
          severity warning;
398
        -- pragma translate_on
399
 
400
    end case;
401
 
402
  end process opc_decode;
403
  --
404
  -----------------------------------------------------------------------------
405
 
406
end rtl;
407
 
408
 
409
-------------------------------------------------------------------------------
410
-- File History:
411
--
412
-- $Log: not supported by cvs2svn $
413 129 arniml
-- Revision 1.2  2004/03/28 13:10:48  arniml
414
-- merge MN_ANLD, MN_MOVD_PP_A and MN_ORLD_PP_A to OUTLD_PP_A
415
--
416 22 arniml
-- Revision 1.1  2004/03/23 21:31:52  arniml
417
-- initial check-in
418 4 arniml
--
419
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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