OpenCores
URL https://opencores.org/ocsvn/6809_6309_compatible_core/6809_6309_compatible_core/trunk

Subversion Repositories 6809_6309_compatible_core

[/] [6809_6309_compatible_core/] [trunk/] [rtl/] [verilog/] [MC6809_cpu.v] - Blame information for rev 5

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

Line No. Rev Author Line
1 2 ale500
/*
2
 *
3
 * MC6809/HD6309 Compatible code
4
 * (c) 2013 R.A. Paz Schmidt
5
 * distributed under the terms of the Lesser GPL, see LICENSE.TXT
6
 *
7
 */
8
 
9
`include "defs.v"
10
module MC6809_cpu(
11
        input  wire cpu_clk,
12
        input  wire cpu_reset,
13
        input  wire cpu_nmi_n,
14
        input  wire cpu_irq_n,
15
        input  wire cpu_firq_n,
16
        output wire [5:0] cpu_state_o,
17
        output wire cpu_we_o,
18
        output wire cpu_oe_o,
19
        output wire [15:0] cpu_addr_o,
20
        input  wire [7:0] cpu_data_i,
21
        output wire [7:0] cpu_data_o
22
        );
23
 
24
wire k_reset;
25
wire k_clk;
26
assign k_clk = cpu_clk;
27
 
28 5 ale500
reg [7:0] k_opcode, k_postbyte, k_ind_ea; /* all bytes of an instruction */
29 2 ale500
reg [7:0] k_pp_regs, k_pp_active_reg; // push/pull mask 
30
reg [7:0] k_memhi, k_memlo, k_cpu_data_o; /* operand read from memory */
31
reg [7:0] k_ofslo, k_ofshi, k_eahi, k_ealo;
32
reg [5:0] state, // state of the main state machine
33
          next_state, // next state to exit to from the read from [PC] state machine
34
                  next_mem_state, // next state to exit to from the read from memory state machine
35 5 ale500
                  next_push_state; // next state to exit to from push multiple state machine
36
reg k_write_tfr, k_write_exg;
37 4 ale500
reg k_cpu_oe, k_cpu_we, k_inc_pc;
38 2 ale500
reg [15:0] k_cpu_addr, k_new_pc;
39
reg k_write_pc, k_inc_su, k_dec_su, k_set_e, k_clear_e;
40 4 ale500
reg [1:0] k_mem_dest;
41
reg k_write_dest; // set for 1 clock when a register has to be written, dec_o_dest_reg_addr has the register source
42
reg k_write_post_incdec; // asserted when in the last write cycle or in write back for loads
43
reg k_forced_mem_size; // used to force the size of a memory read to be 16 bits, used for vector fetch
44 2 ale500
/****
45
 * Decoder outputs
46
 */
47
wire [2:0] dec_o_p1_mode; // addressing mode
48
wire [2:0] dec_o_p1_optype; // k_opcode type
49
wire dec_o_use_s; // signals when S should be used instead of U
50
wire dec_o_alu_size;
51
/* ea decoder */
52
wire dec_o_ea_ofs8, dec_o_ea_ofs16, dec_o_ea_wpost, dec_o_ea_ofs0, dec_o_ea_indirect;
53
/* alu k_opcode decoder */
54
wire [4:0] dec_o_alu_opcode;
55
wire [1:0] dec_o_right_path_mod; /* Modifier for alu's right path input */
56
/* register decoder */
57 4 ale500
wire dec_o_wdest, dec_o_source_size, dec_o_write_flags;
58 2 ale500
wire [3:0] dec_o_left_path_addr, dec_o_right_path_addr, dec_o_dest_reg_addr;
59
/* test condition */
60
wire dec_o_cond_taken;
61
/* ALU outputs */
62
wire [15:0] alu_o_result;
63
wire [7:0] alu_o_CCR;
64
/* Register Module outputs */
65
wire [15:0] regs_o_left_path_data, regs_o_right_path_data, regs_o_eamem_addr, regs_o_su;
66
wire [7:0] regs_o_dp;
67
wire [15:0] regs_o_pc;
68
wire [7:0] regs_o_CCR;
69
/* Data Muxes */
70
reg [3:0] datamux_o_dest_reg_addr, datamux_o_alu_in_left_path_addr;
71
reg [15:0] datamux_o_alu_in_left_path_data, datamux_o_alu_in_right_path_data, datamux_o_dest;
72
 
73 5 ale500
reg k_p2_valid, k_p3_valid; /* 1 when k_postbyte has been loaded for page 2 or page 3 */
74 2 ale500
 
75 4 ale500
/*
76
 * Interrupt sync registers
77
 */
78 2 ale500
 
79
reg [2:0] k_reg_nmi, k_reg_irq, k_reg_firq;
80
wire k_nmi_req, k_firq_req, k_irq_req;
81
 
82
assign k_nmi_req = k_reg_nmi[2] & k_reg_nmi[1];
83
assign k_firq_req = k_reg_firq[2] & k_reg_firq[1];
84
assign k_irq_req = k_reg_irq[2] & k_reg_irq[1];
85
 
86
alu16 alu(
87
        .clk(k_clk),
88
        .a_in(datamux_o_alu_in_left_path_data),
89
        .b_in(datamux_o_alu_in_right_path_data),
90
        .CCR(regs_o_CCR), /* flags */
91
        .opcode_in(dec_o_alu_opcode), /* ALU k_opcode */
92
        .sz_in(dec_o_alu_size), /* size, low 8 bit, high 16 bit */
93
        .q_out(alu_o_result), /* ALU result */
94
        .CCRo(alu_o_CCR)
95
        );
96
 
97
regblock regs(
98
        .clk_in(k_clk),
99
        .path_left_addr(datamux_o_alu_in_left_path_addr),
100
        .path_right_addr(dec_o_right_path_addr),
101 5 ale500
        .write_reg_addr(datamux_o_dest_reg_addr),
102
        .exg_dest_r(k_postbyte[3:0]),
103 2 ale500
        .eapostbyte( k_ind_ea ),
104
        .offset16({ k_ofshi, k_ofslo }),
105 4 ale500
        .write_reg(k_write_dest),
106 5 ale500
        .write_tfr(k_write_tfr),
107
        .write_exg(k_write_exg),
108 2 ale500
        .write_post(k_write_post_incdec),
109
        .write_pc(k_write_pc),
110
        .inc_pc(k_inc_pc),
111
        .inc_su(k_inc_su),
112
        .dec_su(k_dec_su),
113
        .use_s(dec_o_use_s),
114
        .data_w(datamux_o_dest),
115
        .new_pc(k_new_pc),
116
        .CCR_in(alu_o_CCR),
117
        .write_flags(dec_o_write_flags & (state == `SEQ_GRAL_WBACK)),
118
        .set_e(k_set_e),
119
        .clear_e(k_clear_e),
120
        .CCR_o(regs_o_CCR),
121
        .path_left_data(regs_o_left_path_data),
122
        .path_right_data(regs_o_right_path_data),
123
        .eamem_addr(regs_o_eamem_addr),
124
        .reg_pc(regs_o_pc),
125
        .reg_dp(regs_o_dp),
126
        .reg_su(regs_o_su)
127
);
128
 
129
decode_regs dec_regs(
130
        .opcode(k_opcode),
131 5 ale500
        .postbyte0(k_postbyte),
132 2 ale500
        .page2_valid(k_p2_valid),
133
        .page3_valid(k_p3_valid),
134
        .path_left_addr(dec_o_left_path_addr),
135
        .path_right_addr(dec_o_right_path_addr),
136
        .dest_reg(dec_o_dest_reg_addr),
137 4 ale500
        .write_dest(dec_o_wdest),
138
        .source_size(dec_o_source_size),
139 2 ale500
        .result_size(dec_o_alu_size)
140
        );
141
 
142
decode_op dec_op(
143
        .opcode(k_opcode),
144 5 ale500
        .postbyte0(k_postbyte),
145 2 ale500
        .page2_valid(k_p2_valid),
146
        .page3_valid(k_p3_valid),
147
        .mode(dec_o_p1_mode),
148
        .optype(dec_o_p1_optype),
149
        .use_s(dec_o_use_s)
150
        );
151
 
152
decode_ea dec_ea(
153
        .eapostbyte( k_ind_ea ),
154
        .noofs(dec_o_ea_ofs0),
155
        .ofs8(dec_o_ea_ofs8),
156
        .ofs16(dec_o_ea_ofs16),
157
        .write_post(dec_o_ea_wpost),
158
        .isind(dec_o_ea_indirect)
159
        );
160
 
161
/* Opcodes for the ALU are decoded here
162
 * Write Flags are also decoded here
163
 */
164
decode_alu dec_alu(
165
        .opcode(k_opcode),
166 5 ale500
        .postbyte0(k_postbyte),
167 2 ale500
        .page2_valid(k_p2_valid),
168
        .page3_valid(k_p3_valid),
169
        .alu_opcode(dec_o_alu_opcode),
170
        .dec_alu_right_path_mod(dec_o_right_path_mod),
171
        .dest_flags(dec_o_write_flags)
172
        );
173
/* Condition decoder */
174
test_condition test_cond(
175
        .opcode(k_opcode),
176 5 ale500
        .postbyte0(k_postbyte),
177 2 ale500
        .page2_valid(k_p2_valid),
178
        .CCR(regs_o_CCR),
179
        .cond_taken(dec_o_cond_taken)
180
        );
181
 
182
/* Module IO */
183
 
184
assign cpu_oe_o = k_cpu_oe; // we latch on the rising edge
185
assign cpu_we_o = k_cpu_we;
186
assign cpu_addr_o = k_cpu_addr;
187
assign cpu_data_o = k_cpu_data_o;
188
assign k_reset = cpu_reset;
189
assign cpu_state_o = state;
190
 
191
 
192
/* Left Register read mux
193
 */
194
always @(*)
195
        begin
196
                datamux_o_alu_in_left_path_addr = dec_o_left_path_addr;
197
                case (k_pp_active_reg)
198
                        8'h80: datamux_o_alu_in_left_path_addr = `RN_PC;
199
                        8'h40: datamux_o_alu_in_left_path_addr = (dec_o_use_s) ? `RN_U:`RN_S;
200
                        8'h20: datamux_o_alu_in_left_path_addr = `RN_IY;
201
                        8'h10: datamux_o_alu_in_left_path_addr = `RN_IX;
202
                        8'h08: datamux_o_alu_in_left_path_addr = `RN_DP;
203
                        8'h04: datamux_o_alu_in_left_path_addr = `RN_ACCB;
204
                        8'h02: datamux_o_alu_in_left_path_addr = `RN_ACCA;
205
                        8'h01: datamux_o_alu_in_left_path_addr = `RN_CC;
206
                        endcase
207
        end
208
 
209
/* Destination register address MUX
210
 */
211
always @(*)
212
        begin
213
                datamux_o_dest_reg_addr = dec_o_dest_reg_addr;
214
                case (k_pp_active_reg)
215
                        8'h80: datamux_o_dest_reg_addr = `RN_PC;
216
                        8'h40: datamux_o_dest_reg_addr = (dec_o_use_s) ? `RN_U:`RN_S;
217
                        8'h20: datamux_o_dest_reg_addr = `RN_IY;
218
                        8'h10: datamux_o_dest_reg_addr = `RN_IX;
219
                        8'h08: datamux_o_dest_reg_addr = `RN_DP;
220
                        8'h04: datamux_o_dest_reg_addr = `RN_ACCB;
221
                        8'h02: datamux_o_dest_reg_addr = `RN_ACCA;
222
                        8'h01: datamux_o_dest_reg_addr = `RN_CC;
223
                endcase
224
        end
225
 
226
/* Destination register data mux
227
 * selects the source to write to register. 16 bit registers have to be written at once after reading the low byte
228
 *
229
 */
230
always @(*)
231
        begin
232
                datamux_o_dest = alu_o_result;
233
                case (dec_o_p1_optype)
234
                        `OP_PULL, `OP_RTS: // destination register
235
                                datamux_o_dest = { k_memhi, k_memlo };
236
                        `OP_LEA:
237 4 ale500
                                if (dec_o_ea_indirect)// & dec_o_alu_size)
238 2 ale500
                                        datamux_o_dest = { k_memhi, k_memlo };
239
                                else
240
                                        datamux_o_dest = regs_o_eamem_addr;
241
                endcase
242
        end
243
 
244
/* ALU left input mux */
245
 
246
always @(*)
247
        begin
248
                if (dec_o_left_path_addr == `RN_MEM8)
249
                        datamux_o_alu_in_left_path_data = { k_memhi, k_memlo };
250
                else
251 4 ale500
                case (dec_o_p1_optype)
252
                        `OP_LEA:
253
                                if (dec_o_ea_indirect)// & dec_o_alu_size)
254
                                        datamux_o_alu_in_left_path_data = { k_memhi, k_memlo };
255
                                else
256
                                        datamux_o_alu_in_left_path_data = regs_o_eamem_addr;
257
                        default:
258 2 ale500
                                datamux_o_alu_in_left_path_data = regs_o_left_path_data;
259 4 ale500
                endcase
260
        end
261
/* PC as destination from jmp/bsr mux */
262
always @(*)
263
        begin
264
                k_new_pc = { k_memhi,k_memlo }; // used to fetch reset vector
265
                case (dec_o_p1_mode)
266
                        `REL16: k_new_pc = regs_o_pc + { k_memhi,k_memlo };
267
                        `REL8: k_new_pc = regs_o_pc + { {8{k_memlo[7]}}, k_memlo };
268
                        `EXTENDED: k_new_pc = { k_eahi,k_ealo };
269
                        `DIRECT: k_new_pc = { regs_o_dp, k_ealo };
270
                        `INDEXED:
271
                                if (dec_o_ea_indirect)
272
                                        k_new_pc = { k_memhi,k_memlo };
273
                                else
274
                                        k_new_pc = regs_o_eamem_addr;
275
 
276
                endcase
277 2 ale500
        end
278
/* ALU right input mux */
279
always @(*)
280
        begin
281
                case (dec_o_right_path_addr)
282
                        `RN_MEM8:
283
                                datamux_o_alu_in_right_path_data = { 8'h00, k_memlo };
284
                        `RN_MEM16:
285
                                datamux_o_alu_in_right_path_data = { k_memhi, k_memlo };
286
                        `RN_IMM8:
287
                                datamux_o_alu_in_right_path_data = { 8'h0, k_memlo };
288
                        `RN_IMM16:
289
                                datamux_o_alu_in_right_path_data = { k_memhi, k_memlo };
290
                        default:
291
                                case (dec_o_right_path_mod)
292
                                        `MOD_DEFAULT: datamux_o_alu_in_right_path_data = regs_o_right_path_data;
293
                                        `MOD_ONE: datamux_o_alu_in_right_path_data = 16'h0001;
294
                                        `MOD_ZERO: datamux_o_alu_in_right_path_data = 16'h0000;
295
                                        `MOD_MINUS1: datamux_o_alu_in_right_path_data = 16'hffff;
296
                                endcase
297
                endcase
298
        end
299
 
300
always @(posedge k_clk or posedge k_reset)
301
        begin
302
                if (k_reset == 1'b1)
303
                        begin
304
                                state <= `SEQ_COLDRESET;
305
                                k_reg_nmi <= 0;
306
                                k_reg_firq <= 0;
307
                                k_reg_irq <= 0;
308
                        end
309
                else
310
                        begin
311
                                /* Inrerrupt recognition and acknowledge */
312
                                if (!k_reg_nmi[2])
313
                                        k_reg_nmi <= { k_reg_nmi[1:0], cpu_nmi_n };
314
                                if (!k_reg_irq[2])
315
                                        k_reg_irq <= { k_reg_irq[1:0], cpu_irq_n };
316
                                if (!k_reg_firq[2])
317
                                        k_reg_firq <= { k_reg_firq[1:0], cpu_firq_n };
318
                                /* modifier registers */
319
                                if (k_inc_pc)
320
                                        k_inc_pc <= 0;
321
                                if (k_write_pc)
322
                                        k_write_pc <= 0;
323
                                if (k_cpu_we)
324
                                        k_cpu_we <= 0;
325
                                if (k_cpu_oe)
326
                                        k_cpu_oe <= 0;
327
                                if (k_write_post_incdec)
328
                                        k_write_post_incdec <= 0;
329
                                if (k_dec_su)
330
                                        k_dec_su <= 0;
331
                                if (k_inc_su)
332
                                        k_inc_su <= 0;
333
                                if (k_set_e)
334
                                        k_set_e <= 0;
335
                                if (k_clear_e)
336 4 ale500
                                        k_clear_e <= 0;
337
                                if (k_write_dest)
338 5 ale500
                                        k_write_dest <= 0;
339
                                if (k_write_exg)
340
                                        k_write_exg <= 0;
341
                                if (k_write_tfr)
342
                                        k_write_tfr <= 0;
343 2 ale500
                        case (state)
344
                                `SEQ_COLDRESET:
345 4 ale500
                                        begin
346
                                                k_forced_mem_size <= 1;
347 2 ale500
                                                state <= `SEQ_MEM_READ_H;
348
                                                k_eahi <= 8'hff;
349
                                                k_ealo <= 8'hfe;
350
                                                next_mem_state <= `SEQ_LOADPC;
351
                                        end
352
                                `SEQ_NMI:
353
                                        begin
354 4 ale500
                                                k_forced_mem_size <= 1;
355 2 ale500
                                                k_reg_nmi <= 2'h0;
356
                                                { k_eahi, k_ealo } <= 16'hfffc;
357
                                                k_pp_regs <= 8'hff;
358
                                                k_set_e <= 1;
359
                                                state <= `SEQ_PREPUSH; // first stack the registers
360
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
361
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
362
                                        end
363
                                `SEQ_SWI:
364
                                        begin
365 4 ale500
                                                k_forced_mem_size <= 1;
366 2 ale500
                                                state <= `SEQ_MEM_READ_H;
367
                                                { k_eahi, k_ealo } <= 16'hfffa;
368
                                                k_pp_regs <= 8'hff;
369
                                                state <= `SEQ_PREPUSH; // first stack the registers
370
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
371
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
372
                                                k_set_e <= 1;
373
                                        end
374
                                `SEQ_IRQ:
375
                                        begin
376 4 ale500
                                                k_forced_mem_size <= 1;
377 2 ale500
                                                k_reg_irq <= 2'h0;
378
                                                state <= `SEQ_MEM_READ_H;
379
                                                { k_eahi, k_ealo } <= 16'hfff8;
380
                                                k_pp_regs <= 8'hff;
381
                                                next_mem_state <= `SEQ_PREPUSH;
382
                                                k_set_e <= 1;
383
                                                state <= `SEQ_PREPUSH; // first stack the registers
384
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
385
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
386
                                        end
387
                                `SEQ_FIRQ:
388
                                        begin
389 4 ale500
                                                k_forced_mem_size <= 1;
390 2 ale500
                                                k_reg_firq <= 2'h0;
391
                                                { k_eahi, k_ealo } <= 16'hfff6;
392
                                                k_pp_regs <= 8'h81; // PC & CC
393
                                                k_clear_e <= 1;
394
                                                state <= `SEQ_PREPUSH; // first stack the registers
395
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
396
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
397
                                        end
398
                                `SEQ_SWI2:
399
                                        begin
400 4 ale500
                                                k_forced_mem_size <= 1;
401 2 ale500
                                                { k_eahi, k_ealo } <= 16'hfff4;
402
                                                k_pp_regs <= 8'hff;
403
                                                k_set_e <= 1;
404
                                                state <= `SEQ_PREPUSH; // first stack the registers
405
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
406
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
407
                                        end
408
                                `SEQ_SWI3:
409
                                        begin
410 4 ale500
                                                k_forced_mem_size <= 1;
411 2 ale500
                                                { k_eahi, k_ealo } <= 16'hfff2;
412
                                                k_pp_regs <= 8'hff;
413
                                                k_set_e <= 1;
414
                                                state <= `SEQ_PREPUSH; // first stack the registers
415
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
416
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
417
                                        end
418
                                `SEQ_UNDEF:
419
                                        begin
420 4 ale500
                                                k_forced_mem_size <= 1;
421 2 ale500
                                                { k_eahi, k_ealo } <= 16'hfff0;
422
                                                k_pp_regs <= 8'hff;
423
                                                k_set_e <= 1;
424
                                                state <= `SEQ_PREPUSH; // first stack the registers
425
                                                next_push_state <= `SEQ_MEM_READ_H; // than load new PC
426
                                                next_mem_state <= `SEQ_FETCH; // than continue fetching instructions
427
                                        end
428
                                `SEQ_LOADPC: /* loads the PC with the address taken from the reset vector */
429
                                        begin
430
                                                $display("cpu_data_i %02x %t", cpu_data_i, $time);
431
                                                state <= `SEQ_FETCH;
432
                                        end
433
                                `SEQ_FETCH: /* execution starts here */
434
                                        begin
435
                                                if (k_nmi_req)
436
                                                        state <= `SEQ_NMI;
437
                                                else
438
                                                if (k_firq_req)
439
                                                        state <= `SEQ_FIRQ;
440
                                                else
441
                                                if (k_irq_req)
442
                                                        state <= `SEQ_IRQ;
443
                                                else
444
                                                        begin
445
                                                                state <= `SEQ_FETCH_1;
446
                                                                k_cpu_addr <= regs_o_pc;
447
                                                        end
448
                                        end
449
                                `SEQ_FETCH_1:
450
                                        begin
451
                                                k_cpu_oe <= 1;
452 4 ale500
                                                state <= `SEQ_FETCH_2;
453
                                                k_inc_pc <= 1;
454 2 ale500
                                        end
455
                                `SEQ_FETCH_2:
456
                                        begin
457
                                                k_opcode <= cpu_data_i;
458
                                                case (cpu_data_i[7:0]) /* page 2 & 3 opcodes are recognized here */
459
                                                        8'h10:
460
                                                                begin
461
                                                                        k_p2_valid <= 1;
462
                                                                        k_p3_valid <= 0;
463
                                                                        state <= `SEQ_FETCH_3;
464
                                                                end
465
                                                        8'h11:
466
                                                        begin
467
                                                                k_p2_valid <= 0;
468
                                                                k_p3_valid <= 1;
469
                                                                state <= `SEQ_FETCH_3;
470
                                                        end
471 5 ale500
                                                        8'h1e, 8'h1f:
472
                                                                begin
473
                                                                        state <= `SEQ_FETCH_3; // tfr, exg, treated separately
474
                                                                        k_p2_valid <= 0; // set when an k_opcode is page 2
475
                                                                        k_p3_valid <= 0; // set when an k_opcode is page 3
476
                                                                end
477 2 ale500
                                                        default:
478
                                                        begin
479
                                                                state <= `SEQ_DECODE;
480
                                                                k_p2_valid <= 0; // set when an k_opcode is page 2
481
                                                                k_p3_valid <= 0; // set when an k_opcode is page 3
482
                                                        end
483
                                                endcase
484
                                                k_pp_active_reg <= 8'h00; // prevents wrong register in left/dest data muxes
485
                                        end
486
                                `SEQ_FETCH_3:
487
                                        begin
488
                                                state <= `SEQ_FETCH_4;
489
                                                k_cpu_addr <= regs_o_pc;
490
                                        end
491
                                `SEQ_FETCH_4:
492
                                        begin
493
                                                k_cpu_oe <= 1;
494
                                                state <= `SEQ_FETCH_5;
495
                                        end
496
                                `SEQ_FETCH_5: /* fetches a page 2 or 3 opcode */
497
                                        begin
498 5 ale500
                                                k_postbyte <= cpu_data_i;
499 2 ale500
                                                k_inc_pc <= 1;
500
                                                state <= `SEQ_DECODE_P23;
501
                                        end
502
                                `SEQ_DECODE:
503
                                        begin
504
                                                /* here we have the first byte of the k_opcode and should be decided to which state we jump
505
                                                 * inherent means that no extra info is needed
506
                                                 * ALU opcodes need routing of registers to/from the ALU to the registers
507
                                                 */
508
                                                case (dec_o_p1_mode)
509 4 ale500
                                                        `NONE: // unknown k_opcode or push/pull... refetch ?
510 2 ale500
                                                                begin
511
                                                                        casex (k_opcode)
512
                                                                                8'h39: // RTS
513 4 ale500
                                                                                        begin
514 2 ale500
                                                                                                state <= `SEQ_PREPULL;
515
                                                                                                k_pp_regs <= 8'h80; // Pull PC (RTS)all regs
516
                                                                                        end
517
                                                                                8'h3B: // RTI
518 4 ale500
                                                                                        begin
519 2 ale500
                                                                                                state <= `SEQ_PREPULL;
520
                                                                                                k_pp_regs <= 8'hff; // all regs
521
                                                                                        end
522
                                                                                8'b001101x0: // PUSH S&U
523
                                                                                        begin
524
                                                                                                state <= `SEQ_PC_READ_L;
525
                                                                                                next_state <= `SEQ_PREPUSH;
526
                                                                                                next_push_state <= `SEQ_FETCH;
527
                                                                                        end
528
                                                                                8'b001101x1: // PULL S&U
529
                                                                                        begin
530
                                                                                                next_state <= `SEQ_PREPULL;
531
                                                                                                state <= `SEQ_PC_READ_L;
532
                                                                                        end
533
                                                                                default: /* we ignore unknown opcodes */
534
                                                                                        state <= `SEQ_FETCH;
535
                                                                        endcase
536
                                                                end
537
                                                        `IMMEDIATE:     // 8 or 16 bits as result decides..
538
                                                                begin
539
                                                                        if (dec_o_alu_size)
540
                                                                                state <= `SEQ_PC_READ_H;
541
                                                                        else
542
                                                                                state <= `SEQ_PC_READ_L;
543
                                                                        next_state <= `SEQ_GRAL_ALU;
544
                                                                end
545
                                                        `INHERENT:
546
                                                                begin
547
                                                                        case (k_opcode)
548
                                                                                8'h3f: state <= `SEQ_SWI;
549
                                                                                        default: state <= `SEQ_GRAL_ALU;
550
                                                                        endcase
551
                                                                end
552
                                                        `DIRECT:
553
                                                                begin
554
                                                                        state <= `SEQ_PC_READ_L;
555
                                                                        k_mem_dest <= `MEMDEST_MH; // operand to memlo/memhi
556
                                                                        if ((dec_o_right_path_addr == `RN_MEM8) || (dec_o_right_path_addr == `RN_MEM16) ||
557
                                                                                (dec_o_left_path_addr == `RN_MEM8))
558
                                                                                begin
559 4 ale500
                                                                                        next_state <= `SEQ_MEM_READ_H;
560 2 ale500
                                                                                        next_mem_state <= `SEQ_GRAL_ALU; // read then alu
561
                                                                                end
562
                                                                        else
563
                                                                                next_state <= `SEQ_GRAL_ALU; // no read
564
                                                                        k_eahi <= regs_o_dp;
565
                                                                end
566
                                                        `INDEXED:
567
                                                                state <= `SEQ_IND_READ_EA;
568
                                                        `EXTENDED:
569
                                                                begin
570
                                                                        state <= `SEQ_PC_READ_H; // loads address
571
                                                                        k_mem_dest <= `MEMDEST_MH; // operand to memlo/memhi
572
                                                                        if ((dec_o_right_path_addr == `RN_MEM8) || (dec_o_right_path_addr == `RN_MEM16) ||
573
                                                                                (dec_o_left_path_addr == `RN_MEM8))
574
                                                                                begin
575 4 ale500
                                                                                        next_state <= `SEQ_MEM_READ_H;
576 2 ale500
                                                                                        next_mem_state <= `SEQ_GRAL_ALU; // read then alu
577
                                                                                end
578
                                                                        else
579
                                                                                next_state <= `SEQ_GRAL_ALU; // no read
580
                                                                end
581
                                                        `REL8:
582
                                                                begin
583
                                                                        state <= `SEQ_PC_READ_L; // loads address
584
                                                                        if (dec_o_p1_optype == `OP_JSR) // bsr
585
                                                                                next_state <= `SEQ_JSR_PUSH;
586
                                                                        else
587
                                                                                next_state <= `SEQ_JMP_LOAD_PC; // offset loaded in this cycle, jump if needed
588
                                                                end
589
                                                        `REL16:
590
                                                                begin
591
                                                                        state <= `SEQ_PC_READ_H; // loads address
592
                                                                        if (dec_o_p1_optype == `OP_JSR) // lbsr
593
                                                                                next_state <= `SEQ_JSR_PUSH;
594
                                                                        else
595
                                                                                next_state <= `SEQ_JMP_LOAD_PC;
596
                                                                end
597
                                                endcase
598
                                        end
599
                                `SEQ_DECODE_P23:
600
                                        begin // has prefix 10 or 11
601
                                                case (dec_o_p1_mode)
602
                                                        `NONE: // unknown k_opcode... re-fetch ?
603
                                                                state <= `SEQ_FETCH;
604
                                                        `IMMEDIATE:     // 8 or 16 bits as result decides..
605 5 ale500
                                                                begin
606
                                                                        case (k_opcode)
607
                                                                                8'h1e: begin k_write_exg <= 1; state <= `SEQ_TFREXG; end
608
                                                                                8'h1f: begin k_write_tfr <= 1; state <= `SEQ_TFREXG; end
609
                                                                                default:
610
                                                                                        begin
611
                                                                                                next_state <= `SEQ_GRAL_ALU;
612
                                                                                                if (dec_o_alu_size)
613
                                                                                                        state <= `SEQ_PC_READ_H;
614
                                                                                                else
615
                                                                                                        state <= `SEQ_PC_READ_L;
616
                                                                                end
617
                                                                        endcase
618 2 ale500
                                                                end
619
                                                        `INHERENT:
620
                                                                case (k_opcode)
621
                                                                        8'h3f: if (k_p2_valid) state <= `SEQ_SWI2;
622
                                                                                   else state <= `SEQ_SWI3;
623
                                                                        default: state <= `SEQ_GRAL_ALU;
624
                                                                endcase
625
                                                        `DIRECT:
626
                                                                begin
627
                                                                        state <= `SEQ_PC_READ_L;
628
                                                                        k_mem_dest <= `MEMDEST_MH; // operand to memlo/memhi
629
                                                                        if ((dec_o_right_path_addr == `RN_MEM8) || (dec_o_right_path_addr == `RN_MEM16) ||
630
                                                                                (dec_o_left_path_addr == `RN_MEM8))
631
                                                                                begin
632 4 ale500
                                                                                        next_state <= `SEQ_MEM_READ_H;
633 2 ale500
                                                                                        next_mem_state <= `SEQ_GRAL_ALU; // read then alu
634
                                                                                end
635
                                                                        else
636
                                                                                next_state <= `SEQ_GRAL_ALU; // no read
637
                                                                        k_eahi <= regs_o_dp;
638
                                                                end
639
                                                        `INDEXED:
640
                                                                state <= `SEQ_IND_READ_EA;
641
                                                        `EXTENDED:
642
                                                                begin
643
                                                                        state <= `SEQ_PC_READ_H; // loads address
644
                                                                        k_mem_dest <= `MEMDEST_MH; // operand to memlo/memhi
645
                                                                        if ((dec_o_right_path_addr == `RN_MEM8) || (dec_o_right_path_addr == `RN_MEM16) ||
646
                                                                                (dec_o_left_path_addr == `RN_MEM8))
647
                                                                                begin
648 4 ale500
                                                                                        next_state <= `SEQ_MEM_READ_H;
649 2 ale500
                                                                                        next_mem_state <= `SEQ_GRAL_ALU; // read then alu
650
                                                                                end
651
                                                                        else
652
                                                                                next_state <= `SEQ_GRAL_ALU; // no read
653
                                                                end
654
                                                        `REL16:
655
                                                                begin // long branches only
656
                                                                        state <= `SEQ_PC_READ_H; // loads address
657
                                                                        next_state <= `SEQ_JMP_LOAD_PC;
658
                                                                end
659
                                                endcase
660
                                        end
661 4 ale500
                                `SEQ_GRAL_ALU:
662
                                        begin
663
                                                state <= `SEQ_GRAL_WBACK;
664
                                                k_write_dest <= 1; /* write destination on wback */
665
                                        end
666 2 ale500
                                `SEQ_GRAL_WBACK:
667
                                        begin
668 4 ale500
                                                next_mem_state <= `SEQ_FETCH;
669 2 ale500
                                                case (dec_o_dest_reg_addr)
670
                                                        `RN_MEM8: state <= `SEQ_MEM_WRITE_L;
671
                                                        `RN_MEM16: state <= `SEQ_MEM_WRITE_H;
672
                                                        default:
673
                                                                begin
674
                                                                        state <= `SEQ_FETCH;
675
                                                                        k_write_post_incdec <= dec_o_ea_wpost;
676
                                                                end
677
                                                endcase
678
                                        end
679
                                `SEQ_INH_ALU:
680 5 ale500
                                        state <= `SEQ_GRAL_WBACK;
681
                                `SEQ_TFREXG:
682
                                        state <= `SEQ_FETCH;
683 2 ale500
                                `SEQ_IND_READ_EA: // reads EA byte
684
                                        begin
685
                                                k_cpu_addr <= regs_o_pc;
686
                                                state <= `SEQ_IND_READ_EA_1;
687
                                                k_inc_pc <= 1;
688
                                        end
689
                                `SEQ_IND_READ_EA_1:
690
                                        begin
691
                                                k_cpu_oe <= 1; // read
692
                                                state <= `SEQ_IND_READ_EA_2;
693
                                        end
694
                                `SEQ_IND_READ_EA_2:
695
                                        begin
696
                                                k_ind_ea <= cpu_data_i;
697
                                                state <= `SEQ_IND_DECODE;
698
                                        end
699
                                `SEQ_IND_DECODE: // here we have to see what we need for indexed...
700
                                        begin
701
                                                if (dec_o_ea_ofs8)
702
                                                        begin // load 1 byte offset
703
                                                                state <= `SEQ_PC_READ_L;
704
                                                                next_state <= `SEQ_IND_DECODE_OFS; // has some offset, load arg
705
                                                        end
706
                                                else
707
                                                        if (dec_o_ea_ofs16)
708
                                                                begin // load 2 bytes offset
709
                                                                        state <= `SEQ_PC_READ_H;
710
                                                                        next_state <= `SEQ_IND_DECODE_OFS; // has some offset, load arg
711
                                                                end
712
                                                        else
713
                                                                //if (dec_o_ea_ofs0)
714
                                                                        begin // no extra load...
715
                                                                                if ((dec_o_right_path_addr == `RN_MEM8) || (dec_o_right_path_addr == `RN_MEM16) ||
716
                                                                                        (dec_o_left_path_addr == `RN_MEM8))
717
                                                                                        begin
718
                                                                                                k_mem_dest <= `MEMDEST_MH; // operand land in k_memhi/lo
719
                                                                                                next_mem_state <= `SEQ_GRAL_ALU;
720 4 ale500
                                                                                                state <= `SEQ_MEM_READ_H;
721 2 ale500
                                                                                        end
722
                                                                                else
723
                                                                                        state <= `SEQ_GRAL_ALU; // no load, then store
724
                                                                        end
725
                                        end
726
                                `SEQ_IND_DECODE_OFS: // loads argument if needed
727
                                        begin
728
                                                if ((dec_o_right_path_addr == `RN_MEM8) || (dec_o_right_path_addr == `RN_MEM16) ||
729
                                                        (dec_o_left_path_addr == `RN_MEM8))
730
                                                        begin
731
                                                                k_mem_dest <= `MEMDEST_MH; // operand land in k_memhi/lo
732
                                                                next_mem_state <= `SEQ_GRAL_ALU;
733 4 ale500
                                                                state <= `SEQ_MEM_READ_H;
734 2 ale500
                                                        end
735
                                                else
736
                                                        state <= `SEQ_GRAL_ALU; // no load, then store
737
                                        end
738
                                `SEQ_JMP_LOAD_PC:
739
                                        begin
740
                                                state <= `SEQ_FETCH;
741
                                        end
742
                                `SEQ_JSR_PUSH:
743
                                        begin
744
                                                k_pp_active_reg <= 8'h80; // push PC
745
                                                state <= `SEQ_PUSH_WRITE_L;
746
                                                next_state <= `SEQ_JMP_LOAD_PC;
747
                                        end
748
                                `SEQ_PREPUSH:
749
                                        begin
750
                                                next_state <= `SEQ_PREPUSH;
751 4 ale500
                                                if (k_pp_regs > 0)
752
                                                        begin
753
                                                                state <= `SEQ_PUSH_WRITE_L;
754
                                                                //k_dec_su <= 1;
755
                                                        end
756 2 ale500
                                                else
757
                                                        state <= next_push_state;
758
                                                if (k_pp_regs[7]) begin k_pp_regs[7] <= 0; k_pp_active_reg <= 8'h80; end
759
                                                else
760
                                                if (k_pp_regs[6]) begin k_pp_regs[6] <= 0; k_pp_active_reg <= 8'h40; end
761
                                                else
762
                                                if (k_pp_regs[5]) begin k_pp_regs[5] <= 0; k_pp_active_reg <= 8'h20; end
763
                                                else
764
                                                if (k_pp_regs[4]) begin k_pp_regs[4] <= 0; k_pp_active_reg <= 8'h10; end
765
                                                else
766
                                                if (k_pp_regs[3]) begin k_pp_regs[3] <= 0; k_pp_active_reg <= 8'h08; end
767
                                                else
768
                                                if (k_pp_regs[2]) begin k_pp_regs[2] <= 0; k_pp_active_reg <= 8'h04; end
769
                                                else
770
                                                if (k_pp_regs[1]) begin k_pp_regs[1] <= 0; k_pp_active_reg <= 8'h02; end
771
                                                else
772
                                                if (k_pp_regs[0]) begin k_pp_regs[0] <= 0; k_pp_active_reg <= 8'h01; end
773
                                        end
774
                                `SEQ_PREPULL:
775 4 ale500
                                        begin
776
                                                if (k_pp_regs != 8'h0)
777
                                                        begin
778
                                                                k_mem_dest <= `MEMDEST_MH;
779
                                                                next_mem_state <= `SEQ_PREPULL;
780
                                                        end
781
                                                else
782
                                                        state <= `SEQ_FETCH; // end of sequence
783 2 ale500
                                                if (k_pp_regs[0]) begin k_pp_active_reg <= 8'h01; k_pp_regs[0] <= 0; state <= `SEQ_MEM_READ_L; end
784
                                                else
785
                                                if (k_pp_regs[1]) begin k_pp_active_reg <= 8'h02; k_pp_regs[1] <= 0; state <= `SEQ_MEM_READ_L; end
786
                                                else
787
                                                if (k_pp_regs[2]) begin k_pp_active_reg <= 8'h04; k_pp_regs[2] <= 0; state <= `SEQ_MEM_READ_L; end
788
                                                else
789
                                                if (k_pp_regs[3]) begin k_pp_active_reg <= 8'h08; k_pp_regs[3] <= 0; state <= `SEQ_MEM_READ_L; end
790
                                                else
791
                                                if (k_pp_regs[4]) begin k_pp_active_reg <= 8'h10; k_pp_regs[4] <= 0; state <= `SEQ_MEM_READ_H;end
792
                                                else
793
                                                if (k_pp_regs[5]) begin k_pp_active_reg <= 8'h20; k_pp_regs[5] <= 0; state <= `SEQ_MEM_READ_H;end
794
                                                else
795
                                                if (k_pp_regs[6]) begin k_pp_active_reg <= 8'h40; k_pp_regs[6] <= 0; state <= `SEQ_MEM_READ_H; end
796
                                                else
797 4 ale500
                                                if (k_pp_regs[7]) begin k_pp_active_reg <= 8'h80;  k_pp_regs[7] <= 0; state <= `SEQ_MEM_READ_H; end
798 2 ale500
                                        end
799
                                `SEQ_PUSH_WRITE_L: // first low byte push 
800
                                        begin
801
                                                k_cpu_data_o <= regs_o_left_path_data[7:0];
802
                                                state <= `SEQ_PUSH_WRITE_L_1;
803
                                                k_cpu_we <= 1; // write
804 4 ale500
                                                k_cpu_addr <= regs_o_su - 16'h1;
805
                                                k_dec_su <= 1;
806 2 ale500
                                        end
807
                                `SEQ_PUSH_WRITE_L_1:
808
                                        begin
809
                                                if (k_pp_active_reg[7:4] > 0)
810
                                                        state <= `SEQ_PUSH_WRITE_H;
811
                                                else
812
                                                        if (k_pp_regs[3:0] > 0)
813
                                                                state <= `SEQ_PREPUSH;
814
                                                        else
815 4 ale500
                                                                state <= next_push_state;
816
                                                k_cpu_addr <= k_cpu_addr - 16'h1; // when pushing 16 bits the second decrement comes too late 
817 2 ale500
                                        end
818
                                `SEQ_PUSH_WRITE_H: // reads high byte
819
                                        begin
820
                                                k_cpu_data_o <= regs_o_left_path_data[15:8];
821
                                                state <= `SEQ_PUSH_WRITE_H_1;
822 4 ale500
                                                k_cpu_we <= 1; // write
823
                                                if (k_pp_active_reg[3:0] > 0)
824
                                                        k_cpu_addr <= regs_o_su;
825 2 ale500
                                                k_dec_su <= 1; // decrement stack pointer
826
                                        end
827
                                `SEQ_PUSH_WRITE_H_1:
828 4 ale500
                                        begin
829
                                                if (next_state == `SEQ_JMP_LOAD_PC)
830
                                                        k_write_pc <= 1; // load PC in the next cycle, the mux output will have the right source
831 2 ale500
                                                state <= next_state;
832
                                        end
833
                                `SEQ_PC_READ_H: // reads high byte for [PC], used by IMM, DIR, EXT
834
                                        begin
835
                                                k_cpu_addr <= regs_o_pc;
836
                                                state <= `SEQ_PC_READ_H_1;
837
                                                k_inc_pc <= 1;
838
                                        end
839
                                `SEQ_PC_READ_H_1:
840
                                        begin
841
                                                k_cpu_oe <= 1; // read
842
                                                state <= `SEQ_PC_READ_H_2;
843
                                        end
844
                                `SEQ_PC_READ_H_2:
845
                                        begin
846
                                                case (dec_o_p1_mode)
847
                                                        `REL16, `IMMEDIATE: k_memhi <= cpu_data_i;
848
                                                        `EXTENDED: k_eahi <= cpu_data_i;
849
                                                        `INDEXED: k_ofshi <= cpu_data_i;
850
                                                endcase
851
                                                state <= `SEQ_PC_READ_L;
852
                                        end
853
                                `SEQ_PC_READ_L: // reads low byte [PC]
854
                                        begin
855
                                                k_cpu_addr <= regs_o_pc;
856
                                                state <= `SEQ_PC_READ_L_1;
857
                                                k_inc_pc <= 1;
858
                                        end
859
                                `SEQ_PC_READ_L_1:
860
                                        begin
861
                                                k_cpu_oe <= 1; // read
862
                                                state <= `SEQ_PC_READ_L_2;
863
                                        end
864
                                `SEQ_PC_READ_L_2:
865
                                        begin
866
                                                case (dec_o_p1_mode)
867
                                                        `NONE: k_pp_regs <= cpu_data_i; // push & pull
868
                                                        `REL8, `REL16, `IMMEDIATE: k_memlo <= cpu_data_i;
869
                                                        `DIRECT, `EXTENDED: k_ealo <= cpu_data_i;
870
                                                        `INDEXED: k_ofslo <= cpu_data_i;
871 4 ale500
                                                endcase
872
                                                if ((next_state == `SEQ_JMP_LOAD_PC) & (dec_o_cond_taken))
873
                                                        k_write_pc <= 1; // load PC in the next cycle, the mux output will have the right source
874 2 ale500
                                                state <= next_state;
875
                                        end
876
                                `SEQ_MEM_READ_H: // reads high byte
877
                                        begin
878
                                                case (dec_o_p1_mode)
879
                                                        `NONE: begin k_cpu_addr <= regs_o_su; k_inc_su <= 1; end // pull, rts, rti
880
                                                        `INDEXED: k_cpu_addr <= regs_o_eamem_addr;
881
                                                        default: k_cpu_addr <= { k_eahi, k_ealo };
882 4 ale500
                                                endcase
883
                                                if (k_forced_mem_size | dec_o_source_size | (k_pp_active_reg[7:4] != 0))
884
                                                        state <= `SEQ_MEM_READ_H_1;
885
                                                else
886
                                                        state <= `SEQ_MEM_READ_L_1;
887
                                                k_forced_mem_size <= 0; // used for vector fetch
888 2 ale500
                                        end
889
                                `SEQ_MEM_READ_H_1:
890
                                        begin
891
                                                k_cpu_oe <= 1; // read
892
                                                state <= `SEQ_MEM_READ_H_2;
893
                                        end
894
                                `SEQ_MEM_READ_H_2:
895
                                        begin
896
                                                case (k_mem_dest)
897 4 ale500
                                                        `MEMDEST_PC,//: k_new_pc[15:8] <= cpu_data_i;
898 2 ale500
                                                        `MEMDEST_MH: k_memhi <= cpu_data_i;
899
                                                        `MEMDEST_AH: k_eahi <= cpu_data_i;
900
                                                endcase
901
                                                state <= `SEQ_MEM_READ_L_1;
902 4 ale500
                                                k_cpu_addr  <= k_cpu_addr + 16'h1;
903
                                                case (dec_o_p1_mode)
904
                                                        `NONE: begin k_inc_su <= 1; end // pull, rts, rti
905
                                                endcase
906 2 ale500
                                        end
907 4 ale500
                                `SEQ_MEM_READ_L: // reads low byte
908 2 ale500
                                        begin
909 4 ale500
                                                // falls through from READ_MEM_H with the right address
910 2 ale500
                                                case (dec_o_p1_mode)
911 4 ale500
                                                        `NONE: begin k_cpu_addr <= regs_o_su; k_inc_su <= 1; end // pull, rts, rti
912 2 ale500
                                                endcase
913
                                                state <= `SEQ_MEM_READ_L_1;
914
                                        end
915
                                `SEQ_MEM_READ_L_1:
916
                                        begin
917
                                                k_cpu_oe <= 1; // read
918
                                                state <= `SEQ_MEM_READ_L_2;
919
                                        end
920
                                `SEQ_MEM_READ_L_2:
921
                                        begin
922
                                                case (k_mem_dest)
923 4 ale500
                                                        `MEMDEST_PC: begin k_memlo <= cpu_data_i; k_write_pc <= 1; end
924 2 ale500
                                                        `MEMDEST_MH: k_memlo <= cpu_data_i;
925
                                                        `MEMDEST_AH: k_ealo <= cpu_data_i;
926
                                                endcase
927
                                                case (dec_o_p1_mode)
928 4 ale500
                                                        `NONE, `INHERENT: k_write_dest <= 1; // pull, rts, rti
929 2 ale500
                                                endcase
930
                                                state <= next_mem_state;
931
                                        end
932
                                `SEQ_MEM_WRITE_H: // writes high byte
933
                                        begin
934
                                                case (dec_o_p1_mode)
935
                                                        `INDEXED: k_cpu_addr <= regs_o_eamem_addr;
936
                                                        default: k_cpu_addr <= { k_eahi, k_ealo };
937
                                                endcase
938 4 ale500
                                                k_cpu_data_o <= datamux_o_dest[15:8];
939 2 ale500
                                                state <= `SEQ_MEM_WRITE_H_1;
940
                                                k_cpu_we <= 1; // read
941
                                        end
942
                                `SEQ_MEM_WRITE_H_1:
943
                                        begin
944
                                                state <= `SEQ_MEM_WRITE_L;
945
                                                k_cpu_addr <= k_cpu_addr + 16'h1;
946
                                        end
947
                                `SEQ_MEM_WRITE_L: // reads high byte
948
                                        begin
949 4 ale500
                                                if (!dec_o_alu_size) // only if it is a n 8 bit write
950 2 ale500
                                                        case (dec_o_p1_mode)
951
                                                                `INDEXED: k_cpu_addr <= regs_o_eamem_addr;
952
                                                                default: k_cpu_addr <= { k_eahi, k_ealo };
953
                                                        endcase
954
                                                k_cpu_data_o <= datamux_o_dest[7:0];
955
                                                state <= `SEQ_MEM_WRITE_L_1;
956
                                                k_cpu_we <= 1; // write
957
                                        end
958
                                `SEQ_MEM_WRITE_L_1:
959
                                        begin
960
                                                k_write_post_incdec <= dec_o_ea_wpost;
961
                                                state <= next_mem_state;
962
                                        end
963
 
964
                        endcase
965
                end
966
        end
967
 
968
initial
969
        begin
970
                k_cpu_oe = 0;
971
                k_cpu_we = 0;
972
                k_mem_dest = 0;
973 5 ale500
                k_new_pc = 16'hffff;
974
                k_write_tfr = 0;
975
                k_write_exg = 0;
976 2 ale500
        end
977
endmodule

powered by: WebSVN 2.1.0

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