OpenCores
URL https://opencores.org/ocsvn/2d_game_console/2d_game_console/trunk

Subversion Repositories 2d_game_console

[/] [2d_game_console/] [trunk/] [Processor_ModelSim/] [TB_Processor.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lucas.vbal
// Time unit and simulation accuracy
2
`timescale 1ns/1ns
3
 
4
module TB_Processor;
5
 
6
integer processor_output_file;  // File handler
7
integer VGA_output_file;        // File handler
8
 
9
integer six_button_select_counter;
10
 
11
// Sega Genesis Buttons status
12
reg     button_up;
13
reg     button_down;
14
reg     button_left;
15
reg     button_right;
16
reg     button_a;
17
reg     button_b;
18
reg     button_c;
19
reg     button_x;
20
reg     button_y;
21
reg     button_z;
22
reg     button_mode;
23
reg     button_start;
24
 
25
 
26
// 'TB_Processor' module outputs
27
// 'Processor' module inputs
28
reg     clock;
29
reg     reset;
30
reg     testbench_vsync;
31
reg     testbench_PLL_clock;
32
reg     six_button_UP_Z;
33
reg     six_button_DOWN_Y;
34
reg     six_button_LEFT_X;
35
reg     six_button_RIGHT_MODE;
36
reg     six_button_B_A;
37
reg     six_button_C_START;
38
 
39
// 'TB_Processor' module inputs
40
// 'Processor' module outputs
41
wire    add_overflow;
42
wire    sub_overflow;
43
wire    compare_aeb;
44
wire    compare_agb;
45
wire    compare_alb;
46
wire    arbiter_grant_1;
47
wire    arbiter_grant_2;
48
wire    arbiter_grant_3;
49
wire    arbiter_wren;
50
wire    cpu_ram_wren;
51
wire    cpu_ram_req;
52
wire    cpu_const_bool;
53
wire    pic_mem_wren;
54
wire    pic_mem_req;
55
wire    pic_cpu_req;
56
wire    cpu_int_ack;
57
wire    pic_int_ack_0;
58
wire    cpu_v_sync_flag;
59
wire    VGA_CLK;
60
wire    VGA_HS;
61
wire    VGA_VS;
62
wire    VGA_BLANK;
63
wire    six_button_mem_wren;
64
wire    six_button_mem_req;
65
wire    six_button_v_sync_flag;
66
wire    six_button_int_req;
67
wire    arbiter_grant_0;
68
wire    sprite_reader_mem_wren;
69
wire    sprite_reader_mem_req;
70
wire    sprite_reader_line_flag;
71
wire    sprite_reader_cpu_sleep;
72
wire    six_button_SELECT;
73
wire    VGA_SYNC;
74
wire    [15:0] add_result;
75
wire    [15:0] arbiter_addr;
76
wire    [3:0] arbiter_current_state;
77
wire    [15:0] arbiter_data;
78
wire    [3:0] arbiter_next_state;
79
wire    [5:0] cpu_current_state;
80
wire    [15:0] cpu_imm;
81
wire    [15:0] cpu_int_program_counter;
82
wire    [7:0] cpu_int_rflags;
83
wire    [5:0] cpu_next_state;
84
wire    [5:0] cpu_opcode;
85
wire    [127:0] cpu_pc_stack;
86
wire    [15:0] cpu_pc_stack_val;
87
wire    [15:0] cpu_program_counter;
88
wire    [15:0] cpu_ram_addr;
89
wire    [15:0] cpu_ram_data;
90
wire    [4:0] cpu_reg_a_num;
91
wire    [15:0] cpu_reg_a_val;
92
wire    [4:0] cpu_reg_b_num;
93
wire    [15:0] cpu_reg_b_val;
94
wire    [4:0] cpu_reg_c_num;
95
wire    [15:0] cpu_reg_c_val;
96
wire    [511:0] cpu_registers;
97
wire    [7:0] cpu_rflags;
98
wire    [2:0] cpu_rflags_index;
99
wire    [15:0] cpu_rom_addr;
100
wire    [1023:0] cpu_sprite_color;
101
wire    [383:0] cpu_sprite_id;
102
wire    [5:0] cpu_sprite_level;
103
wire    [639:0] cpu_sprite_x;
104
wire    [639:0] cpu_sprite_y;
105
wire    [2:0] cpu_stack_pointer;
106
wire    [15:0] divide_quotient;
107
wire    [15:0] divide_remain;
108
wire    [31:0] mult_result;
109
wire    [3:0] pic_current_state;
110
wire    [15:0] pic_int_mask;
111
wire    [15:0] pic_isr_addr;
112
wire    [15:0] pic_mem_addr;
113
wire    [3:0] pic_next_state;
114
wire    [15:0] ram_q;
115
wire    [31:0] rom_q;
116
wire    [15:0] six_button_buttons;
117
wire    [9:0] six_button_counter;
118
wire    [3:0] six_button_current_state;
119
wire    [15:0] six_button_mem_addr;
120
wire    [15:0] six_button_mem_data;
121
wire    [3:0] six_button_next_state;
122
wire    [4:0] sprite_reader_EstadoAtual;
123
wire    [4:0] sprite_reader_EstadoFuturo;
124
wire    [6:0] sprite_reader_level_counter;
125
wire    [5:0] sprite_reader_level_sprite_id;
126
wire    [9:0] sprite_reader_level_sprite_y;
127
wire    [15:0] sprite_reader_mem_addr;
128
wire    [15:0] sub_result;
129
wire    [7:0] VGA_B;
130
wire    [7:0] VGA_G;
131
wire    [9:0] VGA_h_pos;
132
wire    [19:0] VGA_oAddress;
133
wire    [7:0] VGA_R;
134
wire    [9:0] VGA_v_pos;
135
 
136
 
137
// 'Processor' module instantiation
138
Processor DUV(
139
.clock                  (clock),
140
.reset                  (reset),
141
.testbench_vsync        (testbench_vsync),
142
.testbench_PLL_clock    (testbench_PLL_clock),
143
.six_button_UP_Z        (six_button_UP_Z),
144
.six_button_DOWN_Y      (six_button_DOWN_Y),
145
.six_button_LEFT_X      (six_button_LEFT_X),
146
.six_button_RIGHT_MODE  (six_button_RIGHT_MODE),
147
.six_button_B_A         (six_button_B_A),
148
.six_button_C_START     (six_button_C_START),
149
 
150
 
151
.add_overflow                   (add_overflow),
152
.sub_overflow                   (sub_overflow),
153
.compare_aeb                    (compare_aeb),
154
.compare_agb                    (compare_agb),
155
.compare_alb                    (compare_alb),
156
.arbiter_grant_1                (arbiter_grant_1),
157
.arbiter_grant_2                (arbiter_grant_2),
158
.arbiter_grant_3                (arbiter_grant_3),
159
.arbiter_wren                   (arbiter_wren),
160
.cpu_ram_wren                   (cpu_ram_wren),
161
.cpu_ram_req                    (cpu_ram_req),
162
.cpu_const_bool                 (cpu_const_bool),
163
.pic_mem_wren                   (pic_mem_wren),
164
.pic_mem_req                    (pic_mem_req),
165
.pic_cpu_req                    (pic_cpu_req),
166
.cpu_int_ack                    (cpu_int_ack),
167
.pic_int_ack_0                  (pic_int_ack_0),
168
.cpu_v_sync_flag                (cpu_v_sync_flag),
169
.VGA_CLK                        (VGA_CLK),
170
.VGA_HS                         (VGA_HS),
171
.VGA_VS                         (VGA_VS),
172
.VGA_BLANK                      (VGA_BLANK),
173
.six_button_mem_wren            (six_button_mem_wren),
174
.six_button_mem_req             (six_button_mem_req),
175
.six_button_v_sync_flag         (six_button_v_sync_flag),
176
.six_button_int_req             (six_button_int_req),
177
.arbiter_grant_0                (arbiter_grant_0),
178
.sprite_reader_mem_wren         (sprite_reader_mem_wren),
179
.sprite_reader_mem_req          (sprite_reader_mem_req),
180
.sprite_reader_line_flag        (sprite_reader_line_flag),
181
.sprite_reader_cpu_sleep        (sprite_reader_cpu_sleep),
182
.six_button_SELECT              (six_button_SELECT),
183
.VGA_SYNC                       (VGA_SYNC),
184
.add_result                     (add_result),
185
.arbiter_addr                   (arbiter_addr),
186
.arbiter_current_state          (arbiter_current_state),
187
.arbiter_data                   (arbiter_data),
188
.arbiter_next_state             (arbiter_next_state),
189
.cpu_current_state              (cpu_current_state),
190
.cpu_imm                        (cpu_imm),
191
.cpu_int_program_counter        (cpu_int_program_counter),
192
.cpu_int_rflags                 (cpu_int_rflags),
193
.cpu_next_state                 (cpu_next_state),
194
.cpu_opcode                     (cpu_opcode),
195
.cpu_pc_stack                   (cpu_pc_stack),
196
.cpu_pc_stack_val               (cpu_pc_stack_val),
197
.cpu_program_counter            (cpu_program_counter),
198
.cpu_ram_addr                   (cpu_ram_addr),
199
.cpu_ram_data                   (cpu_ram_data),
200
.cpu_reg_a_num                  (cpu_reg_a_num),
201
.cpu_reg_a_val                  (cpu_reg_a_val),
202
.cpu_reg_b_num                  (cpu_reg_b_num),
203
.cpu_reg_b_val                  (cpu_reg_b_val),
204
.cpu_reg_c_num                  (cpu_reg_c_num),
205
.cpu_reg_c_val                  (cpu_reg_c_val),
206
.cpu_registers                  (cpu_registers),
207
.cpu_rflags                     (cpu_rflags),
208
.cpu_rflags_index               (cpu_rflags_index),
209
.cpu_rom_addr                   (cpu_rom_addr),
210
.cpu_sprite_color               (cpu_sprite_color),
211
.cpu_sprite_id                  (cpu_sprite_id),
212
.cpu_sprite_level               (cpu_sprite_level),
213
.cpu_sprite_x                   (cpu_sprite_x),
214
.cpu_sprite_y                   (cpu_sprite_y),
215
.cpu_stack_pointer              (cpu_stack_pointer),
216
.divide_quotient                (divide_quotient),
217
.divide_remain                  (divide_remain),
218
.mult_result                    (mult_result),
219
.pic_current_state              (pic_current_state),
220
.pic_int_mask                   (pic_int_mask),
221
.pic_isr_addr                   (pic_isr_addr),
222
.pic_mem_addr                   (pic_mem_addr),
223
.pic_next_state                 (pic_next_state),
224
.ram_q                          (ram_q),
225
.rom_q                          (rom_q),
226
.six_button_buttons             (six_button_buttons),
227
.six_button_counter             (six_button_counter),
228
.six_button_current_state       (six_button_current_state),
229
.six_button_mem_addr            (six_button_mem_addr),
230
.six_button_mem_data            (six_button_mem_data),
231
.six_button_next_state          (six_button_next_state),
232
.sprite_reader_EstadoAtual      (sprite_reader_EstadoAtual),
233
.sprite_reader_EstadoFuturo     (sprite_reader_EstadoFuturo),
234
.sprite_reader_level_counter    (sprite_reader_level_counter),
235
.sprite_reader_level_sprite_id  (sprite_reader_level_sprite_id),
236
.sprite_reader_level_sprite_y   (sprite_reader_level_sprite_y),
237
.sprite_reader_mem_addr         (sprite_reader_mem_addr),
238
.sub_result                     (sub_result),
239
.VGA_B                          (VGA_B),
240
.VGA_G                          (VGA_G),
241
.VGA_h_pos                      (VGA_h_pos),
242
.VGA_oAddress                   (VGA_oAddress),
243
.VGA_R                          (VGA_R),
244
.VGA_v_pos                      (VGA_v_pos)
245
 
246
);
247
 
248
// Data Transfer Instructions
249
parameter opcode_lw                             = 6'b001001;
250
parameter opcode_sw                             = 6'b001010;
251
parameter opcode_limm                           = 6'b001100;
252
// Arithmetic Instructions
253
parameter opcode_add                            = 6'b010001;
254
parameter opcode_sub                            = 6'b010010;
255
parameter opcode_mul                            = 6'b010100;
256
parameter opcode_div                            = 6'b010101;
257
// Logical Instructions
258
parameter opcode_and                            = 6'b100001;
259
parameter opcode_or                             = 6'b100010;
260
parameter opcode_cmp                            = 6'b100100;
261
parameter opcode_not                            = 6'b100101;
262
// Control Transfer Instructions (Immediate)
263
parameter opcode_jmp                            = 6'b101001;
264
parameter opcode_brfl                           = 6'b101010;
265
parameter opcode_call                           = 6'b101011;
266
parameter opcode_ret                            = 6'b101100;
267
parameter opcode_iret                           = 6'b101101;
268
parameter opcode_nop                            = 6'b101110;
269
// Control Transfer Instructions (Register)
270
parameter opcode_jr                             = 6'b011001;
271
parameter opcode_brflr                          = 6'b011010;
272
parameter opcode_callr                          = 6'b011011;
273
// Graphical instructions
274
parameter opcode_sprite_id                      = 6'b110001;
275
parameter opcode_sprite_color                   = 6'b110010;
276
parameter opcode_sprite_pos                     = 6'b110100;
277
parameter opcode_wait_vsync                     = 6'b110111;
278
 
279
 
280
parameter breakpoint_pc_1 = 5947;       // SUCCESS
281
parameter breakpoint_pc_2 = 5948;       // ERROR
282
 
283
parameter breakpoint_pc_3 = 5949;       // INTERRUPT
284
parameter breakpoint_pc_4 = 6110;       // INTERRUPT RETURN
285
 
286
// Initial assignments
287
initial
288
begin
289
        six_button_select_counter = -1;
290
 
291
        testbench_PLL_clock = 0;
292
        clock = 0;
293
        reset = 0;
294
        #40 reset = 1;  // Reset on at 40ns
295
        #40 reset = 0;   // Reset off at 80ns
296
 
297
        // Open file to save VGA output data
298
        VGA_output_file = $fopen("VGA_Output_Data.out","w");
299
        if (VGA_output_file == 0)
300
        begin
301
                $display("VGA_output_file handle was NULL");
302
                $finish;
303
        end
304
 
305
        // Open file to save instructions output data
306
        processor_output_file = $fopen("Processor_Output_Data.out","w");
307
        if (processor_output_file == 0)
308
        begin
309
                $display("processor_output_file handle was NULL");
310
                $finish;
311
        end
312
end
313
 
314
 
315
// 20ns clock cycle (50 Mhz)
316
always #10 clock = !clock;
317
 
318
// 40ns clock cycle (25 Mhz) for VGA_Interface module
319
always #20 testbench_PLL_clock = !testbench_PLL_clock;
320
 
321
 
322
always @ (posedge sprite_reader_cpu_sleep)
323
begin
324
        $fwrite(processor_output_file, "=====================================\n");
325
        $fwrite(processor_output_file, "========== CPU SLEEP ON!! ==========\n");
326
        $fwrite(processor_output_file, "=====================================\n");
327
        $display("\n\nCPU SLEEP ON!!");
328
end
329
 
330
always @ (negedge sprite_reader_cpu_sleep)
331
begin
332
        $fwrite(processor_output_file, "=====================================\n");
333
        $fwrite(processor_output_file, "========== CPU SLEEP OFF!! ==========\n");
334
        $fwrite(processor_output_file, "=====================================\n");
335
        $display("\n\nCPU SLEEP OFF!!");
336
end
337
 
338
always @ (negedge clock)
339
begin
340
 
341
        if(cpu_current_state == 3)
342
        begin
343
 
344
                $fwrite(processor_output_file, "%d: ", cpu_program_counter);
345
 
346
                case (cpu_opcode)
347
                        opcode_add:
348
                        begin
349
                                $fwrite(processor_output_file, "ADD\n");
350
                        end
351
 
352
                        opcode_sub:
353
                        begin
354
                                $fwrite(processor_output_file, "SUB\n");
355
                        end
356
 
357
                        opcode_mul:
358
                        begin
359
                                $fwrite(processor_output_file, "MUL\n");
360
                        end
361
 
362
                        opcode_div:
363
                        begin
364
                                $fwrite(processor_output_file, "DIV\n");
365
                        end
366
 
367
                        opcode_and:
368
                        begin
369
                                $fwrite(processor_output_file, "AND\n");
370
                        end
371
 
372
                        opcode_or:
373
                        begin
374
                                $fwrite(processor_output_file, "OR\n");
375
                        end
376
 
377
                        opcode_cmp:
378
                        begin
379
                                $fwrite(processor_output_file, "CMP\n");
380
                        end
381
 
382
                        opcode_not:
383
                        begin
384
                                $fwrite(processor_output_file, "NOT\n");
385
                        end
386
 
387
                        opcode_sprite_id:
388
                        begin
389
                                $fwrite(processor_output_file, "SPRITE_ID\n");
390
                        end
391
 
392
                        opcode_sprite_color:
393
                        begin
394
                                $fwrite(processor_output_file, "SPRITE_COLOR\n");
395
                        end
396
 
397
                        opcode_sprite_pos:
398
                        begin
399
                                $fwrite(processor_output_file, "SPRITE_POS\n");
400
                        end
401
 
402
                        opcode_limm:
403
                        begin
404
                                $fwrite(processor_output_file, "LIMM\n");
405
                        end
406
 
407
                        opcode_lw:
408
                        begin
409
                                $fwrite(processor_output_file, "LW\n");
410
                        end
411
 
412
                        opcode_sw:
413
                        begin
414
                                $fwrite(processor_output_file, "SW\n");
415
                        end
416
 
417
                        opcode_jmp:
418
                        begin
419
                                $fwrite(processor_output_file, "JMP\n");
420
                        end
421
 
422
                        opcode_jr:
423
                        begin
424
                                $fwrite(processor_output_file, "JR\n");
425
                        end
426
 
427
                        opcode_brfl:
428
                        begin
429
                                $fwrite(processor_output_file, "BRFL\n");
430
                        end
431
 
432
                        opcode_brflr:
433
                        begin
434
                                $fwrite(processor_output_file, "BRFLR\n");
435
                        end
436
 
437
                        opcode_nop:
438
                        begin
439
                                $fwrite(processor_output_file, "NOP\n");
440
                        end
441
 
442
                        opcode_call:
443
                        begin
444
                                $fwrite(processor_output_file, "CALL\n");
445
                        end
446
 
447
                        opcode_callr:
448
                        begin
449
                                $fwrite(processor_output_file, "CALLR\n");
450
                        end
451
 
452
                        opcode_ret:
453
                        begin
454
                                $fwrite(processor_output_file, "RET\n");
455
                        end
456
 
457
                        opcode_wait_vsync:
458
                        begin
459
                                $fwrite(processor_output_file, "WAIT_VSYNC\n");
460
                        end
461
 
462
                        opcode_iret:
463
                        begin
464
                                $fwrite(processor_output_file, "IRET\n");
465
                        end
466
 
467
                        default:
468
                        begin
469
                                $fwrite(processor_output_file, "ILLEGAL INSTRUCTION\n");
470
                        end
471
 
472
                endcase
473
 
474
 
475
                if(cpu_program_counter == breakpoint_pc_1)
476
                begin
477
                        $fwrite(processor_output_file, "=====================================\n");
478
                        $fwrite(processor_output_file, "============== SUCCESS ==============\n");
479
                        $fwrite(processor_output_file, "=====================================\n");
480
                        $display("\n\nSuccess!!");
481
                        //$fclose(processor_output_file);
482
                        //$stop;
483
                end
484
 
485
                if(cpu_program_counter == breakpoint_pc_2)
486
                begin
487
                        $fwrite(processor_output_file, "=====================================\n");
488
                        $fwrite(processor_output_file, "=============== ERROR ===============\n");
489
                        $fwrite(processor_output_file, "=====================================\n");
490
                        $display("\n\nError!!");
491
                        $fclose(processor_output_file);
492
                        $stop;
493
                end
494
 
495
                if(cpu_program_counter == breakpoint_pc_3)
496
                begin
497
                        $fwrite(processor_output_file, "=====================================\n");
498
                        $fwrite(processor_output_file, "============= INTERRUPT =============\n");
499
                        $fwrite(processor_output_file, "=====================================\n");
500
                        $display("\n\Interrupt!!");
501
                        //$fclose(processor_output_file);
502
                        //$stop;
503
                end
504
 
505
                if(cpu_program_counter == breakpoint_pc_4)
506
                begin
507
                        $fwrite(processor_output_file, "=====================================\n");
508
                        $fwrite(processor_output_file, "========== INTERRUPT RETURN =========\n");
509
                        $fwrite(processor_output_file, "=====================================\n");
510
                        $display("\n\Interrupt Return!!");
511
                        //$fclose(processor_output_file);
512
                        //$stop;
513
                end
514
        end
515
end
516
 
517
always @ (negedge testbench_PLL_clock)
518
begin
519
        if (VGA_v_pos == 0)
520
        begin
521
                if (VGA_h_pos < 799)
522
                begin
523
                        $fwrite(VGA_output_file, "%.5d ", VGA_h_pos);
524
                end
525
 
526
                else
527
                begin
528
                        $fwrite(VGA_output_file, "%.5d ", VGA_h_pos);
529
                        $fwrite(VGA_output_file, "\n");
530
                end
531
        end
532
 
533
        else
534
        begin
535
                if (VGA_h_pos < 799)
536
                begin
537
                        $fwrite(VGA_output_file, "%.5d ", { VGA_B[7:3],VGA_G[7:2],VGA_R[7:3] } );
538
                end
539
                else
540
                begin
541
                        $fwrite(VGA_output_file, "%.5d ", { VGA_B[7:3],VGA_G[7:2],VGA_R[7:3] } );
542
                        $fwrite(VGA_output_file, "\n");
543
                end
544
        end
545
 
546
        if ( (VGA_v_pos == 524) && (VGA_h_pos == 799) )
547
        begin
548
                $fwrite(VGA_output_file, "\n\n");
549
                $fwrite(VGA_output_file, "*************************************************");
550
                $fwrite(VGA_output_file, "\n\n");
551
        end
552
end
553
 
554
always
555
begin
556
 
557
        // Button UP and A pressed - Active low
558
        button_up       = 0;
559
        button_down     = 1;
560
        button_left     = 1;
561
        button_right    = 1;
562
        button_a        = 0;
563
        button_b        = 1;
564
        button_c        = 1;
565
        button_x        = 1;
566
        button_y        = 1;
567
        button_z        = 1;
568
        button_mode     = 1;
569
        button_start    = 1;
570
 
571
        #20000000 ;     // Wait 20 ms = 20.000.000 ns
572
 
573
        // Button UP and A pressed - Active low
574
        button_up       = 0;
575
        button_down     = 1;
576
        button_left     = 1;
577
        button_right    = 1;
578
        button_a        = 0;
579
        button_b        = 1;
580
        button_c        = 1;
581
        button_x        = 1;
582
        button_y        = 1;
583
        button_z        = 1;
584
        button_mode     = 1;
585
        button_start    = 1;
586
 
587
        #20000000 ;     // Wait 20 ms = 20.000.000 ns
588
 
589
        // Button LEFT and B pressed - Active low
590
        button_up       = 1;
591
        button_down     = 1;
592
        button_left     = 0;
593
        button_right    = 1;
594
        button_a        = 1;
595
        button_b        = 0;
596
        button_c        = 1;
597
        button_x        = 1;
598
        button_y        = 1;
599
        button_z        = 1;
600
        button_mode     = 1;
601
        button_start    = 1;
602
 
603
        #20000000 ;     // Wait 20 ms = 20.000.000 ns
604
 
605
        // Button LEFT and B pressed - Active low
606
        button_up       = 1;
607
        button_down     = 1;
608
        button_left     = 0;
609
        button_right    = 1;
610
        button_a        = 1;
611
        button_b        = 0;
612
        button_c        = 1;
613
        button_x        = 1;
614
        button_y        = 1;
615
        button_z        = 1;
616
        button_mode     = 1;
617
        button_start    = 1;
618
 
619
        #20000000 ;     // Wait 20 ms = 20.000.000 ns
620
 
621
        $display("\n\nSTOP!!");
622
        $stop;
623
end
624
 
625
always @ (six_button_SELECT)
626
begin
627
        if (six_button_select_counter < 7)
628
                six_button_select_counter = six_button_select_counter+1;
629
        else
630
                six_button_select_counter = 0;
631
 
632
        case (six_button_select_counter)
633
                0:
634
                begin
635
                        six_button_UP_Z         = button_up;
636
                        six_button_DOWN_Y       = button_down;
637
                        six_button_LEFT_X       = button_left;
638
                        six_button_RIGHT_MODE   = button_right;
639
                        six_button_B_A          = button_b;
640
                        six_button_C_START      = button_c;
641
                end
642
 
643
                1:
644
                begin
645
                        six_button_UP_Z         = button_up;
646
                        six_button_DOWN_Y       = button_down;
647
                        six_button_LEFT_X       = 0;
648
                        six_button_RIGHT_MODE   = 0;
649
                        six_button_B_A          = button_a;
650
                        six_button_C_START      = button_start;
651
                end
652
 
653
                2:
654
                begin
655
                        six_button_UP_Z         = button_up;
656
                        six_button_DOWN_Y       = button_down;
657
                        six_button_LEFT_X       = button_left;
658
                        six_button_RIGHT_MODE   = button_right;
659
                        six_button_B_A          = button_b;
660
                        six_button_C_START      = button_c;
661
                end
662
 
663
                3:
664
                begin
665
                        six_button_UP_Z         = button_up;
666
                        six_button_DOWN_Y       = button_down;
667
                        six_button_LEFT_X       = 0;
668
                        six_button_RIGHT_MODE   = 0;
669
                        six_button_B_A          = button_a;
670
                        six_button_C_START      = button_start;
671
                end
672
 
673
                4:
674
                begin
675
                        six_button_UP_Z         = button_up;
676
                        six_button_DOWN_Y       = button_down;
677
                        six_button_LEFT_X       = button_left;
678
                        six_button_RIGHT_MODE   = button_right;
679
                        six_button_B_A          = button_b;
680
                        six_button_C_START      = button_c;
681
                end
682
 
683
                5:
684
                begin
685
                        six_button_UP_Z         = 0;
686
                        six_button_DOWN_Y       = 0;
687
                        six_button_LEFT_X       = 0;
688
                        six_button_RIGHT_MODE   = 0;
689
                        six_button_B_A          = button_a;
690
                        six_button_C_START      = button_start;
691
                end
692
 
693
                6:
694
                begin
695
                        six_button_UP_Z         = button_z;
696
                        six_button_DOWN_Y       = button_y;
697
                        six_button_LEFT_X       = button_x;
698
                        six_button_RIGHT_MODE   = button_mode;
699
                        six_button_B_A          = button_b;
700
                        six_button_C_START      = button_c;
701
                end
702
 
703
                7:
704
                begin
705
                        six_button_UP_Z         = 1;
706
                        six_button_DOWN_Y       = 1;
707
                        six_button_LEFT_X       = 1;
708
                        six_button_RIGHT_MODE   = 1;
709
                        six_button_B_A          = button_a;
710
                        six_button_C_START      = button_start;
711
                end
712
 
713
                default:
714
                begin
715
                        six_button_UP_Z         = button_up;
716
                        six_button_DOWN_Y       = button_down;
717
                        six_button_LEFT_X       = button_left;
718
                        six_button_RIGHT_MODE   = button_right;
719
                        six_button_B_A          = button_b;
720
                        six_button_C_START      = button_c;
721
                end
722
 
723
        endcase
724
end
725
 
726
endmodule

powered by: WebSVN 2.1.0

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