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

Subversion Repositories c16

[/] [c16/] [trunk/] [vhdl/] [opcode_decoder.vhd] - Blame information for rev 31

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

Line No. Rev Author Line
1 2 jsauermann
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
--  Uncomment the following lines to use the declarations that are
7
--  provided for instantiating Xilinx primitive components.
8
--library UNISIM;
9
--use UNISIM.VComponents.all;
10
 
11
use work.cpu_pack.ALL;
12
 
13
entity opcode_decoder is
14
        PORT(   CLK_I  : IN  std_logic;
15
                        T2     : IN  std_logic;
16
                        CLR    : IN  std_logic;
17
                        CE     : IN  std_logic;
18
                        OPCODE : IN  std_logic_vector(7 downto 0);
19 9 jsauermann
                        OP_CYC : IN  cycle;                                     -- current cycle (M1, M2, ...)
20
                        INT    : IN  std_logic;                         -- interrupt
21
                        RRZ    : IN  std_logic;                         -- RR is zero
22 2 jsauermann
 
23
                        OP_CAT : OUT op_category;
24
 
25
                        -- select signals
26
                        D_SX    : out std_logic_vector(1 downto 0);              -- ALU select X
27
                        D_SY    : out std_logic_vector(3 downto 0);              -- ALU select Y
28
                        D_OP    : out std_logic_vector(4 downto 0);              -- ALU operation
29
                        D_SA    : out std_logic_vector(4 downto 0);              -- select address
30
                        D_SMQ   : out std_logic;
31
 
32
                        -- write enable/select signal
33
                        D_WE_RR  : out std_logic;
34
                        D_WE_LL  : out std_logic;
35
                        D_WE_SP  : out SP_OP;
36
 
37 9 jsauermann
                        D_RD_O   : out std_logic;
38
                        D_WE_O   : out std_logic;
39
                        D_LOCK   : out std_logic;
40
 
41 2 jsauermann
                        -- input/output
42 9 jsauermann
                        D_IO     : out std_logic;
43 2 jsauermann
 
44
                        PC_OP  : out std_logic_vector(2 downto 0);
45
 
46
                        LAST_M : out std_logic;         -- last M cycle of an opcode
47
                        HLT    : out std_logic
48
                );
49
end opcode_decoder;
50
 
51
architecture Behavioral of opcode_decoder is
52
 
53
        function pc(A : std_logic;
54
                                OP : std_logic_vector(2 downto 0)) return std_logic_vector is
55
        begin
56
                if (A = '1') then       return OP;
57
                else                            return PC_NEXT;
58
                end if;
59
        end;
60
 
61
        function hadr(  A   : std_logic;
62
                                        ADR : std_logic_vector(4 downto 0)) return std_logic_vector is
63
        begin
64
                return ADR(4 downto 1) & A;
65
        end;
66
 
67
        function mix(A : std_logic) return std_logic_vector is
68
        begin
69
                if (A = '1') then       return ALU_X_MIX_Y;
70
                else                            return ALU_MOVE_Y;
71
                end if;
72
        end;
73
 
74
        function sp(A : std_logic;
75
                                OP : SP_OP) return SP_OP is
76
        begin
77
                if (A = '1') then       return OP;
78
                else                            return SP_NOP;
79
                end if;
80
        end;
81
 
82
        signal LAST         : cycle;
83
 
84
        signal ENABLE_INT   : std_logic;
85
        signal DISABLE_INT  : std_logic;
86
        signal DISABLE_CNT  : std_logic_vector(3 downto 0);
87
 
88
        signal HALT_REQ     : std_logic;
89
        signal UNHALT_REQ   : std_logic;
90
        signal HALTED       : std_logic;
91 17 jsauermann
        signal INT_M1       : std_logic;
92
        signal INT_M2       : std_logic;
93 2 jsauermann
 
94
begin
95
 
96
        LAST_M <= '1' when (OP_CYC = LAST) else '0';
97
 
98 17 jsauermann
        HLT    <= HALTED;       -- show when CPU is halted
99
        -- HLT    <= '1' when DISABLE_CNT = 0 else '0'; -- show when ints enabled
100 2 jsauermann
 
101 21 jsauermann
        process(CLK_I, CLR)
102 2 jsauermann
        begin
103 21 jsauermann
                if (CLR = '1') then
104
                        DISABLE_CNT <= "0001";  -- 1 x disabled
105
                        INT_M2      <= '0';
106
                        HALTED      <= '0';
107
                elsif ((rising_edge(CLK_I) and T2 = '1') and CE = '1' ) then
108
                        if (DISABLE_INT = '1') then
109
                                DISABLE_CNT <= DISABLE_CNT + 1;
110
                        elsif (ENABLE_INT  = '1' and DISABLE_CNT /= 0) then
111
                                DISABLE_CNT <= DISABLE_CNT - 1;
112
                        end if;
113 2 jsauermann
 
114 21 jsauermann
                        if (UNHALT_REQ = '1') then
115
                                HALTED <= '0';
116
                        elsif (HALT_REQ = '1') then
117
                                HALTED <= '1';
118
                        end if;
119 2 jsauermann
 
120 21 jsauermann
                        INT_M2 <= INT_M1;
121 2 jsauermann
                end if;
122
        end process;
123
 
124 17 jsauermann
        process(OPCODE, OP_CYC, INT, RRZ, INT_M2, DISABLE_CNT, HALTED)
125 2 jsauermann
 
126
                variable        IS_M1                   : std_logic;
127
                variable        IS_M2, IS_M1_M2 : std_logic;
128
                variable        IS_M3, IS_M2_M3 : std_logic;
129
                variable        IS_M4, IS_M3_M4 : std_logic;
130
                variable        IS_M5                   : std_logic;
131
 
132
        begin
133
                if (OP_CYC = M1) then   IS_M1 := '1';   else    IS_M1 := '0';    end if;
134
                if (OP_CYC = M2) then   IS_M2 := '1';   else    IS_M2 := '0';    end if;
135
                if (OP_CYC = M3) then   IS_M3 := '1';   else    IS_M3 := '0';    end if;
136
                if (OP_CYC = M4) then   IS_M4 := '1';   else    IS_M4 := '0';    end if;
137
                if (OP_CYC = M5) then   IS_M5 := '1';   else    IS_M5 := '0';    end if;
138
 
139
                IS_M1_M2                := IS_M1 or IS_M2;
140
                IS_M2_M3                :=          IS_M2 or IS_M3;
141
                IS_M3_M4                :=                   IS_M3 or IS_M4;
142
 
143
                -- default: NOP
144
                --
145
                OP_CAT      <= undef;
146
                D_SX        <= SX_ANY;
147
                D_SY        <= SY_ANY;
148
                D_OP        <= "00000";
149
                D_SA        <= "00000";
150
                D_SMQ       <= '0';
151
                D_WE_RR     <= '0';
152
                D_WE_LL     <= '0';
153
                D_WE_SP     <= SP_NOP;
154 9 jsauermann
                D_WE_O      <= '0';
155
                D_RD_O      <= '0';
156
                D_LOCK      <= '0';
157
                D_IO        <= '0';
158 2 jsauermann
                PC_OP       <= PC_NEXT;
159
                LAST        <= M1;                      -- default: single cycle opcode (M1 only)
160
                ENABLE_INT  <= '0';
161
                DISABLE_INT <= '0';
162
                HALT_REQ    <= '0';
163
                UNHALT_REQ  <= '0';
164 17 jsauermann
                INT_M1      <= '0';
165 2 jsauermann
 
166
                if ((IS_M1 = '1' and INT = '1' and DISABLE_CNT = "0000")        -- new INT or
167 17 jsauermann
                        or INT_M2 = '1' ) then                                                  -- continue INT
168 2 jsauermann
                        OP_CAT      <= INTR;
169
                        LAST        <= M2;
170 17 jsauermann
                        INT_M1      <= IS_M1;
171 2 jsauermann
                        D_OP        <= ALU_X_ADD_Y;
172
                        D_SX        <= SX_PC;
173
                        D_SY        <= SY_SY0;          -- PC + 0 (current PC)
174
                        D_SA        <= ADR_dSP;
175 9 jsauermann
                        D_WE_O      <= IS_M1_M2;
176
                        D_LOCK      <= IS_M1;
177 2 jsauermann
                        PC_OP       <= pc(IS_M1, PC_INT);
178
                        D_SMQ       <= IS_M1;
179
                        D_WE_SP     <= sp(IS_M1_M2, SP_LOAD);
180 17 jsauermann
                        DISABLE_INT <= IS_M1;
181 2 jsauermann
                        UNHALT_REQ  <= '1';
182
 
183
                elsif (HALTED = '1') then
184
                        OP_CAT      <= HALT_WAIT;
185
                        LAST        <= M2;
186
                        PC_OP       <= PC_WAIT;
187
 
188
                elsif (OPCODE(7) = '1') then
189
                        case OPCODE(6 downto 4) is
190
                                when "010" =>
191
                                        OP_CAT  <= ADD_RR_I;
192
                                        D_OP    <= ALU_X_ADD_Y;
193
                                        D_SX    <= SX_RR;
194
                                        D_SY    <= SY_UQ;
195
                                        D_WE_RR <= IS_M1;
196
 
197
                                when "011" =>
198
                                        OP_CAT  <= SUB_RR_I;
199
                                        D_OP    <= ALU_X_SUB_Y;
200
                                        D_SX    <= SX_RR;
201
                                        D_SY    <= SY_UQ;
202
                                        D_WE_RR <= IS_M1;
203
 
204
                                when "100" =>
205
                                        OP_CAT  <= MOVE_I_RR;
206
                                        D_OP    <= ALU_MOVE_Y;
207
                                        D_SX    <= SX_ANY;
208
                                        D_SY    <= SY_SQ;
209
                                        D_WE_RR <= IS_M1;
210
 
211
                                when "101" =>
212
                                        OP_CAT  <= SEQ_LL_I;
213
                                        D_OP    <= ALU_X_EQ_Y;
214
                                        D_SX    <= SX_LL;
215
                                        D_SY    <= SY_SQ;
216
                                        D_WE_RR <= IS_M1;               -- !! RR
217
 
218
                                when "110" =>
219
                                        OP_CAT  <= MOVE_I_LL;
220
                                        D_OP    <= ALU_MOVE_Y;
221
                                        D_SX    <= SX_ANY;
222
                                        D_SY    <= SY_UQ;
223
                                        D_WE_LL <= IS_M1;
224
 
225
                                when "111" =>
226
                                        case OPCODE(3 downto 0) is
227
                                                when "0100" =>
228
                                                        OP_CAT  <= ADD_RR_I;
229
                                                        D_OP    <= ALU_X_ADD_Y;
230
                                                        D_SX    <= SX_RR;
231
                                                        D_SY    <= SY_I16;
232
                                                        LAST    <= M3;
233
                                                        D_WE_RR <= IS_M3;
234
 
235
                                                when "0101" =>
236
                                                        OP_CAT  <= ADD_RR_I;
237
                                                        D_OP    <= ALU_X_ADD_Y;
238
                                                        D_SX    <= SX_RR;
239
                                                        D_SY    <= SY_UI8;
240
                                                        LAST    <= M2;
241
                                                        D_WE_RR <= IS_M2;
242
 
243
                                                when "0110" =>
244
                                                        OP_CAT  <= SUB_RR_I;
245
                                                        D_OP    <= ALU_X_SUB_Y;
246
                                                        D_SX    <= SX_RR;
247
                                                        D_SY    <= SY_I16;
248
                                                        LAST    <= M3;
249
                                                        D_WE_RR <= IS_M3;
250
 
251
                                                when "0111" =>
252
                                                        OP_CAT  <= SUB_RR_I;
253
                                                        D_OP    <= ALU_X_SUB_Y;
254
                                                        D_SX    <= SX_RR;
255
                                                        D_SY    <= SY_UI8;
256
                                                        LAST    <= M2;
257
                                                        D_WE_RR <= IS_M2;
258
 
259
                                                when "1000" =>
260
                                                        OP_CAT <= MOVE_I_RR;
261
                                                        D_OP   <= ALU_MOVE_Y;
262
                                                        D_SX   <= SX_ANY;
263
                                                        D_SY   <= SY_I16;
264
                                                        LAST    <= M3;
265
                                                        D_WE_RR <= IS_M3;
266
 
267
                                                when "1001" =>
268
                                                        OP_CAT  <= MOVE_I_RR;
269
                                                        D_OP    <= ALU_MOVE_Y;
270
                                                        D_SX    <= SX_ANY;
271
                                                        D_SY    <= SY_SI8;
272
                                                        LAST    <= M2;
273
                                                        D_WE_RR <= IS_M2;
274
 
275
                                                when "1010" =>
276
                                                        OP_CAT <= SEQ_LL_I;
277
                                                        D_OP   <= ALU_X_EQ_Y;
278
                                                        D_SX   <= SX_LL;
279
                                                        D_SY   <= SY_I16;
280
                                                        LAST    <= M3;
281
                                                        D_WE_RR <= IS_M3;                       -- SEQ sets RR !
282
 
283
                                                when "1011" =>
284
                                                        OP_CAT  <= SEQ_LL_I;
285
                                                        D_OP    <= ALU_X_EQ_Y;
286
                                                        D_SX    <= SX_LL;
287
                                                        D_SY    <= SY_SI8;
288
                                                        LAST    <= M2;
289
                                                        D_WE_RR <= IS_M2;                       -- SEQ sets RR !
290
 
291
                                                when "1100" =>
292
                                                        OP_CAT <= MOVE_I_LL;
293
                                                        D_OP   <= ALU_MOVE_Y;
294
                                                        D_SX   <= SX_ANY;
295
                                                        D_SY   <= SY_I16;
296
                                                        LAST    <= M3;
297
                                                        D_WE_LL <= IS_M3;
298
 
299
                                                when "1101" =>
300
                                                        OP_CAT  <= MOVE_I_LL;
301
                                                        D_OP    <= ALU_MOVE_Y;
302
                                                        D_SX    <= SX_ANY;
303
                                                        D_SY    <= SY_SI8;
304
                                                        LAST    <= M2;
305
                                                        D_WE_LL <= IS_M2;
306
 
307
                                        when others =>  -- undefined
308
                                end case;
309
 
310
                                when others =>  -- undefined
311
                        end case;
312
                else
313
                        case OPCODE(6 downto 0) is
314
                                -- 00000000000000000000000000000000000000000000000000000000000000000000
315
                                when "0000000" =>
316
                                        OP_CAT   <= HALT;
317
                                        HALT_REQ <= '1';
318
                                        PC_OP    <= PC_WAIT;
319
 
320
                                when "0000001" =>
321
                                        OP_CAT <= NOP;
322
 
323
                                when "0000010" =>
324
                                        OP_CAT <= JMP_i;
325
                                        LAST   <= M3;
326
                                        PC_OP  <= pc(IS_M2, PC_JMP);
327
 
328
                                when "0000011" =>
329
                                        OP_CAT <= JMP_RRNZ_i;
330
                                        LAST   <= M3;
331
                                        PC_OP  <= pc(IS_M2 and not RRZ, PC_JMP);
332
 
333
                                when "0000100" =>
334
                                        OP_CAT <= JMP_RRZ_i;
335
                                        LAST   <= M3;
336
                                        PC_OP  <= pc(IS_M2 and RRZ, PC_JMP);
337
 
338
                                when "0000101" =>
339
                                        OP_CAT  <= CALL_i;
340
                                        LAST    <= M3;
341
                                        D_OP    <= ALU_X_ADD_Y;
342
                                        D_SX    <= SX_PC;
343
                                        D_SY    <= SY_SY3;              -- PC + 3
344
                                        D_SA    <= ADR_dSP;
345 9 jsauermann
                                        D_WE_O  <= IS_M1_M2;
346
                                        D_LOCK  <= IS_M1;
347 2 jsauermann
                                        PC_OP   <= pc(IS_M2, PC_JMP);
348
                                        D_SMQ   <= IS_M1;
349
                                        D_WE_SP <= sp(IS_M1_M2, SP_LOAD);
350
 
351
                                when "0000110" =>
352
                                        OP_CAT  <= CALL_RR;
353
                                        LAST    <= M2;
354
                                        D_OP    <= ALU_X_ADD_Y;
355
                                        D_SX    <= SX_PC;
356
                                        D_SY    <= SY_SY1;              -- PC + 1
357
                                        D_SA    <= ADR_dSP;
358 9 jsauermann
                                        D_WE_O  <= IS_M1_M2;
359
                                        D_LOCK  <= IS_M1;
360 2 jsauermann
                                        PC_OP   <= pc(IS_M1, PC_JPRR);
361
                                        D_SMQ   <= IS_M1;
362
                                        D_WE_SP <= sp(IS_M1_M2, SP_LOAD);
363
 
364
                                when "0000111" | "1111000" =>
365
                                        if (OPCODE(0) = '1') then
366
                                                OP_CAT      <= RET;
367
                                        else
368
                                                OP_CAT      <= RETI;
369 17 jsauermann
                                                ENABLE_INT  <= IS_M1;
370 2 jsauermann
                                        end if;
371
 
372
                                        LAST    <= M5;
373
                                        D_SA    <= ADR_SPi;             -- read address: (SP)+
374 9 jsauermann
                                        D_RD_O  <= IS_M1_M2;
375
                                        D_LOCK  <= IS_M1;
376 2 jsauermann
                                        D_WE_SP <= sp(IS_M1_M2, SP_INC);
377
                                        case OP_CYC is
378
                                                when M1 =>      PC_OP   <= PC_WAIT;
379
                                                when M2 =>      PC_OP   <= PC_WAIT;
380
                                                when M3 =>      PC_OP   <= PC_RETL;
381
                                                when M4 =>      PC_OP   <= PC_RETH;
382
                                                when others =>
383
                                        end case;
384
 
385
                                when "0001000" =>
386 9 jsauermann
                                        OP_CAT  <= MOVE_SPi_RR;
387
                                        D_SX    <= SX_RR;
388
                                        D_SY    <= SY_UM;
389
                                        D_SA    <= ADR_SPi;
390
                                        D_RD_O  <= IS_M1_M2;
391
                                        D_LOCK  <= IS_M1;
392
                                        LAST    <= M3;
393
                                        PC_OP   <= pc(IS_M1_M2, PC_WAIT);
394 2 jsauermann
                                        D_WE_RR <= IS_M2_M3;
395
                                        D_WE_SP <= sp(IS_M1_M2, SP_INC);
396
                                        D_OP    <= mix(IS_M3);
397
 
398
                                when "0001001" =>
399
                                        OP_CAT  <= MOVE_SPi_RS;
400
                                        LAST    <= M2;
401
                                        D_OP    <= ALU_MOVE_Y;
402
                                        D_SX    <= SX_ANY;
403
                                        D_SY    <= SY_SM;
404
                                        D_SA    <= ADR_SPi;
405 9 jsauermann
                                        D_RD_O  <= IS_M1;
406 2 jsauermann
                                        D_WE_RR <= IS_M2;
407
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
408
                                        D_WE_SP <= sp(IS_M1, SP_INC);
409
 
410
                                when "0001010" =>
411
                                        OP_CAT  <= MOVE_SPi_RU;
412
                                        LAST    <= M2;
413
                                        D_OP    <= ALU_MOVE_Y;
414
                                        D_SX    <= SX_ANY;
415
                                        D_SY    <= SY_UM;
416
                                        D_SA    <= ADR_SPi;
417 9 jsauermann
                                        D_RD_O  <= IS_M1;
418 2 jsauermann
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
419
                                        D_WE_SP <= sp(IS_M1, SP_INC);
420
                                        D_WE_RR <= IS_M2;
421
 
422
                                when "0001011" =>
423
                                        OP_CAT  <= MOVE_SPi_LL;
424
                                        LAST    <= M3;
425
                                        D_SX    <= SX_LL;
426
                                        D_SY    <= SY_UM;
427
                                        D_SA    <= ADR_SPi;
428 9 jsauermann
                                        D_RD_O  <= IS_M1_M2;
429
                                        D_LOCK  <= IS_M1;
430 2 jsauermann
                                        PC_OP   <= pc(IS_M1_M2, PC_WAIT);
431
                                        D_WE_SP <= sp(IS_M1_M2, SP_INC);
432
                                        D_WE_LL <= IS_M2_M3;
433
                                        D_OP    <= mix(IS_M3);
434
 
435
                                when "0001100" =>
436
                                        OP_CAT  <= MOVE_SPi_LS;
437
                                        LAST    <= M2;
438
                                        D_OP    <= ALU_MOVE_Y;
439
                                        D_SX    <= SX_ANY;
440
                                        D_SY    <= SY_SM;
441
                                        D_SA    <= ADR_SPi;
442 9 jsauermann
                                        D_RD_O  <= IS_M1;
443 2 jsauermann
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
444
                                        D_WE_SP <= sp(IS_M1, SP_INC);
445
                                        D_WE_LL <= IS_M2;
446
 
447
                                when "0001101" =>
448
                                        OP_CAT  <= MOVE_SPi_LU;
449
                                        LAST    <= M2;
450
                                        D_OP    <= ALU_MOVE_Y;
451
                                        D_SX    <= SX_ANY;
452
                                        D_SY    <= SY_UM;
453
                                        D_SA    <= ADR_SPi;
454 9 jsauermann
                                        D_RD_O  <= IS_M1;
455 2 jsauermann
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
456
                                        D_WE_SP <= sp(IS_M1, SP_INC);
457
                                        D_WE_LL <= IS_M2;
458
 
459
                                when "0001110" =>
460
                                        OP_CAT  <= MOVE_RR_dSP;
461
                                        LAST    <= M2;
462
                                        D_OP    <= ALU_X_OR_Y;
463
                                        D_SX    <= SX_RR;
464
                                        D_SY    <= SY_SY0;
465
                                        D_SA    <= ADR_dSP;
466 9 jsauermann
                                        D_WE_O  <= IS_M1_M2;
467
                                        D_LOCK  <= IS_M1;
468 2 jsauermann
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
469
                                        D_WE_SP <= sp(IS_M1_M2, SP_LOAD);
470
                                        D_SMQ   <= IS_M1;
471
 
472
                                when "0001111" =>
473
                                        OP_CAT  <= MOVE_R_dSP;
474
                                        D_OP    <= ALU_X_OR_Y;
475
                                        D_SX    <= SX_RR;
476
                                        D_SY    <= SY_SY0;
477
                                        D_SA    <= ADR_dSP;
478 9 jsauermann
                                        D_WE_O  <= '1';
479 2 jsauermann
                                        D_WE_SP <= SP_LOAD;
480
 
481
                                -- 11111111111111111111111111111111111111111111111111111111111111111111
482
                                when "0010000" =>
483
                                        OP_CAT  <= AND_RR_i;
484
                                        LAST    <= M3;          -- wait for ##
485
                                        D_OP    <= ALU_X_AND_Y;
486
                                        D_SX    <= SX_RR;
487
                                        D_SY    <= SY_I16;
488
                                        D_WE_RR <= IS_M2;
489
 
490
                                when "0010001" =>
491
                                        OP_CAT  <= AND_RR_i;
492
                                        LAST    <= M2;                  -- wait for #
493
                                        D_OP    <= ALU_X_AND_Y;
494
                                        D_SX    <= SX_RR;
495
                                        D_SY    <= SY_UI8;
496
                                        D_WE_RR <= IS_M1;
497
 
498
                                when "0010010" =>
499
                                        OP_CAT  <= OR_RR_i;
500
                                        LAST    <= M3;          -- wait for ##
501
                                        D_OP    <= ALU_X_OR_Y;
502
                                        D_SX    <= SX_RR;
503
                                        D_SY    <= SY_I16;
504
                                        D_WE_RR <= IS_M2;
505
 
506
                                when "0010011" =>
507
                                        OP_CAT  <= OR_RR_i;
508
                                        LAST    <= M2;                  -- wait for #
509
                                        D_OP    <= ALU_X_OR_Y;
510
                                        D_SX    <= SX_RR;
511
                                        D_SY    <= SY_UI8;
512
                                        D_WE_RR <= IS_M1;
513
 
514
                                when "0010100" =>
515
                                        OP_CAT  <= XOR_RR_i;
516
                                        LAST    <= M3;          -- wait for ##
517
                                        D_OP    <= ALU_X_XOR_Y;
518
                                        D_SX    <= SX_RR;
519
                                        D_SY    <= SY_I16;
520
                                        D_WE_RR <= IS_M2;
521
 
522
                                when "0010101" =>
523
                                        OP_CAT  <= XOR_RR_i;
524
                                        LAST    <= M2;                  -- wait for #
525
                                        D_OP    <= ALU_X_XOR_Y;
526
                                        D_SX    <= SX_RR;
527
                                        D_SY    <= SY_UI8;
528
                                        D_WE_RR <= IS_M1;
529
 
530
                                when "0010110" =>
531
                                        OP_CAT  <= SEQ_RR_i;
532
                                        LAST    <= M3;          -- wait for ##
533
                                        D_OP    <= ALU_X_EQ_Y;
534
                                        D_SX    <= SX_RR;
535
                                        D_SY    <= SY_I16;
536
                                        D_WE_RR <= IS_M2;
537
 
538
                                when "0010111" =>
539
                                        OP_CAT  <= SEQ_RR_i;
540
                                        LAST    <= M2;                  -- wait for #
541
                                        D_OP    <= ALU_X_EQ_Y;
542
                                        D_SX    <= SX_RR;
543
                                        D_SY    <= SY_UI8;
544
                                        D_WE_RR <= IS_M1;
545
 
546
                                when "0011000" =>
547
                                        OP_CAT  <= SNE_RR_i;
548
                                        LAST    <= M3;          -- wait for ##
549
                                        D_OP    <= ALU_X_NE_Y;
550
                                        D_SX    <= SX_RR;
551
                                        D_SY    <= SY_I16;
552
                                        D_WE_RR <= IS_M2;
553
 
554
                                when "0011001" =>
555
                                        OP_CAT  <= SNE_RR_i;
556
                                        LAST    <= M2;                  -- wait for #
557
                                        D_OP    <= ALU_X_NE_Y;
558
                                        D_SX    <= SX_RR;
559
                                        D_SY    <= SY_UI8;
560
                                        D_WE_RR <= IS_M1;
561
 
562
                                when "0011010" =>
563
                                        OP_CAT  <= SGE_RR_i;
564
                                        LAST    <= M3;          -- wait for ##
565
                                        D_OP    <= ALU_X_GE_Y;
566
                                        D_SX    <= SX_RR;
567
                                        D_SY    <= SY_I16;
568
                                        D_WE_RR <= IS_M2;
569
 
570
                                when "0011011" =>
571
                                        OP_CAT  <= SGE_RR_i;
572
                                        LAST    <= M2;                  -- wait for #
573
                                        D_OP    <= ALU_X_GE_Y;
574
                                        D_SX    <= SX_RR;
575
                                        D_SY    <= SY_SI8;
576
                                        D_WE_RR <= IS_M1;
577
 
578
                                when "0011100" =>
579
                                        OP_CAT  <= SGT_RR_i;
580
                                        LAST    <= M3;          -- wait for ##
581
                                        D_OP    <= ALU_X_GT_Y;
582
                                        D_SX    <= SX_RR;
583
                                        D_SY    <= SY_I16;
584
                                        D_WE_RR <= IS_M2;
585
 
586
                                when "0011101" =>
587
                                        OP_CAT  <= SGT_RR_i;
588
                                        LAST    <= M2;                  -- wait for #
589
                                        D_OP    <= ALU_X_GT_Y;
590
                                        D_SX    <= SX_RR;
591
                                        D_SY    <= SY_SI8;
592
                                        D_WE_RR <= IS_M1;
593
 
594
                                when "0011110" =>
595
                                        OP_CAT  <= SLE_RR_i;
596
                                        LAST    <= M3;          -- wait for ##
597
                                        D_OP    <= ALU_X_LE_Y;
598
                                        D_SX    <= SX_RR;
599
                                        D_SY    <= SY_I16;
600
                                        D_WE_RR <= IS_M2;
601
 
602
                                when "0011111" =>
603
                                        OP_CAT  <= SLE_RR_i;
604
                                        LAST    <= M2;                  -- wait for #
605
                                        D_OP    <= ALU_X_LE_Y;
606
                                        D_SX    <= SX_RR;
607
                                        D_SY    <= SY_SI8;
608
                                        D_WE_RR <= IS_M1;
609
 
610
                                -- 22222222222222222222222222222222222222222222222222222222222222222222
611
                                when "0100000" =>
612
                                        OP_CAT  <= SLT_RR_i;
613
                                        LAST    <= M3;          -- wait for ##
614
                                        D_OP    <= ALU_X_LT_Y;
615
                                        D_SX    <= SX_RR;
616
                                        D_SY    <= SY_I16;
617
                                        D_WE_RR <= IS_M2;
618
 
619
                                when "0100001" =>
620
                                        OP_CAT  <= SLT_RR_i;
621
                                        LAST    <= M2;                  -- wait for #
622
                                        D_OP    <= ALU_X_LT_Y;
623
                                        D_SX    <= SX_RR;
624
                                        D_SY    <= SY_SI8;
625
                                        D_WE_RR <= IS_M1;
626
 
627
                                when "0100010" =>
628
                                        OP_CAT  <= SHS_RR_i;
629
                                        LAST    <= M3;          -- wait for ##
630
                                        D_OP    <= ALU_X_HS_Y;
631
                                        D_SX    <= SX_RR;
632
                                        D_SY    <= SY_I16;
633
                                        D_WE_RR <= IS_M2;
634
 
635
                                when "0100011" =>
636
                                        OP_CAT  <= SHS_RR_i;
637
                                        LAST    <= M2;                  -- wait for #
638
                                        D_OP    <= ALU_X_HS_Y;
639
                                        D_SX    <= SX_RR;
640
                                        D_SY    <= SY_UI8;
641
                                        D_WE_RR <= IS_M1;
642
 
643
                                when "0100100" =>
644
                                        OP_CAT  <= SHI_RR_i;
645
                                        LAST    <= M3;          -- wait for ##
646
                                        D_OP    <= ALU_X_HI_Y;
647
                                        D_SX    <= SX_RR;
648
                                        D_SY    <= SY_I16;
649
                                        D_WE_RR <= IS_M2;
650
 
651
                                when "0100101" =>
652
                                        OP_CAT  <= SHI_RR_i;
653
                                        LAST    <= M2;                  -- wait for #
654
                                        D_OP    <= ALU_X_HI_Y;
655
                                        D_SX    <= SX_RR;
656
                                        D_SY    <= SY_UI8;
657
                                        D_WE_RR <= IS_M1;
658
 
659
                                when "0100110" =>
660
                                        OP_CAT <= SLS_RR_i;
661
                                        LAST    <= M3;          -- wait for ##
662
                                        D_OP   <= ALU_X_LS_Y;
663
                                        D_SX   <= SX_RR;
664
                                        D_SY   <= SY_I16;
665
                                        D_WE_RR <= IS_M2;
666
 
667
                                when "0100111" =>
668
                                        OP_CAT  <= SLS_RR_i;
669
                                        LAST    <= M2;                  -- wait for #
670
                                        D_OP    <= ALU_X_LS_Y;
671
                                        D_SX    <= SX_RR;
672
                                        D_SY    <= SY_UI8;
673
                                        D_WE_RR <= IS_M1;
674
 
675
                                when "0101000" =>
676
                                        OP_CAT  <= SLO_RR_i;
677
                                        LAST    <= M3;          -- wait for ##
678
                                        D_OP    <= ALU_X_LO_Y;
679
                                        D_SX    <= SX_RR;
680
                                        D_SY    <= SY_I16;
681
                                        D_WE_RR <= IS_M2;
682
 
683
                                when "0101001" =>
684
                                        OP_CAT  <= SLO_RR_i;
685
                                        LAST    <= M2;                  -- wait for #
686
                                        D_OP    <= ALU_X_LO_Y;
687
                                        D_SX    <= SX_RR;
688
                                        D_SY    <= SY_UI8;
689
                                        D_WE_RR <= IS_M1;
690
 
691
                                when "0101010" =>
692
                                        OP_CAT  <= ADD_SP_I;
693
                                        LAST    <= M3;          -- wait for ##
694
                                        D_OP    <= ALU_ANY;
695
                                        D_SX    <= SX_ANY;
696
                                        D_SY    <= SY_ANY;
697
                                        D_SA    <= ADR_16SP_L;
698
                                        D_WE_SP <= sp(IS_M2, SP_LOAD);
699
 
700
                                when "0101011" =>
701
                                        OP_CAT  <= ADD_SP_I;
702
                                        LAST    <= M2;                  -- wait for #
703
                                        D_OP    <= ALU_ANY;
704
                                        D_SX    <= SX_ANY;
705
                                        D_SY    <= SY_ANY;
706
                                        D_SA    <= ADR_8SP_L;
707
                                        D_WE_SP <= sp(IS_M1, SP_LOAD);
708
 
709
                                when "0101100" =>
710
                                        OP_CAT  <= CLRW_dSP;
711
                                        LAST    <= M2;
712
                                        D_OP    <= ALU_X_AND_Y;
713
                                        D_SX    <= SX_ANY;
714
                                        D_SY    <= SY_SY0;
715
                                        D_SA    <= ADR_dSP;
716 9 jsauermann
                                        D_WE_O  <= '1';
717
                                        D_LOCK  <= IS_M1;
718 2 jsauermann
                                        D_WE_SP <= SP_LOAD;
719
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
720
 
721
                                when "0101101" =>
722
                                        OP_CAT  <= CLRB_dSP;
723
                                        D_OP    <= ALU_X_AND_Y;
724
                                        D_SX    <= SX_ANY;
725
                                        D_SY    <= SY_SY0;
726
                                        D_SA    <= ADR_dSP;
727 9 jsauermann
                                        D_WE_O  <= IS_M1;
728 2 jsauermann
                                        D_WE_SP <= SP_LOAD;
729
 
730
                                when "0101110" =>
731
                                        OP_CAT  <= IN_ci_RU;
732
                                        LAST    <= M2;
733
                                        D_OP    <= ALU_MOVE_Y;
734
                                        D_SX    <= SX_ANY;
735 9 jsauermann
                                        D_SY    <= SY_UM;
736 2 jsauermann
                                        D_SA    <= ADR_IO;
737 9 jsauermann
                                        D_RD_O  <= IS_M1;
738
                                        D_IO    <= IS_M1;
739 2 jsauermann
                                        D_WE_RR <= IS_M2;
740
 
741
                                when "0101111" =>
742
                                        OP_CAT  <= OUT_R_ci;
743
                                        LAST    <= M2;
744
                                        D_OP    <= ALU_X_OR_Y;
745
                                        D_SX    <= SX_RR;
746
                                        D_SY    <= SY_SY0;
747
                                        D_SA    <= ADR_IO;
748 9 jsauermann
                                        D_WE_O  <= IS_M1;
749
                                        D_IO    <= IS_M1;
750 2 jsauermann
 
751
                                -- 33333333333333333333333333333333333333333333333333333333333333333333
752
                                when "0110000" =>
753
                                        OP_CAT  <= AND_LL_RR;
754
                                        D_OP    <= ALU_X_AND_Y;
755
                                        D_SX    <= SX_LL;
756
                                        D_SY    <= SY_RR;
757
                                        D_WE_RR <= IS_M1;
758
 
759
                                when "0110001" =>
760
                                        OP_CAT  <= OR_LL_RR;
761
                                        D_OP    <= ALU_X_OR_Y;
762
                                        D_SX    <= SX_LL;
763
                                        D_SY    <= SY_RR;
764
                                        D_WE_RR <= IS_M1;
765
 
766
                                when "0110010" =>
767
                                        OP_CAT  <= XOR_LL_RR;
768
                                        D_OP    <= ALU_X_XOR_Y;
769
                                        D_SX    <= SX_LL;
770
                                        D_SY    <= SY_RR;
771
                                        D_WE_RR <= IS_M1;
772
 
773
                                when "0110011" =>
774
                                        OP_CAT  <= SEQ_LL_RR;
775
                                        D_OP    <= ALU_X_EQ_Y;
776
                                        D_SX    <= SX_LL;
777
                                        D_SY    <= SY_RR;
778
                                        D_WE_RR <= IS_M1;
779
 
780
                                when "0110100" =>
781
                                        OP_CAT  <= SNE_LL_RR;
782
                                        D_OP    <= ALU_X_NE_Y;
783
                                        D_SX    <= SX_LL;
784
                                        D_SY    <= SY_RR;
785
                                        D_WE_RR <= IS_M1;
786
 
787
                                when "0110101" =>
788
                                        OP_CAT  <= SGE_LL_RR;
789
                                        D_OP    <= ALU_X_GE_Y;
790
                                        D_SX    <= SX_LL;
791
                                        D_SY    <= SY_RR;
792
                                        D_WE_RR <= IS_M1;
793
 
794
                                when "0110110" =>
795
                                        OP_CAT  <= SGT_LL_RR;
796
                                        D_OP    <= ALU_X_GT_Y;
797
                                        D_SX    <= SX_LL;
798
                                        D_SY    <= SY_RR;
799
                                        D_WE_RR <= IS_M1;
800
 
801
                                when "0110111" =>
802
                                        OP_CAT  <= SLE_LL_RR;
803
                                        D_OP    <= ALU_X_LE_Y;
804
                                        D_SX    <= SX_LL;
805
                                        D_SY    <= SY_RR;
806
                                        D_WE_RR <= IS_M1;
807
 
808
                                when "0111000" =>
809
                                        OP_CAT  <= SLT_LL_RR;
810
                                        D_OP    <= ALU_X_LT_Y;
811
                                        D_SX    <= SX_LL;
812
                                        D_SY    <= SY_RR;
813
                                        D_WE_RR <= IS_M1;
814
 
815
                                when "0111001" =>
816
                                        OP_CAT  <= SHS_LL_RR;
817
                                        D_OP    <= ALU_X_HS_Y;
818
                                        D_SX    <= SX_LL;
819
                                        D_SY    <= SY_RR;
820
                                        D_WE_RR <= IS_M1;
821
 
822
                                when "0111010" =>
823
                                        OP_CAT  <= SHI_LL_RR;
824
                                        D_OP    <= ALU_X_HI_Y;
825
                                        D_SX    <= SX_LL;
826
                                        D_SY    <= SY_RR;
827
                                        D_WE_RR <= IS_M1;
828
 
829
                                when "0111011" =>
830
                                        OP_CAT  <= SLS_LL_RR;
831
                                        D_OP    <= ALU_X_LS_Y;
832
                                        D_SX    <= SX_LL;
833
                                        D_SY    <= SY_RR;
834
                                        D_WE_RR <= IS_M1;
835
 
836
                                when "0111100" =>
837
                                        OP_CAT  <= SLO_LL_RR;
838
                                        D_OP    <= ALU_X_LO_Y;
839
                                        D_SX    <= SX_LL;
840
                                        D_SY    <= SY_RR;
841
                                        D_WE_RR <= IS_M1;
842
 
843
                                when "0111101" =>
844
                                        OP_CAT  <= LNOT_RR;
845
                                        D_OP    <= ALU_X_EQ_Y;
846
                                        D_SX    <= SX_RR;
847
                                        D_SY    <= SY_SY0;
848
                                        D_WE_RR <= IS_M1;
849
 
850
                                when "0111110" =>
851
                                        OP_CAT  <= NEG_RR;
852
                                        D_OP    <= ALU_NEG_Y;
853
                                        D_SX    <= SX_ANY;
854
                                        D_SY    <= SY_RR;
855
                                        D_WE_RR <= IS_M1;
856
 
857
                                when "0111111" =>
858
                                        OP_CAT  <= NOT_RR;
859
                                        D_OP    <= ALU_NOT_Y;
860
                                        D_SX    <= SX_ANY;
861
                                        D_SY    <= SY_RR;
862
                                        D_WE_RR <= IS_M1;
863
 
864
                                -- 44444444444444444444444444444444444444444444444444444444444444444444
865
                                when "1000000" =>
866
                                        OP_CAT  <= MOVE_LL_RR;
867
                                        D_OP    <= ALU_X_OR_Y;
868
                                        D_SX    <= SX_LL;
869
                                        D_SY    <= SY_SY0;
870
                                        D_WE_RR <= IS_M1;
871
 
872
                                when "1000001" =>
873
                                        OP_CAT  <= MOVE_LL_cRR;
874
                                        LAST    <= M2;
875
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
876
                                        D_OP    <= ALU_X_OR_Y;
877
                                        D_SX    <= SX_LL;
878
                                        D_SY    <= SY_SY0;
879
                                        D_SA    <= hadr(IS_M2, ADR_cRR_H);
880 9 jsauermann
                                        D_WE_O  <= IS_M1_M2;
881
                                        D_LOCK  <= IS_M1;
882 2 jsauermann
                                        D_SMQ   <= IS_M2;
883
 
884
                                when "1000010" =>
885
                                        OP_CAT  <= MOVE_L_cRR;
886
                                        D_OP    <= ALU_X_OR_Y;
887
                                        D_SX    <= SX_LL;
888
                                        D_SY    <= SY_SY0;
889
                                        D_SA    <= ADR_cRR_L;
890 9 jsauermann
                                        D_WE_O  <= IS_M1;
891 2 jsauermann
 
892
                                when "1000011" =>
893
                                        OP_CAT  <= MOVE_RR_LL;
894
                                        D_OP    <= ALU_X_OR_Y;
895
                                        D_SX    <= SX_RR;
896
                                        D_SY    <= SY_SY0;
897
                                        D_WE_LL <= IS_M1;
898
 
899
                                when "1000100" =>
900
                                        OP_CAT  <= MOVE_RR_cLL;
901
                                        LAST    <= M2;
902
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
903
                                        D_OP    <= ALU_X_OR_Y;
904
                                        D_SX    <= SX_RR;
905
                                        D_SY    <= SY_SY0;
906
                                        D_SA    <= hadr(IS_M2, ADR_cLL_H);
907 9 jsauermann
                                        D_WE_O  <= IS_M1_M2;
908
                                        D_LOCK  <= IS_M1;
909 2 jsauermann
                                        D_SMQ   <= IS_M2;
910
 
911
                                when "1000101" =>
912
                                        OP_CAT  <= MOVE_R_cLL;
913
                                        D_OP    <= ALU_X_OR_Y;
914
                                        D_SX    <= SX_RR;
915
                                        D_SY    <= SY_SY0;
916
                                        D_SA    <= ADR_cLL_L;
917 9 jsauermann
                                        D_WE_O  <= IS_M1;
918 2 jsauermann
 
919
                                when "1000110" =>
920
                                        OP_CAT  <= MOVE_cRR_RR;
921
                                        LAST    <= M3;
922
                                        D_SX    <= SX_ANY;
923
                                        D_SY    <= SY_UM;
924
                                        D_WE_RR <= not IS_M1;           -- M2 or M3
925
                                        PC_OP   <= pc(IS_M1_M2, PC_WAIT);
926
                                        D_OP    <= mix(IS_M3);
927
                                        D_SA    <= hadr(IS_M2, ADR_cRR_H);
928 9 jsauermann
                                        D_RD_O  <= IS_M1_M2;
929
                                        D_LOCK  <= IS_M1;
930 2 jsauermann
 
931
                                when "1000111" =>
932
                                        OP_CAT  <= MOVE_cRR_RS;
933
                                        LAST    <= M2;
934
                                        D_OP    <= ALU_MOVE_Y;
935
                                        D_SX    <= SX_ANY;
936
                                        D_SY    <= SY_SM;
937
                                        D_SA    <= ADR_cRR_L;
938 9 jsauermann
                                        D_RD_O  <= IS_M1;
939 2 jsauermann
                                        D_WE_RR <= IS_M2;
940
                                        PC_OP   <= pc(IS_M1, PC_WAIT);
941
 
942
                                when "1001000" =>
943
                                        OP_CAT  <= MOVE_cRR_RU;
944
                                        LAST    <= M2;
945
                                        D_OP    <= ALU_MOVE_Y;
946
                                        D_SX    <= SX_ANY;
947
                                        D_SY    <= SY_UM;
948
                                        D_SA    <= ADR_cRR_L;
949 9 jsauermann
                                        D_RD_O  <= IS_M1;
950 2 jsauermann
                                        D_WE_RR <= IS_M2;
951
                                        PC_OP  <= pc(IS_M1, PC_WAIT);
952
 
953
                                when "1001001" =>
954
                                        OP_CAT  <= MOVE_ci_RR;
955
                                        LAST    <= M4;
956
                                        D_SX    <= SX_RR;
957
                                        D_SY    <= SY_UM;
958
                                        PC_OP   <= pc(IS_M3, PC_WAIT);
959
                                        D_OP    <= mix(IS_M4);
960
                                        D_WE_RR <= IS_M3_M4;
961
                                        D_SA    <= hadr(IS_M3, ADR_cI16_H);
962 9 jsauermann
                                        D_RD_O  <= IS_M2_M3;
963
                                        D_LOCK  <= IS_M2;
964 2 jsauermann
 
965
                                when "1001010" =>
966
                                        OP_CAT  <= MOVE_ci_RS;
967
                                        LAST    <= M3;
968
                                        D_OP    <= ALU_MOVE_Y;
969
                                        D_SX    <= SX_ANY;
970
                                        D_SY    <= SY_SM;
971
                                        D_SA    <= ADR_cI16_L;
972 9 jsauermann
                                        D_RD_O  <= IS_M2;
973 2 jsauermann
                                        D_WE_RR <= IS_M3;
974
 
975
                                when "1001011" =>
976
                                        OP_CAT  <= MOVE_ci_RU;
977
                                        LAST    <= M3;
978
                                        D_OP    <= ALU_MOVE_Y;
979
                                        D_SX    <= SX_ANY;
980
                                        D_SY    <= SY_UM;
981
                                        D_SA    <= ADR_cI16_L;
982 9 jsauermann
                                        D_RD_O  <= IS_M2;
983 2 jsauermann
                                        D_WE_RR <= IS_M3;
984
 
985
                                when "1001100" =>
986
                                        OP_CAT  <= MOVE_ci_LL;
987
                                        LAST    <= M4;
988
                                        D_SX    <= SX_LL;
989
                                        D_SY    <= SY_UM;
990
                                        PC_OP   <= pc(IS_M3, PC_WAIT);
991
                                        D_OP    <= mix(IS_M4);
992
                                        D_SA    <= hadr(IS_M3, ADR_cI16_H);
993 9 jsauermann
                                        D_RD_O  <= IS_M2_M3;
994
                                        D_LOCK  <= IS_M2;
995 2 jsauermann
                                        D_WE_LL <= IS_M3_M4;
996
 
997
                                when "1001101" =>
998
                                        OP_CAT  <= MOVE_ci_LS;
999
                                        LAST    <= M3;
1000
                                        D_OP    <= ALU_MOVE_Y;
1001
                                        D_SX    <= SX_ANY;
1002
                                        D_SY    <= SY_SM;
1003
                                        D_SA    <= ADR_cI16_L;
1004 9 jsauermann
                                        D_RD_O  <= IS_M2;
1005 2 jsauermann
                                        D_WE_LL <= IS_M3;
1006
 
1007
                                when "1001110" =>
1008
                                        OP_CAT  <= MOVE_ci_LU;
1009
                                        LAST    <= M3;
1010
                                        D_OP    <= ALU_MOVE_Y;
1011
                                        D_SX    <= SX_ANY;
1012
                                        D_SY    <= SY_UM;
1013
                                        D_SA    <= ADR_cI16_L;
1014 9 jsauermann
                                        D_RD_O  <= IS_M2;
1015 2 jsauermann
                                        D_WE_LL <= IS_M3;
1016
 
1017
                                when "1001111" =>
1018
                                        OP_CAT  <= MOVE_RR_SP;
1019
                                        D_SA    <= ADR_cRR_L;
1020
                                        D_WE_SP <= SP_LOAD;
1021
 
1022
                                -- 55555555555555555555555555555555555555555555555555555555555555555555
1023
                                when "1010000" =>
1024
                                        -- spare
1025
 
1026
                                when "1010001" =>
1027
                                        -- spare
1028
 
1029
                                when "1010010" =>
1030
                                        OP_CAT  <= LSL_RR_i;
1031
                                        LAST    <= M2;
1032
                                        D_OP    <= ALU_X_LSL_Y;
1033
                                        D_SX    <= SX_RR;
1034
                                        D_SY    <= SY_UI8;
1035
                                        D_WE_RR <= IS_M1;
1036
 
1037
                                when "1010011" =>
1038
                                        OP_CAT  <= ASR_RR_i;
1039
                                        LAST    <= M2;
1040
                                        D_OP    <= ALU_X_ASR_Y;
1041
                                        D_SX    <= SX_RR;
1042
                                        D_SY    <= SY_UI8;
1043
                                        D_WE_RR <= IS_M1;
1044
 
1045
                                when "1010100" =>
1046
                                        OP_CAT  <= LSR_RR_i;
1047
                                        LAST    <= M2;
1048
                                        D_OP    <= ALU_X_LSR_Y;
1049
                                        D_SX    <= SX_RR;
1050
                                        D_SY    <= SY_UI8;
1051
                                        D_WE_RR <= IS_M1;
1052
 
1053
                                when "1010101" =>
1054
                                        OP_CAT  <= LSL_LL_RR;
1055
                                        D_OP    <= ALU_X_LSL_Y;
1056
                                        D_SX    <= SX_LL;
1057
                                        D_SY    <= SY_RR;
1058
                                        D_WE_RR <= IS_M1;
1059
 
1060
                                when "1010110" =>
1061
                                        OP_CAT  <= ASR_LL_RR;
1062
                                        D_OP    <= ALU_X_ASR_Y;
1063
                                        D_SX    <= SX_LL;
1064
                                        D_SY    <= SY_RR;
1065
                                        D_WE_RR <= IS_M1;
1066
 
1067
                                when "1010111" =>
1068
                                        OP_CAT  <= LSR_LL_RR;
1069
                                        D_OP    <= ALU_X_LSR_Y;
1070
                                        D_SX    <= SX_LL;
1071
                                        D_SY    <= SY_RR;
1072
                                        D_WE_RR <= IS_M1;
1073
 
1074
                                when "1011000" =>
1075
                                        OP_CAT  <= ADD_LL_RR;
1076
                                        D_OP    <= ALU_X_ADD_Y;
1077
                                        D_SX    <= SX_LL;
1078
                                        D_SY    <= SY_RR;
1079
                                        D_WE_RR <= IS_M1;
1080
 
1081
                                when "1011001" =>
1082
                                        OP_CAT  <= SUB_LL_RR;
1083
                                        D_OP    <= ALU_X_SUB_Y;
1084
                                        D_SX    <= SX_LL;
1085
                                        D_SY    <= SY_RR;
1086
                                        D_WE_RR <= IS_M1;
1087
 
1088
                                when "1011010" =>
1089
                                        OP_CAT  <= MOVE_RR_ci;
1090
                                        LAST    <= M3;
1091
                                        D_SX    <= SX_RR;
1092
                                        D_SY    <= SY_SY0;
1093
                                        D_OP    <= ALU_X_OR_Y;
1094
                                        D_SA    <= hadr(IS_M3, ADR_cI16_H);
1095 9 jsauermann
                                        D_WE_O  <= IS_M2_M3;
1096
                                        D_LOCK  <= IS_M2;
1097 2 jsauermann
                                        D_SMQ   <= IS_M3;
1098
 
1099
                                when "1011011" =>
1100
                                        OP_CAT  <= MOVE_R_ci;
1101
                                        LAST    <= M3;
1102
                                        D_SX    <= SX_RR;
1103
                                        D_SY    <= SY_SY0;
1104
                                        D_OP    <= ALU_X_OR_Y;
1105
                                        D_SA    <= ADR_cI16_L;
1106 9 jsauermann
                                        D_WE_O  <= IS_M2;
1107 2 jsauermann
 
1108
                                when "1011100" =>               -- long offset / long move
1109
                                        OP_CAT  <= MOVE_RR_uSP;
1110
                                        LAST    <= M3;
1111
                                        D_SX    <= SX_RR;
1112
                                        D_SY    <= SY_SY0;
1113
                                        D_OP    <= ALU_X_OR_Y;
1114 9 jsauermann
                                        D_SA    <= hadr(IS_M3, ADR_16SP_H);
1115
                                        D_WE_O  <= IS_M2_M3;
1116
                                        D_LOCK  <= IS_M2;
1117 2 jsauermann
                                        D_SMQ   <= IS_M3;
1118
 
1119
                                when "1011101" =>               -- short offset / long move
1120
                                        OP_CAT  <= MOVE_RR_uSP;
1121
                                        LAST    <= M2;
1122
                                        D_SX    <= SX_RR;
1123
                                        D_SY    <= SY_SY0;
1124
                                        D_OP    <= ALU_X_OR_Y;
1125 9 jsauermann
                                        D_SA    <= hadr(IS_M2, ADR_8SP_H);
1126
                                        D_WE_O  <= IS_M1_M2;
1127
                                        D_LOCK  <= IS_M1;
1128 2 jsauermann
                                        D_SMQ   <= IS_M2;
1129
 
1130
                                when "1011110" =>               -- long offset / short move
1131
                                        OP_CAT  <= MOVE_R_uSP;
1132
                                        LAST    <= M3;
1133
                                        D_SX    <= SX_RR;
1134
                                        D_SY    <= SY_SY0;
1135
                                        D_OP    <= ALU_X_OR_Y;
1136 9 jsauermann
                                        D_SA    <= ADR_16SP_L;
1137
                                        D_WE_O  <= IS_M2;
1138 2 jsauermann
                                        D_OP    <= ALU_X_OR_Y;
1139
 
1140
                                when "1011111" =>               -- short offset / short move
1141
                                        OP_CAT  <= MOVE_R_uSP;
1142
                                        LAST    <= M2;
1143
                                        D_SX    <= SX_RR;
1144
                                        D_SY    <= SY_SY0;
1145
                                        D_OP    <= ALU_X_OR_Y;
1146 9 jsauermann
                                        D_SA    <= ADR_8SP_L;
1147
                                        D_WE_O  <= IS_M1;
1148 2 jsauermann
                                        D_OP    <= ALU_X_OR_Y;
1149
 
1150
                                -- 66666666666666666666666666666666666666666666666666666666666666666666
1151
                                when "1100000" =>       -- long offset, long move
1152
                                        OP_CAT <= MOVE_uSP_RR;
1153
                                        LAST   <= M4;
1154
                                        D_SX   <= SX_RR;
1155
                                        D_SY   <= SY_UM;
1156
                                        PC_OP   <= pc(IS_M3, PC_WAIT);
1157
                                        D_OP    <= mix(IS_M3_M4);
1158 9 jsauermann
                                        D_SA    <= hadr(IS_M3, ADR_16SP_H);
1159
                                        D_RD_O  <= IS_M2_M3;
1160
                                        D_LOCK  <= IS_M2;
1161 2 jsauermann
                                        D_WE_RR <= IS_M3_M4;
1162
 
1163
                                when "1100001" =>       -- short offset, long move
1164
                                        OP_CAT  <= MOVE_uSP_RR;
1165
                                        LAST    <= M3;
1166
                                        D_SX    <= SX_RR;
1167
                                        D_SY    <= SY_UM;
1168
                                        PC_OP   <= pc(IS_M2, PC_WAIT);
1169
                                        D_OP    <= mix(IS_M3);
1170 9 jsauermann
                                        D_SA    <= hadr(IS_M2, ADR_8SP_H);
1171
                                        D_RD_O  <= IS_M1_M2;
1172
                                        D_LOCK  <= IS_M1;
1173 2 jsauermann
                                        D_WE_RR <= IS_M2_M3;
1174
 
1175
                                when "1100010" =>       -- long offset, short move
1176
                                        OP_CAT  <= MOVE_uSP_RS;
1177
                                        LAST    <= M3;
1178
                                        D_OP    <= ALU_MOVE_Y;
1179
                                        D_SX    <= SX_RR;
1180
                                        D_SY    <= SY_SM;
1181
                                        D_SA    <= ADR_16SP_L;
1182 9 jsauermann
                                        D_RD_O  <= IS_M2;
1183 2 jsauermann
                                        D_WE_RR <= IS_M3;
1184
 
1185
                                when "1100011" =>       -- short offset, short move
1186
                                        OP_CAT  <= MOVE_uSP_RS;
1187
                                        LAST    <= M2;
1188
                                        D_OP    <= ALU_MOVE_Y;
1189
                                        D_SX    <= SX_RR;
1190
                                        D_SY    <= SY_SM;
1191
                                        D_SA    <= ADR_8SP_L;
1192 9 jsauermann
                                        D_RD_O  <= IS_M1;
1193 2 jsauermann
                                        D_WE_RR <= IS_M2;
1194
 
1195
                                when "1100100" =>       -- long offset, short move
1196
                                        OP_CAT  <= MOVE_uSP_RU;
1197
                                        LAST    <= M3;
1198
                                        D_OP    <= ALU_MOVE_Y;
1199
                                        D_SX    <= SX_RR;
1200
                                        D_SY    <= SY_UM;
1201
                                        D_SA    <= ADR_16SP_L;
1202 9 jsauermann
                                        D_RD_O  <= IS_M2;
1203 2 jsauermann
                                        D_WE_RR <= IS_M3;
1204
 
1205
                                when "1100101" =>       -- short offset, short move
1206
                                        OP_CAT  <= MOVE_uSP_RU;
1207
                                        LAST    <= M2;
1208
                                        D_OP    <= ALU_MOVE_Y;
1209
                                        D_SX    <= SX_RR;
1210
                                        D_SY    <= SY_UM;
1211
                                        D_SA    <= ADR_8SP_L;
1212 9 jsauermann
                                        D_RD_O  <= IS_M1;
1213 2 jsauermann
                                        D_WE_RR <= IS_M2;
1214
 
1215
                                when "1100110" =>       -- long offset, long move
1216
                                        OP_CAT  <= MOVE_uSP_LL;
1217
                                        LAST    <= M4;
1218
                                        D_SX    <= SX_LL;
1219
                                        D_SY    <= SY_UM;
1220
                                        PC_OP   <= pc(IS_M3, PC_WAIT);
1221
                                        D_OP    <= mix(IS_M4);
1222 9 jsauermann
                                        D_SA    <= hadr(IS_M3, ADR_8SP_H);
1223
                                        D_RD_O  <= IS_M2_M3;
1224
                                        D_LOCK  <= IS_M2;
1225 2 jsauermann
                                        D_WE_LL <= IS_M3_M4;
1226
 
1227
                                when "1100111" =>       -- short offset, long move
1228
                                        OP_CAT  <= MOVE_uSP_LL;
1229
                                        LAST    <= M3;
1230
                                        D_SX    <= SX_LL;
1231
                                        D_SY    <= SY_UM;
1232
                                        PC_OP   <= pc(IS_M2, PC_WAIT);
1233
                                        D_OP    <= mix(IS_M3);
1234 9 jsauermann
                                        D_SA    <= hadr(IS_M2, ADR_8SP_H);
1235
                                        D_RD_O  <= IS_M1_M2;
1236
                                        D_LOCK  <= IS_M1;
1237 2 jsauermann
                                        D_WE_LL <= IS_M2_M3;
1238
 
1239
                                when "1101000" =>       -- long offset, short move
1240
                                        OP_CAT  <= MOVE_uSP_LS;
1241
                                        LAST    <= M3;
1242
                                        D_OP    <= ALU_MOVE_Y;
1243
                                        D_SX    <= SX_RR;
1244
                                        D_SY    <= SY_SM;
1245
                                        D_SA    <= ADR_16SP_L;
1246 9 jsauermann
                                        D_RD_O  <= IS_M2;
1247 2 jsauermann
                                        D_WE_LL <= IS_M3;
1248
 
1249
                                when "1101001" =>       -- short offset, short move
1250
                                        OP_CAT  <= MOVE_uSP_LS;
1251
                                        LAST    <= M2;
1252
                                        D_OP    <= ALU_MOVE_Y;
1253
                                        D_SX    <= SX_RR;
1254
                                        D_SY    <= SY_SM;
1255
                                        D_SA    <= ADR_8SP_L;
1256 9 jsauermann
                                        D_RD_O  <= IS_M1;
1257 2 jsauermann
                                        D_WE_LL <= IS_M2;
1258
 
1259
                                when "1101010" =>       -- long offset, short move
1260
                                        OP_CAT  <= MOVE_uSP_LU;
1261
                                        LAST    <= M3;
1262
                                        D_OP    <= ALU_MOVE_Y;
1263
                                        D_SX    <= SX_RR;
1264
                                        D_SY    <= SY_UM;
1265
                                        D_SA    <= ADR_16SP_L;
1266 9 jsauermann
                                        D_RD_O  <= IS_M2;
1267 2 jsauermann
                                        D_WE_LL <= IS_M3;
1268
 
1269
                                when "1101011" =>       -- short offset, short move
1270
                                        OP_CAT  <= MOVE_uSP_LU;
1271
                                        LAST    <= M2;
1272
                                        D_OP    <= ALU_MOVE_Y;
1273
                                        D_SX    <= SX_RR;
1274
                                        D_SY    <= SY_UM;
1275
                                        D_SA    <= ADR_8SP_L;
1276 9 jsauermann
                                        D_RD_O  <= IS_M1;
1277 2 jsauermann
                                        D_WE_LL <= IS_M2;
1278
 
1279
                                when "1101100" =>
1280
                                        OP_CAT  <= LEA_uSP_RR;
1281
                                        LAST    <= M3;
1282
                                        D_OP    <= ALU_X_ADD_Y;
1283
                                        D_SX    <= SX_SP;
1284
                                        D_SY    <= SY_I16;
1285
                                        D_WE_RR <= IS_M2;
1286
 
1287
                                when "1101101" =>
1288
                                        OP_CAT  <= LEA_uSP_RR;
1289
                                        LAST    <= M2;
1290
                                        D_OP    <= ALU_X_ADD_Y;
1291
                                        D_SX    <= SX_SP;
1292
                                        D_SY    <= SY_UI8;
1293
                                        D_WE_RR <= IS_M1;
1294
 
1295
                                when "1101110" =>
1296
                                        OP_CAT  <= MOVE_dRR_dLL;
1297
                                        LAST    <= M3;
1298
                                        D_WE_RR <= IS_M1;
1299 9 jsauermann
                                        D_RD_O  <= IS_M1;
1300
                                        D_WE_O  <= IS_M2;
1301 2 jsauermann
                                        D_WE_LL <= IS_M3;
1302
                                        PC_OP  <= pc(IS_M1_M2, PC_WAIT);
1303
 
1304
                                        case OP_CYC is
1305
                                                when M1 =>      -- decrement RR
1306
                                                        D_OP    <= ALU_X_SUB_Y;
1307
                                                        D_SX    <= SX_RR;
1308
                                                        D_SY    <= SY_SY1;
1309
                                                        D_SA    <= ADR_dRR;
1310
                                                when M2 =>      -- write read memory
1311
                                                        D_OP    <= ALU_MOVE_Y;
1312
                                                        D_SX    <= SX_ANY;
1313
                                                        D_SY    <= SY_UM;
1314
                                                        D_SA    <= ADR_dLL;
1315
                                                when others =>  -- decrement LL
1316
                                                        D_OP    <= ALU_X_SUB_Y;
1317
                                                        D_SX    <= SX_LL;
1318
                                                        D_SY    <= SY_SY1;
1319
                                        end case;
1320
 
1321
                                when "1101111" =>
1322
                                        OP_CAT  <= MOVE_RRi_LLi;
1323
                                        LAST    <= M3;
1324
                                        D_WE_RR <= IS_M1;
1325 9 jsauermann
                                        D_RD_O  <= IS_M1;
1326
                                        D_WE_O  <= IS_M2;
1327 2 jsauermann
                                        D_WE_LL <= IS_M3;
1328
                                        PC_OP  <= pc(IS_M1_M2, PC_WAIT);
1329
 
1330
                                        case OP_CYC is
1331
                                                when M1 =>      -- decrement RR
1332
                                                        D_OP    <= ALU_X_ADD_Y;
1333
                                                        D_SX    <= SX_RR;
1334
                                                        D_SY    <= SY_SY1;
1335
                                                        D_SA    <= ADR_RRi;
1336
                                                when M2 =>      -- write read memory
1337
                                                        D_OP    <= ALU_MOVE_Y;
1338
                                                        D_SX    <= SX_ANY;
1339
                                                        D_SY    <= SY_UM;
1340
                                                        D_SA    <= ADR_dLL;
1341
                                                when others =>  -- decrement LL
1342
                                                        D_OP    <= ALU_X_ADD_Y;
1343
                                                        D_SX    <= SX_LL;
1344
                                                        D_SY    <= SY_SY1;
1345
                                        end case;
1346
 
1347
                                -- 77777777777777777777777777777777777777777777777777777777777777777777
1348
                                when "1110000" =>
1349
                                        OP_CAT  <= MUL_IS;
1350
                                        D_OP    <= ALU_MUL_IS;
1351
                                        D_SX    <= SX_LL;
1352
                                        D_SY    <= SY_RR;
1353
                                        D_WE_RR <= IS_M1;
1354
 
1355
                                when "1110001" =>
1356
                                        OP_CAT  <= MUL_IU;
1357
                                        D_OP    <= ALU_MUL_IU;
1358
                                        D_SX    <= SX_LL;
1359
                                        D_SY    <= SY_RR;
1360
                                        D_WE_RR <= IS_M1;
1361
 
1362
                                when "1110010" =>
1363
                                        OP_CAT  <= DIV_IS;
1364
                                        D_OP    <= ALU_DIV_IS;
1365
                                        D_SX    <= SX_LL;
1366
                                        D_SY    <= SY_RR;
1367
                                        D_WE_RR <= IS_M1;
1368
 
1369
                                when "1110011" =>
1370
                                        OP_CAT  <= DIV_IU;
1371
                                        D_OP    <= ALU_DIV_IU;
1372
                                        D_SX    <= SX_LL;
1373
                                        D_SY    <= SY_RR;
1374
                                        D_WE_RR <= IS_M1;
1375
 
1376
                                when "1110100" =>
1377
                                        OP_CAT  <= MD_STEP;
1378
                                        D_OP    <= ALU_MD_STP;
1379
                                        D_SX    <= SX_LL;
1380
                                        D_SY    <= SY_RR;
1381
                                        D_WE_RR <= IS_M1;
1382
 
1383
                                when "1110101" =>
1384
                                        OP_CAT  <= MD_FIN;
1385
                                        D_OP    <= ALU_MD_FIN;
1386
                                        D_SX    <= SX_LL;
1387
                                        D_SY    <= SY_RR;
1388
                                        D_WE_RR <= IS_M1;
1389
 
1390
                                when "1110110" =>
1391
                                        OP_CAT  <= MOD_FIN;
1392
                                        D_OP    <= ALU_MOD_FIN;
1393
                                        D_SX    <= SX_LL;
1394
                                        D_SY    <= SY_RR;
1395
                                        D_WE_RR <= IS_M1;
1396
 
1397
                                when "1110111" =>
1398
                                        OP_CAT      <= EI;
1399 17 jsauermann
                                        ENABLE_INT  <= IS_M1;
1400 2 jsauermann
 
1401
                                when "1111001" =>
1402
                                        OP_CAT      <= DI;
1403 17 jsauermann
                                        DISABLE_INT <= IS_M1;
1404 2 jsauermann
 
1405
                                -- undefined --------------------------------------------------------
1406
                                when others =>
1407
                        end case;
1408
                end if;
1409
        end process;
1410
 
1411
end Behavioral;

powered by: WebSVN 2.1.0

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