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

Subversion Repositories cpu8080

[/] [cpu8080/] [trunk/] [project/] [junk] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 samiam9512
0a1
2
> `timescale 1ns / 1ps
3
67,84d67
4
< //  Modifications, commented by 'CNS' below, NOV-12-2006 Chris N. Strahm      //
5
< //        (1)     Fixed warnings due to bit width truncations, assignment sizes.        //
6
< //  (2) Changed tristate data bus to din,dout. Better for internal FPGA use.  //
7
< //  (3) Removed waitr line, hard assigned to 0.  Not much use in FPGA's.      //
8
< //  (4) Implemented INTR hardware vectoring.  Orig 8080 external INT vector   //
9
< //      scheme not useful for FPGAs with other soft core perfs. Added inputs: //
10
< //      INTR[1] - Vector/Reset to 0008H                                       //
11
< //      INTR[2] - Vector/Reset to 0010H                                       //
12
< //      INTR[3] - Vector/Reset to 0018H                                       //
13
< //      INTR[4] - Vector/Reset to 0020H                                       //
14
< //      INTR[5] - Vector/Reset to 0028H                                       //
15
< //      INTR[6] - Vector/Reset to 0030H                                       //
16
< //      INTR[7] - Vector/Reset to 0038H                                       //
17
< //  Note: Unused intr lines can just be assigned/wired to 0.                  //
18
< //  Note: inta is still provided as a common ack to any intr.                 //
19
< //  Note: Program execution origin at 0H should now jump to >= 0040H to begin //
20
< //        main code to skip over the interrupt vector locations.              //
21
< //                                                                            //
22
87,88d69
23
< `timescale 1ns / 1ps
24
<
25
127a109,113
26
> `define cpus_call     6'h23 // CALL completion
27
> `define cpus_ret      6'h24 // RET completion
28
> `define cpus_movtalua 6'h25 // move to alu a
29
> `define cpus_movtalub 6'h26 // move to alu b
30
> `define cpus_indm     6'h27 // inc/dec m
31
165,191c151,167
32
< `define mac_readbmtr   14 // read byte and move to register
33
< `define mac_sta        16 // STA
34
< `define mac_lda        20 // LDA
35
< `define mac_shld       25 // SHLD
36
< `define mac_lhld       30 // LHLD
37
< `define mac_writedbyte 36 // write double byte
38
< `define mac_pop        38 // POP
39
< `define mac_xthl       40 // XTHL
40
< `define mac_accimm     44 // accumulator immediate
41
< `define mac_jmp        45 // JMP
42
< `define mac_call       47 // CALL
43
< `define mac_in         51 // IN
44
< `define mac_out        52 // OUT
45
< `define mac_rst        53 // RST
46
<
47
< //
48
< // Reset/Int Opcodes  (CNS)
49
< //
50
< `define opcode_reset_0 8'b11000111 // reset int vector to 0000H
51
< `define opcode_reset_1 8'b11001111 // reset int vector to 0008H
52
< `define opcode_reset_2 8'b11010111 // reset int vector to 0010H
53
< `define opcode_reset_3 8'b11011111 // reset int vector to 0018H
54
< `define opcode_reset_4 8'b11100111 // reset int vector to 0020H
55
< `define opcode_reset_5 8'b11101111 // reset int vector to 0028H
56
< `define opcode_reset_6 8'b11110111 // reset int vector to 0030H
57
< `define opcode_reset_7 8'b11111111 // reset int vector to 0038H
58
<
59
---
60
> `define mac_readbmtr   15 // read byte and move to register
61
> `define mac_sta        17 // STA
62
> `define mac_lda        21 // LDA
63
> `define mac_shld       26 // SHLD
64
> `define mac_lhld       31 // LHLD
65
> `define mac_writedbyte 37 // write double byte
66
> `define mac_pop        39 // POP
67
> `define mac_xthl       41 // XTHL
68
> `define mac_accimm     45 // accumulator immediate
69
> `define mac_jmp        46 // JMP
70
> `define mac_call       48 // CALL
71
> `define mac_in         52 // IN
72
> `define mac_out        53 // OUT
73
> `define mac_rst        54 // RST
74
> `define mac_ret        56 // RET
75
> `define mac_alum       58 // op a,m
76
> `define mac_indm       60 // inc/dec m
77
193,195c169,170
78
< module M8080  (addr,     // Address out
79
<                dout,     // Data Output bus
80
<                din,      // Data Input  bus
81
---
82
> module cpu8080(addr,     // Address out
83
>                data,     // Data bus
84
200,201c175,177
85
<                intr,     // Interrupt request bus, hard wire vector select [7:1] CNS
86
<                inta,     // Interrupt acknowledge, common to any intr
87
---
88
>                intr,     // Interrupt request
89
>                inta,     // Interrupt request
90
>                waitr,    // Wait request
91
203,205c179
92
< //               waitr,    // Wait request  CNS
93
<                clock         // Clock
94
<                );   // System clock
95
---
96
>                clock);   // System clock
97
208,209c182
98
<    input  [7:0] din;
99
<    output [7:0] dout;
100
---
101
>    inout  [7:0] data;
102
214c187
103
<    input  [7:1] intr; // CNS
104
---
105
>    input  intr;
106
216c189
107
< //   input  waitr;   CNS
108
---
109
>    input  waitr;
110
218,220c191
111
<    input  clock; // synthesis clock
112
<
113
<    wire   waitr = 1'b0;                // no extra wait states, lock low, CNS
114
---
115
>    input  clock;
116
238c209
117
< //   reg           dataeno;     // Enable output data CNS
118
---
119
>    reg           dataeno;     // Enable output data
120
276,277d246
121
<    wire                  aluzout; // CNS
122
<    wire                         alusout; // CNS
123
281c250,251
124
<    alu alu(alures, aluopra, aluoprb, alucin, alucout, aluzout, alusout, alupar, aluaxc, alusel);
125
---
126
>    alu alu(alures, aluopra, aluoprb, alucin, alucout, aluzout, alusout, alupar,
127
>            aluaxc, alusel);
128
288c258
129
< //      dataeno <= 0; // get off the data bus CNS
130
---
131
>       dataeno <= 0; // get off the data bus
132
302,304c272,273
133
<          // if any interrupt request is on, enter interrupt cycle, else exit it now
134
<          if (ei&&(intr[1]||intr[2]||intr[3]||intr[4]||intr[5]||intr[6]||intr[7])) begin        // CNS
135
< //         if (intr&&ei) begin
136
---
137
>          // if interrupt request is on, enter interrupt cycle, else exit it now
138
>          if (intr&&ei) begin
139
334,346c303
140
<                         // CNS: If we have an intr, then force the opcode to rst#
141
<                         // else read the op code from the data input as usual.
142
<                         if (intcyc) begin               // for an int cycle
143
<                                 if (intr[1]) opcode <= `opcode_reset_1; // int vector to 0008H
144
<                                 if (intr[2]) opcode <= `opcode_reset_2; // int vector to 0010H
145
<                                 if (intr[3]) opcode <= `opcode_reset_3; // int vector to 0018H
146
<                                 if (intr[4]) opcode <= `opcode_reset_4; // int vector to 0020H
147
<                                 if (intr[5]) opcode <= `opcode_reset_5; // int vector to 0028H
148
<                                 if (intr[6]) opcode <= `opcode_reset_6; // int vector to 0030H
149
<                                 if (intr[7]) opcode <= `opcode_reset_7; // int vector to 0038H
150
<                 intcyc <= 0;                 // we will kill the intcyc here, don't need it further
151
<                         end else opcode <= din; // latch/read opcode CNS
152
<
153
---
154
>             opcode <= data; // latch opcode
155
348c305
156
<             inta <= 0;                                 // Deactivate interrupt acknowledge
157
---
158
>             inta <= 0; // and interrupt acknowledge
159
371c328
160
<                      pc <= pc+1'b1; // Next instruction byte  CNS
161
---
162
>                      pc <= pc+1'b1; // Next instruction byte
163
379c336
164
<                      pc <= pc+1'b1; // Next instruction byte CNS
165
---
166
>                      pc <= pc+1'b1; // Next instruction byte
167
387c344
168
<                      pc <= pc+1'b1; // Next instruction byte CNS
169
---
170
>                      pc <= pc+1'b1; // Next instruction byte
171
395c352
172
<                      pc <= pc+1'b1; // Next instruction byte CNS
173
---
174
>                      pc <= pc+1'b1; // Next instruction byte
175
404,409c361,362
176
<                      if (regfil[`reg_a][3:0] > 9 || auxcar) begin
177
<
178
<                         { carry, regfil[`reg_a] } <= regfil[`reg_a]+ 3'b110;  // CNS 6
179
<                         auxcar <= ((regfil[`reg_a][3:0]+6 >> 4) & 1'b1) ? 1'b1:1'b0; // cns
180
<
181
<                      end
182
---
183
>                      if (regfil[`reg_a][3:0] > 9 || auxcar)
184
>                         { auxcar, regfil[`reg_a] } <= regfil[`reg_a]+4'b0110;
185
425c378,384
186
<                      state <= `cpus_indcb; // go inr/dcr cycleback
187
---
188
>                      if (opcode[5:3] == `reg_m) begin
189
>
190
>                         raddrhold <= regfil[`reg_h]<<8|regfil[`reg_l];
191
>                         statesel <= `mac_indm; // inc/dec m
192
>                         state <= `cpus_read; // read byte
193
>
194
>                      end else state <= `cpus_indcb; // go inr/dcr cycleback
195
434c393
196
<                         waddrhold <= regfil[`reg_d]<<8|regfil[`reg_d];
197
---
198
>                         waddrhold <= regfil[`reg_d]<<8|regfil[`reg_e];
199
447c406
200
<                         raddrhold <= regfil[`reg_d]<<8|regfil[`reg_d];
201
---
202
>                         raddrhold <= regfil[`reg_d]<<8|regfil[`reg_e];
203
588c547
204
<                         (((regfil[`reg_b] << 8)+regfil[`reg_c]) - 8'b1)>>8;
205
---
206
>                         (((regfil[`reg_b] << 8)+regfil[`reg_c])-1)>>8;
207
590c549
208
<                         ((regfil[`reg_b] << 8)+regfil[`reg_c])- 8'b1;
209
---
210
>                         ((regfil[`reg_b] << 8)+regfil[`reg_c])-1;
211
600c559
212
<                         (((regfil[`reg_d] << 8)+regfil[`reg_e]) - 8'b1)>>8;
213
---
214
>                         (((regfil[`reg_d] << 8)+regfil[`reg_e])-1)>>8;
215
602c561
216
<                         ((regfil[`reg_d] << 8)+regfil[`reg_e])- 8'd11;        // cns 11
217
---
218
>                         ((regfil[`reg_d] << 8)+regfil[`reg_e])-1;
219
612c571
220
<                         (((regfil[`reg_h] << 8)+regfil[`reg_l])- 8'b1)>>8;
221
---
222
>                         (((regfil[`reg_h] << 8)+regfil[`reg_l])-1)>>8;
223
614c573
224
<                         ((regfil[`reg_h] << 8)+regfil[`reg_l]) - 8'b1;
225
---
226
>                         ((regfil[`reg_h] << 8)+regfil[`reg_l])-1;
227
623c582
228
<                      sp <= sp - 16'b1;
229
---
230
>                      sp <= sp-1;
231
631c590
232
<                      raddrhold <= pc+1'b1; // pick up after instruction
233
---
234
>                      raddrhold <= pc+1; // pick up after instruction
235
640c599
236
<                      raddrhold <= pc+1'b1; // pick up after instruction
237
---
238
>                      raddrhold <= pc+1; // pick up after instruction
239
649c608
240
<                      raddrhold <= pc+1'b1; // pick up after instruction
241
---
242
>                      raddrhold <= pc+1; // pick up after instruction
243
658,659c617
244
<                      raddrhold <= pc+1'b1; // pick up after instruction
245
<                      pc <= pc + 16'h3; // skip
246
---
247
>                      raddrhold <= pc+1; // pick up after instruction
248
671c629
249
<                      raddrhold <= pc+1'b1; // set pickup address
250
---
251
>                      raddrhold <= pc+1; // set pickup address
252
689c647
253
<                      raddrhold <= pc+1'b1; // set read address
254
---
255
>                      raddrhold <= pc+1; // set read address
256
698c656
257
<                      raddrhold <= pc+1'b1; // set read address
258
---
259
>                      raddrhold <= pc+1; // set read address
260
710c668
261
<                      raddrhold <= pc+1'b1; // set read address
262
---
263
>                      raddrhold <= pc+1; // set read address
264
713c671
265
<                      pc <= pc + 16'h3; // next
266
---
267
>                      pc <= pc + 16'h3; // skip
268
719c677
269
<                      raddrhold <= pc+1'b1; // set read address
270
---
271
>                      raddrhold <= pc+1; // set read address
272
722c680
273
<                      pc <= pc + 16'h3; // next
274
---
275
>                      pc <= pc + 16'h3; // skip
276
760c718
277
<                   end else if (regd == `reg_m) begin
278
---
279
>                   end else if (opcode[5:3] == `reg_m) begin
280
792,794c750,751
281
<                   regd <= `reg_a; // set destination always a
282
<                   statesel <= `mac_readbtoreg; // read byte to register
283
<                   state <= `cpus_read;
284
---
285
>                   statesel <= `mac_alum; // alu from m
286
>                   state <= `cpus_read; // read byte
287
808,809c765,766
288
<                      waddrhold <= sp - 16'h2; // write to stack
289
<                      sp <= sp - 16'h2; // pushdown stack
290
---
291
>                      waddrhold <= sp-2; // write to stack
292
>                      sp <= sp-2; // pushdown stack
293
833c790
294
<                      sp <= sp + 16'h2; // pushup stack
295
---
296
>                      sp <= sp+2; // pushup stack
297
878c835
298
<                      raddrhold <= pc + 1'b1; // read at PC
299
---
300
>                      raddrhold <= pc+1; // read at PC
301
894c851
302
<                      raddrhold <= pc+1'b1; // pick up jump address
303
---
304
>                      raddrhold <= pc+1; // pick up jump address
305
938d894
306
<                      sp <= sp - 16'h2; // pushdown stack
307
949,950c905,906
308
<                      { wdatahold2, wdatahold } <= pc + 16'h3; // of address after call
309
<                      sp <= sp - 16'h2; // pushdown stack
310
---
311
>                      // of address after call
312
>                      { wdatahold2, wdatahold } <= pc + 16'h3;
313
980,981c936
314
<                      sp <= sp + 16'h2; // pushup stack
315
<                      statesel <= `mac_jmp; // finish JMP
316
---
317
>                      statesel <= `mac_ret; // finish RET
318
990,991c945
319
<                      sp <= sp + 16'h2; // pushup stack
320
<                      statesel <= `mac_jmp; // finish JMP
321
---
322
>                      statesel <= `mac_ret; // finish JMP
323
1025,1026c979,980
324
<                      else { wdatahold2, wdatahold } <= pc + 16'h3; // cns
325
<                      { wdatahold2, wdatahold } <= pc + 1'b1; // of address after call CNS
326
---
327
>                      else { wdatahold2, wdatahold } <= pc + 16'h3;
328
>                      { wdatahold2, wdatahold } <= pc + 1'b1; // of address after call
329
1051,1052c1005,1006
330
<                      raddrhold <= pc+1'b1; // pick up byte I/O address
331
<                      pc <= pc + 2'b10; // next
332
---
333
>                      raddrhold <= pc+1; // pick up byte I/O address
334
>                      pc <= pc+2; // next
335
1055c1009
336
<                      pc <= pc + 2'b10; // Next instruction byte
337
---
338
>                      pc <= pc + 16'h2; // advance over byte
339
1061,1062c1015,1016
340
<                      raddrhold <= pc+1'b1; // pick up byte I/O address
341
<                      pc <= pc + 2'b10; // next
342
---
343
>                      raddrhold <= pc+1; // pick up byte I/O address
344
>                      pc <= pc+2; // next
345
1065c1019
346
<                      pc <= pc + 2'b10; // Next instruction byte
347
---
348
>                      pc <= pc + 16'h2; // advance over byte
349
1075c1029
350
<                      pc <= pc + 2'b10; // Next instruction byte, cns 2
351
---
352
>                      pc <= pc+1'b1; // Next instruction byte
353
1097c1051
354
<          waddrhold <= waddrhold + 1'b1; // next address
355
---
356
>          waddrhold <= waddrhold+1; // next address
357
1100c1054
358
< //         dataeno <= 1; // enable output data CNS
359
---
360
>          dataeno <= 1; // enable output data
361
1125c1079
362
< //         dataeno <= 0; // disable output data CNS
363
---
364
>          dataeno <= 0; // disable output data
365
1127c1081
366
<          statesel <= statesel+1'b1; // and index next in macro
367
---
368
>          statesel <= statesel+1; // and index next in macro
369
1138c1092
370
<          raddrhold <= raddrhold + 1'b1; // next address
371
---
372
>          raddrhold <= raddrhold+1; // next address
373
1157c1111
374
<             rdatahold <= din; // read new data CNS
375
---
376
>             rdatahold <= data; // read new data
377
1161c1115
378
<             statesel <= statesel+1'b1; // and index next in macro
379
---
380
>             statesel <= statesel+1; // and index next in macro
381
1180,1184c1134,1138
382
<                sign   <= ((rdatahold2 >> 7)& 1'b1) ? 1'b1:1'b0;
383
<                zero   <= ((rdatahold2 >> 6)& 1'b1) ? 1'b1:1'b0;
384
<                auxcar <= ((rdatahold2 >> 4)& 1'b1) ? 1'b1:1'b0;
385
<                parity <= ((rdatahold2 >> 2)& 1'b1) ? 1'b1:1'b0;
386
<                carry  <= ((rdatahold2 >> 1)& 1'b1) ? 1'b1:1'b0;
387
---
388
>                sign <= rdatahold2 >> 7&1;
389
>                zero <= rdatahold2 >> 6&1;
390
>                auxcar <= rdatahold2 >> 4&1;
391
>                parity <= rdatahold2 >> 2&1;
392
>                carry <= rdatahold2 >> 0&1;
393
1199a1154,1169
394
>       `cpus_call: begin // call address
395
>
396
>          sp <= sp-2; // pushdown stack
397
>          state <= `cpus_fetchi; // and return to instruction fetch
398
>          pc <= { rdatahold, rdatahold2 };
399
>
400
>       end
401
>
402
>       `cpus_ret: begin // return from call
403
>
404
>          sp <= sp+2; // pushup stack
405
>          state <= `cpus_fetchi; // and return to instruction fetch
406
>          pc <= { rdatahold, rdatahold2 };
407
>
408
>       end
409
>
410
1219c1189
411
<             regfil[`reg_a] <= din; // place input data CNS
412
---
413
>             regfil[`reg_a] <= data; // place input data
414
1231c1201
415
< //         dataeno <= 1; // enable output data CNS
416
---
417
>          dataeno <= 1; // enable output data
418
1256c1226
419
< //         dataeno <= 0; // disable output data CNS
420
---
421
>          dataeno <= 0; // disable output data
422
1265,1266c1235
423
<          if (ei&&(intr[1]||intr[2]||intr[3]||intr[4]||intr[5]||intr[6]||intr[7])) state <= `cpus_fetchi; // Fetch next instruction     // CNS
424
< //         if (intr&&ei) state <= `cpus_fetchi; // Fetch next instruction
425
---
426
>          if (intr&&ei) state <= `cpus_fetchi; // Fetch next instruction
427
1269d1237
428
<
429
1276c1244,1260
430
<          statesel <= statesel+1'b1; // and index next in macro
431
---
432
>          statesel <= statesel+1; // and index next in macro
433
>
434
>       end
435
>
436
>       `cpus_movtalua: begin // move to alu a
437
>
438
>          aluopra <= rdatahold; // place data
439
>          state <= nextstate; // get next macro state
440
>          statesel <= statesel+1; // and index next in macro
441
>
442
>       end
443
>
444
>       `cpus_movtalub: begin // move to alu b
445
>
446
>          aluoprb <= rdatahold; // place data
447
>          state <= nextstate; // get next macro state
448
>          statesel <= statesel+1; // and index next in macro
449
1302a1287,1299
450
>       `cpus_indm: begin // inr/dcr cycleback to m
451
>
452
>          waddrhold <= regfil[`reg_h]<<8|regfil[`reg_l]; // place address
453
>          wdatahold <= alures; // place data to write
454
>          sign <= alures[7]; // place sign
455
>          zero <= aluzout; // place zero
456
>          parity <= alupar; // place parity
457
>          auxcar <= aluaxc; // place auxiliary carry
458
>          state <= nextstate; // get next macro state
459
>          statesel <= statesel+1; // and index next in macro
460
>
461
>       end
462
>
463
1338c1335
464
<          statesel <= statesel+1'b1; // and index next in macro cns
465
---
466
>          statesel <= statesel+1; // and index next in macro
467
1346c1343
468
<          statesel <= statesel+1'b1; // and index next in macro cns
469
---
470
>          statesel <= statesel+1; // and index next in macro
471
1354c1351
472
<          statesel <= statesel+1'b1; // and index next in macro cns
473
---
474
>          statesel <= statesel+1; // and index next in macro
475
1363c1360
476
<          statesel <= statesel+1'b1; // and index next in macro CNS
477
---
478
>          statesel <= statesel+1; // and index next in macro
479
1376,1377c1373
480
<          if (regfil[`reg_a][7:4] > 9 || carry) begin
481
<
482
---
483
>          if (regfil[`reg_a][7:4] > 9 || carry)
484
1379,1380d1374
485
<
486
<          end
487
1390c1384
488
<    assign dout = datao; // CNS
489
---
490
>    assign data = dataeno ? datao: 8'bz;
491
1433c1427,1428
492
<       13: nextstate = `cpus_fetchi; // Fetch next instruction
493
---
494
>       13: nextstate = `cpus_write; // write to destination
495
>       14: nextstate = `cpus_fetchi; // Fetch next instruction
496
1437,1438c1432,1433
497
<       14: nextstate = `cpus_movtr; // place in register
498
<       15: nextstate = `cpus_fetchi; // Fetch next instruction
499
---
500
>       15: nextstate = `cpus_movtr; // place in register
501
>       16: nextstate = `cpus_fetchi; // Fetch next instruction
502
1442,1445c1437,1440
503
<       16: nextstate = `cpus_read; // read high byte
504
<       17: nextstate = `cpus_movrtwa; // move read to write address
505
<       18: nextstate = `cpus_write; // write to destination
506
<       19: nextstate = `cpus_fetchi; // Fetch next instruction
507
---
508
>       17: nextstate = `cpus_read; // read high byte
509
>       18: nextstate = `cpus_movrtwa; // move read to write address
510
>       19: nextstate = `cpus_write; // write to destination
511
>       20: nextstate = `cpus_fetchi; // Fetch next instruction
512
1449,1453c1444,1448
513
<       20: nextstate = `cpus_read; // read high byte
514
<       21: nextstate = `cpus_movrtra; // move read to write address
515
<       22: nextstate = `cpus_read; // read byte
516
<       23: nextstate = `cpus_movtr; // move to register
517
<       24: nextstate = `cpus_fetchi; // Fetch next instruction
518
---
519
>       21: nextstate = `cpus_read; // read high byte
520
>       22: nextstate = `cpus_movrtra; // move read to write address
521
>       23: nextstate = `cpus_read; // read byte
522
>       24: nextstate = `cpus_movtr; // move to register
523
>       25: nextstate = `cpus_fetchi; // Fetch next instruction
524
1457,1461c1452,1456
525
<       25: nextstate = `cpus_read; // read high byte
526
<       26: nextstate = `cpus_movrtwa; // move read to write address
527
<       27: nextstate = `cpus_write; // write to destination low
528
<       28: nextstate = `cpus_write; // write to destination high
529
<       29: nextstate = `cpus_fetchi; // Fetch next instruction
530
---
531
>       26: nextstate = `cpus_read; // read high byte
532
>       27: nextstate = `cpus_movrtwa; // move read to write address
533
>       28: nextstate = `cpus_write; // write to destination low
534
>       29: nextstate = `cpus_write; // write to destination high
535
>       30: nextstate = `cpus_fetchi; // Fetch next instruction
536
1465,1470c1460,1465
537
<       30: nextstate = `cpus_read; // read high byte
538
<       31: nextstate = `cpus_movrtra; // move read to write address
539
<       32: nextstate = `cpus_read; // read byte low
540
<       33: nextstate = `cpus_read; // read byte high
541
<       34: nextstate = `cpus_lhld; // move to register
542
<       35: nextstate = `cpus_fetchi; // Fetch next instruction
543
---
544
>       31: nextstate = `cpus_read; // read high byte
545
>       32: nextstate = `cpus_movrtra; // move read to write address
546
>       33: nextstate = `cpus_read; // read byte low
547
>       34: nextstate = `cpus_read; // read byte high
548
>       35: nextstate = `cpus_lhld; // move to register
549
>       36: nextstate = `cpus_fetchi; // Fetch next instruction
550
1474,1475c1469,1470
551
<       36: nextstate = `cpus_write; // double write
552
<       37: nextstate = `cpus_fetchi; // then fetch
553
---
554
>       37: nextstate = `cpus_write; // double write
555
>       38: nextstate = `cpus_fetchi; // then fetch
556
1479,1480c1474,1475
557
<       38: nextstate = `cpus_read; // double it
558
<       39: nextstate = `cpus_pop; // then finish
559
---
560
>       39: nextstate = `cpus_read; // double it
561
>       40: nextstate = `cpus_pop; // then finish
562
1484,1487c1479,1482
563
<       40: nextstate = `cpus_read; // double it
564
<       41: nextstate = `cpus_write; // then write
565
<       42: nextstate = `cpus_write; // double it
566
<       43: nextstate = `cpus_movmthl; // place word in hl
567
---
568
>       41: nextstate = `cpus_read; // double it
569
>       42: nextstate = `cpus_write; // then write
570
>       43: nextstate = `cpus_write; // double it
571
>       44: nextstate = `cpus_movmthl; // place word in hl
572
1491c1486
573
<       44: nextstate = `cpus_accimm; // finish
574
---
575
>       45: nextstate = `cpus_accimm; // finish
576
1495,1496c1490,1491
577
<       45: nextstate = `cpus_read; // double read
578
<       46: nextstate = `cpus_jmp; // then go pc
579
---
580
>       46: nextstate = `cpus_read; // double read
581
>       47: nextstate = `cpus_jmp; // then go pc
582
1500,1503c1495,1498
583
<       47: nextstate = `cpus_read; // double read
584
<       48: nextstate = `cpus_write; // then write
585
<       49: nextstate = `cpus_write; // double write
586
<       50: nextstate = `cpus_jmp; // then go to that
587
---
588
>       48: nextstate = `cpus_read; // double read
589
>       49: nextstate = `cpus_write; // then write
590
>       50: nextstate = `cpus_write; // double write
591
>       51: nextstate = `cpus_call; // then go to that
592
1507c1502
593
<       51: nextstate = `cpus_in; // go to IN after getting that
594
---
595
>       52: nextstate = `cpus_in; // go to IN after getting that
596
1511c1506
597
<       52: nextstate = `cpus_out; // go to OUT after getting that
598
---
599
>       53: nextstate = `cpus_out; // go to OUT after getting that
600
1515,1516c1510,1528
601
<       53: nextstate = `cpus_write; // double write
602
<       54: nextstate = `cpus_jmp; // then go to that
603
---
604
>       54: nextstate = `cpus_write; // double write
605
>       55: nextstate = `cpus_jmp; // then go to that
606
>
607
>       // mac_ret: RET
608
>
609
>       56: nextstate = `cpus_read; // double read
610
>       57: nextstate = `cpus_ret; // then go to that
611
>
612
>       // mac_alum: op a,m
613
>
614
>       58: nextstate = `cpus_movtalub; // go move to alu a
615
>       59: nextstate = `cpus_alucb; // cycle back to acc
616
>
617
>       // mac_idm: inc/dec m
618
>
619
>       60: nextstate = `cpus_movtalua; // go move to alu b
620
>       61: nextstate = `cpus_indm; // set up alu result
621
>       62: nextstate = `cpus_write; // write it
622
>       63: nextstate = `cpus_fetchi; // Fetch next instruction
623
1560,1563c1572
624
< //            auxcar = ((opra[3:0]+oprb[3:0]) >> 4) & 1'b1; // find auxiliary carry
625
< //			if ((opra[3:0]+oprb[3:0])>>4) auxcar=1'b1; else auxcar=1'b0;
626
<             auxcar = (((opra[3:0]+oprb[3:0]) >> 4) & 1'b1) ? 1'b1 : 1'b0 ; // find auxiliary carry
627
<
628
---
629
>             auxcar = (opra[3:0]+oprb[3:0]) >> 4 & 1; // find auxiliary carry
630
1569c1578
631
<             auxcar = (((opra[3:0]+oprb[3:0]+cin) >> 4) & 1'b1) ? 1'b1 : 1'b0; // find auxiliary carry
632
---
633
>             auxcar = (opra[3:0]+oprb[3:0]+cin) >> 4 & 1; // find auxiliary carry
634
1575c1584
635
<             auxcar = (((opra[3:0]-oprb[3:0]) >> 4) & 1'b1) ? 1'b1 : 1'b0; // find auxiliary borrow
636
---
637
>             auxcar = (opra[3:0]-oprb[3:0]) >> 4 & 1; // find auxiliary borrow
638
1581c1590
639
<             auxcar = (((opra[3:0]-oprb[3:0]-cin >> 4)) & 1'b1) ? 1'b1 : 1'b0; // find auxiliary borrow
640
---
641
>             auxcar = (opra[3:0]-oprb[3:0]-cin >> 4) & 1; // find auxiliary borrow
642
1587c1596
643
<             auxcar = 1'b0; // clear auxillary carry
644
---
645
>             auxcar = 0; // clear auxillary carry
646
1593c1602
647
<             auxcar = 1'b0; // clear auxillary carry
648
---
649
>             auxcar = 0; // clear auxillary carry
650
1599c1608
651
<             auxcar = 1'b0; // clear auxillary carry
652
---
653
>             auxcar = 0; // clear auxillary carry

powered by: WebSVN 2.1.0

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