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

Subversion Repositories aoocs

[/] [aoocs/] [trunk/] [rtl/] [terasic_de2_70/] [aoOCS.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright 2010, Aleksander Osman, alfik@poczta.fm. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without modification, are
5
 * permitted provided that the following conditions are met:
6
 *
7
 *  1. Redistributions of source code must retain the above copyright notice, this list of
8
 *     conditions and the following disclaimer.
9
 *
10
 *  2. Redistributions in binary form must reproduce the above copyright notice, this list
11
 *     of conditions and the following disclaimer in the documentation and/or other materials
12
 *     provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
15
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 */
24
 
25
/*! \file
26
 * \brief aoOCS top-level module for the Terasic DE2-70 board.
27
 */
28
 
29
/*! \brief \copybrief aoOCS.v
30
*/
31
module aoOCS(
32
        //% \name Clock and reset
33
    //% @{
34
        input           clk_50,
35
        input           reset_ext_n,
36
        //% @}
37
 
38
        //% \name IS61LPS51236A pipelined SSRAM hardware interface
39
    //% @{
40
        output [18:0]   ssram_address,
41
        output          ssram_oe_n,
42
        output          ssram_writeen_n,
43
        output [3:0]    ssram_byteen_n,
44
        inout [35:0]    ssram_data,
45
        output          ssram_clk,
46
        output          ssram_globalw_n,
47
        output          ssram_advance_n,
48
        output          ssram_adsp_n,
49
        output          ssram_adsc_n,
50
        output          ssram_ce1_n,
51
        output          ssram_ce2,
52
        output          ssram_ce3_n,
53
        //% @}
54
 
55
        //% \name SD bus 1-bit hardware interface
56
    //% @{
57
        output          sd_clk_o,
58
        inout           sd_cmd_io,
59
        inout           sd_dat_io,
60
        //% @}
61
 
62
        //% \name ADV7123 Video DAC hardware interface
63
    //% @{
64
        output [9:0]    vga_r,
65
        output [9:0]    vga_g,
66
        output [9:0]    vga_b,
67
        output          vga_blank_n,
68
        output          vga_sync_n,
69
        output          vga_clock,
70
        output          vga_hsync,
71
        output          vga_vsync,
72
        //% @}
73
 
74
        //% \name PS/2 keyboard hardware interface
75
    //% @{
76
        inout           ps2_kbclk,
77
    inout           ps2_kbdat,
78
        //% @}
79
 
80
        //% \name PS/2 mouse hardware interface
81
    //% @{
82
    inout           ps2_mouseclk,
83
    inout           ps2_mousedat,
84
    //% @}
85
 
86
    //% \name WM8731 audio codec hardware interface
87
    //% @{
88
    output          ac_sclk,
89
    inout           ac_sdat,
90
    output          ac_xclk,
91
    output          ac_bclk,
92
    output          ac_dat,
93
    output          ac_lr,
94
    //% @}
95
 
96
    //% \name DM9000A Ethernet hardware interface
97
    //% @{
98
    output          enet_clk_25,
99
    output          enet_reset_n,
100
    output          enet_cs_n,
101
    input           enet_irq,
102
    output          enet_ior_n,
103
    output          enet_iow_n,
104
    output          enet_cmd,
105
    inout [15:0]    enet_data,
106
    //% @}
107
 
108
    //% \name Switches and hex leds hardware interface from drv_debug
109
    //% @{
110
    // hex output
111
        output [7:0]    hex0,
112
        output [7:0]    hex1,
113
        output [7:0]    hex2,
114
        output [7:0]    hex3,
115
        output [7:0]    hex4,
116
        output [7:0]    hex5,
117
        output [7:0]    hex6,
118
        output [7:0]    hex7,
119
         // switches input
120
    input           debug_sw1_pc,
121
    input           debug_sw2_adr,
122
    input           debug_sw3_halt,
123
    //% @}
124
 
125
    //% \name Leds hardware interface for debug purposes
126
    //% @{
127
        output [7:0]    debug_sd,
128
        output [7:0]    debug_68k_state,
129
        output [7:0]    debug_floppy
130
        //% @}
131
);
132
 
133
/*
134
Amiga:
135
    00 0000 - 0F FFFF       1MB Chip RAM
136
    BF D000 - BF DF00       8520-B  (access at even-byte addresses only)
137
        -         -
138
    BF E001 - BF EF01       8520-A  (access at odd-byte addresses only)
139
 
140
    DF F000 - DF FFFF       Chip registers.
141
    C0 0000 - D7 FFFF       Internal expansion (slow) memory (on some systems).
142
    C0 0000 - DB FFFF       Slow memory check in ROM
143
 
144
    FC 0000 - FF FFFF       256K System ROM.
145
 
146
    0000 0000 0000 xxxx xxxx xxxx xxxx xxxx - chip ram
147
    0000 0000 1011 1111 11** **** **** **** - 8520-A/B
148
    0000 0000 1101 1111 1111 000x xxxx xxxx - chip registes
149
    0000 0000 1100 xxxx xxxx xxxx xxxx xxxx - slow memory
150
    0000 0000 1101 0xxx xxxx xxxx xxxx xxxx - slow memory
151
    0000 0000 1101 10xx xxxx xxxx xxxx xxxx - slow memory
152
    0000 0000 1111 11xx xxxx xxxx xxxx xxxx - system rom
153
 
154
    0000 0000 110* **** **** **** **** **** - chip registers and copy of chip registers
155
 
156
    0x00F00000 - no ROM at this address
157
 
158
bus_ssram
159
    SLAVE 2: ssram memory
160
        0x00000000 - 0x001FFFFF - 1MB Chip RAM and copies
161
            0x00000000 - 0x000FFFFF - 1MB Chip RAM          -> 0x00000000 - 0x000FFFFF in SSRAM
162
            0x00100000 - 0x001FFFFF - copy of Chip RAM
163
 
164
            AND mask:           0000 0000 0000 1111 1111 1111 1111 1111
165
            overlay OR mask:    0000 0000 0001 1100 0000 0000 0000 0000
166
 
167
        0x10100000 - 0x101BFFFF - 768Kb firmware RAM        -> 0x00100000 - 0x001BFFFF in SSRAM
168
            0x10180000 - 0x101B5FFF - video buffer          -> 0x00180000 - 0x001B5FFF in SSRAM, 216*4*256
169
            0x101B6000 - 0x101BFFFF - free                  -> 0x001B6000 - 0x001BFFFF in SSRAM
170
 
171
            AND mask:           0000 0000 0001 1111 1111 1111 1111 1111
172
 
173
        0x00FC0000 - 0x00FFFFFF - 256Kb ROM                 -> 0x001C0000 - 0x001FFFFF in SSRAM
174
 
175
            AND mask:           0000 0000 0001 1111 1111 1111 1111 1111
176
 
177
bus_sd
178
    SLAVE 1: control
179
        0x10001000 - 0x1000100F - 4 long words
180
    MASTER R1
181
 
182
control_osd
183
    SLAVE 3: on screen display
184
        0x10000000 - 0x10000FFF - 512x8
185
    MASTER R2
186
 
187
bus_terminator
188
    SLAVE 0:
189
        all unused addresses
190
 
191
ao68000
192
    MASTER R3
193
 
194
ocs_video
195
    SLAVE 4:
196
        chip registers
197
        08C-09B, 100-10B, 0E0-0F7, 120-1BF, 110-11B
198
    MASTER P1
199
 
200
ocs_control
201
    SLAVE 5:
202
        chip registers
203
        000-007 R, 09C-09F, 010-013 R, 01C-01F R, 028-02B
204
 
205
ocs_blitter
206
    SLAVE 6:
207
        chip registers
208
        040-059, 060-067, 070-075
209
    MASTER P2
210
 
211
ocs_copper
212
    SLAVE 7:
213
        chip registers
214
        02C-02F, 080-08B
215
    MASTER R4
216
 
217
cia_a
218
    SLAVE 8:
219
    0000_0000_101*_****_**10_****_****_****
220
 
221
cia_b
222
    SLAVE 9:
223
    0000_0000_101*_****_**01_****_****_****
224
 
225
ocs_serial
226
    SLAVE 10:
227
        chip registers
228
        018-01B R, 030-033
229
 
230
ocs_floppy
231
    SLAVE 11:
232
        chip registers
233
        020-027, 07C-07F
234
    SLAVE 12: floppy buffer
235
        0x10004000 - 0x100055FF, 11x512
236
    MASTER R5
237
 
238
ocs_input
239
    SLAVE 13:
240
        chip registers
241
        008-00F R, 014-017 R, 034-037
242
 
243
ocs_audio
244
    SLAVE 14:
245
        chip registers
246
        0A0-0AB, 0B0-0BB, 0C0-0CB, 0D0-0DB
247
    MASTER R6
248
*/
249
 
250
/***********************************************************************************************************************
251
 * System PLL
252
 **********************************************************************************************************************/
253
 
254
wire [5:0]  pll_clocks;
255
wire        clk_30 = pll_clocks[0];
256
wire        clk_12 = pll_clocks[1];
257
wire        clk_25 = pll_clocks[2];
258
wire        pll_locked;
259
 
260
altpll pll_inst(
261
        .inclk  ( {1'b0, clk_50} ),
262
        .clk    (pll_clocks),
263
        .locked (pll_locked)
264
);
265
defparam
266
    pll_inst.clk0_divide_by             = 5,
267
    pll_inst.clk0_duty_cycle            = 50,
268
    pll_inst.clk0_multiply_by           = 3,
269
    pll_inst.clk0_phase_shift           = "0",
270
    pll_inst.clk1_divide_by             = 25,
271
    pll_inst.clk1_duty_cycle            = 50,
272
    pll_inst.clk1_multiply_by           = 6,
273
    pll_inst.clk1_phase_shift           = "0",
274
    pll_inst.clk2_divide_by             = 2,
275
    pll_inst.clk2_duty_cycle            = 50,
276
    pll_inst.clk2_multiply_by           = 1,
277
    pll_inst.clk2_phase_shift           = "0",
278
    pll_inst.compensate_clock           = "CLK0",
279
    pll_inst.gate_lock_counter          = 1048575,
280
    pll_inst.gate_lock_signal           = "YES",
281
    pll_inst.inclk0_input_frequency     = 20000,
282
    pll_inst.intended_device_family     = "Cyclone II",
283
    pll_inst.invalid_lock_multiplier    = 5,
284
    pll_inst.lpm_hint                   = "CBX_MODULE_PREFIX=pll30",
285
    pll_inst.lpm_type                   = "altpll",
286
    pll_inst.operation_mode             = "NORMAL",
287
    pll_inst.valid_lock_multiplier      = 1;
288
 
289
wire reset_n            = pll_locked & reset_ext_n & ~reset_request;
290
wire management_reset_n = reset_n & ~management_mode;
291
 
292
/***********************************************************************************************************************
293
 * drv_audio
294
 **********************************************************************************************************************/
295
drv_audio drv_audio_inst(
296
    .clk_12 (clk_12),
297
    .reset_n(management_reset_n),
298
 
299
    // drv_audio interface
300
    .volume0(volume0), /*[6:0]*/
301
    .volume1(volume1), /*[6:0]*/
302
    .volume2(volume2), /*[6:0]*/
303
    .volume3(volume3), /*[6:0]*/
304
 
305
    .sample0(sample0), /*[7:0]*/
306
    .sample1(sample1), /*[7:0]*/
307
    .sample2(sample2), /*[7:0]*/
308
    .sample3(sample3), /*[7:0]*/
309
 
310
    // WM8731 audio codec hardware interface
311
    .ac_sclk(ac_sclk),
312
    .ac_sdat(ac_sdat),
313
    .ac_xclk(ac_xclk),
314
    .ac_bclk(ac_bclk),
315
    .ac_dat (ac_dat),
316
    .ac_lr  (ac_lr)
317
);
318
 
319
/***********************************************************************************************************************
320
 * drv_keyboard
321
 **********************************************************************************************************************/
322
wire        joystick_1_up;
323
wire        joystick_1_down;
324
wire        joystick_1_left;
325
wire        joystick_1_right;
326
wire        joystick_1_fire;
327
 
328
wire        request_osd;
329
wire        keyboard_event;
330
wire [7:0]  keyboard_scancode;
331
 
332
drv_keyboard drv_keyboard_inst (
333
    .clk_30             (clk_30),
334
    .reset_n            (reset_n),
335
 
336
    // On-Screen-Display management interface
337
    .request_osd        (request_osd),
338
    .enable_joystick_1  (on_screen_display | joystick_enable),
339
 
340
    // drv_keyboard interface
341
    .keyboard_ready     (keyboard_ready),
342
    .keyboard_event     (keyboard_event),
343
    .keyboard_scancode  (keyboard_scancode), /*[7:0]*/
344
 
345
    // joystick on port 1
346
    .joystick_1_up      (joystick_1_up),
347
    .joystick_1_down    (joystick_1_down),
348
    .joystick_1_left    (joystick_1_left),
349
    .joystick_1_right   (joystick_1_right),
350
    .joystick_1_fire    (joystick_1_fire),
351
 
352
    // PS/2 keyboard hardware interface
353
    .ps2_kbclk          (ps2_kbclk),
354
    .ps2_kbdat          (ps2_kbdat)
355
);
356
 
357
 
358
 
359
/***********************************************************************************************************************
360
 * drv_mouse
361
 **********************************************************************************************************************/
362
wire        mouse_moved;
363
wire [8:0]  mouse_y_move;
364
wire [8:0]  mouse_x_move;
365
wire        mouse_left_button;
366
wire        mouse_right_button;
367
wire        mouse_middle_button;
368
 
369
drv_mouse drv_mouse_inst(
370
    .clk_30                 (clk_30),
371
    .reset_n                (management_reset_n),
372
 
373
    // drv_keyboard interface
374
    .mouse_moved            (mouse_moved),
375
    .mouse_y_move           (mouse_y_move), /*[8:0]*/
376
    .mouse_x_move           (mouse_x_move), /*[8:0]*/
377
    .mouse_left_button      (mouse_left_button),
378
    .mouse_right_button     (mouse_right_button),
379
    .mouse_middle_button    (mouse_middle_button),
380
 
381
    // PS/2 mouse hardware interface
382
    .ps2_mouseclk           (ps2_mouseclk),
383
    .ps2_mousedat           (ps2_mousedat)
384
);
385
 
386
/***********************************************************************************************************************
387
 * bus_sd
388
 **********************************************************************************************************************/
389
 
390
bus_sd bus_sd_inst(
391
    .clk_30         (clk_30),
392
    .reset_n        (reset_n),
393
 
394
    // WISHBONE master
395
    .CYC_O          (masterR1_cyc_o),
396
    .DAT_O          (masterR1_dat_o),
397
    .STB_O          (masterR1_stb_o),
398
    .WE_O           (masterR1_we_o),
399
    .ADR_O          (masterR1_adr_o),
400
    .SEL_O          (masterR1_sel_o),
401
    .DAT_I          (slave_dat_o),
402
    .ACK_I          (masterR1_ack_i),
403
    .ERR_I          (masterR1_err_i),
404
    .RTY_I          (masterR1_rty_i),
405
    // TAG_TYPE: TGC_O
406
    .SGL_O          (),
407
    .BLK_O          (),
408
    .RMW_O          (),
409
    // TAG_TYPE: TGA_O
410
    .CTI_O          (),
411
    .BTE_O          (),
412
 
413
    // WISHBONE slave
414
    .slave_DAT_O    (slave1_dat_o),
415
    .slave_DAT_I    (master_dat_o),
416
    .ACK_O          (slave1_ack_o),
417
    .ERR_O          (slave1_err_o),
418
    .RTY_O          (slave1_rty_o),
419
    .CYC_I          (slave1_cyc_i),
420
    .ADR_I          (master_adr_o[3:2]), /*[3:2]*/
421
    .STB_I          (slave1_stb_i),
422
    .WE_I           (master_we_o),
423
    .SEL_I          (master_sel_o),
424
 
425
    // SD bus 1-bit hardware interface
426
    .sd_clk_o       (sd_clk_o),
427
    .sd_cmd_io      (sd_cmd_io),
428
    .sd_dat_io      (sd_dat_io),
429
 
430
    // Debug signals
431
    .debug_sd       (debug_sd)
432
);
433
 
434
/***********************************************************************************************************************
435
 * bus_ssram
436
 **********************************************************************************************************************/
437
 
438
wire [35:0] burst_read_data;
439
 
440
bus_ssram bus_ssram_inst(
441
    .clk_30                     (clk_30),
442
    .reset_n                    (reset_n),
443
 
444
    // WISHBONE slave
445
    .ADR_I                      (master_adr_o[20:2]), /*[20:2]*/
446
    .CYC_I                      (slave2_cyc_i),
447
    .WE_I                       (master_we_o),
448
    .SEL_I                      (master_sel_o),
449
    .STB_I                      (slave2_stb_i),
450
    .DAT_I                      (master_dat_o),
451
    .DAT_O                      (slave2_dat_o),
452
    .ACK_O                      (slave2_ack_o),
453
 
454
    // Direct drv_ssram read/write burst DMA for ocs_video and drv_vga 
455
    // drv_vga read burst
456
    .burst_read_vga_request     (burst_read_vga_request),
457
    .burst_read_vga_address     (burst_read_vga_address),
458
    .burst_read_vga_ready       (burst_read_vga_ready),
459
    // ocs_video bitplain read burst
460
    .burst_read_video_request   (burst_read_video_request),
461
    .burst_read_video_address   (burst_read_video_address),
462
    .burst_read_video_ready     (burst_read_video_ready),
463
    // common read burst data signal
464
    .burst_read_data            (burst_read_data),
465
 
466
    // ocs_video video output write burst
467
    .burst_write_request        (burst_write_request),
468
    .burst_write_address        (burst_write_address),
469
    .burst_write_ready          (burst_write_ready),
470
    .burst_write_data           (burst_write_data),
471
 
472
    // IS61LPS51236A pipelined SSRAM hardware interface
473
    .ssram_address              (ssram_address),
474
    .ssram_oe_n                 (ssram_oe_n),
475
    .ssram_writeen_n            (ssram_writeen_n),
476
    .ssram_byteen_n             (ssram_byteen_n),
477
    .ssram_adsp_n               (ssram_adsp_n),
478
    .ssram_clk                  (ssram_clk),
479
    .ssram_globalw_n            (ssram_globalw_n),
480
    .ssram_advance_n            (ssram_advance_n),
481
    .ssram_adsc_n               (ssram_adsc_n),
482
    .ssram_ce1_n                (ssram_ce1_n),
483
    .ssram_ce2                  (ssram_ce2),
484
    .ssram_ce3_n                (ssram_ce3_n),
485
    .ssram_data                 (ssram_data)
486
);
487
 
488
/***********************************************************************************************************************
489
 * drv_vga
490
 **********************************************************************************************************************/
491
 
492
wire        burst_read_vga_request;
493
wire [31:2] burst_read_vga_address;
494
wire        burst_read_vga_ready;
495
 
496
wire [4:0]  osd_line;
497
wire [4:0]  osd_column;
498
 
499
wire        display_valid;
500
 
501
drv_vga drv_vga_inst(
502
    .clk_30             (clk_30),
503
    .reset_n            (reset_n),
504
 
505
    // On-Screen-Display management interface
506
    .management_mode    (management_mode),
507
    .on_screen_display  (on_screen_display),
508
    .osd_line           (osd_line),
509
    .osd_column         (osd_column),
510
    .character          (character),
511
 
512
    // Control signal for VGA capture
513
    .display_valid(display_valid),
514
 
515
    // Direct drv_ssram burst read DMA video interface
516
    .burst_read_request (burst_read_vga_request),
517
    .burst_read_address (burst_read_vga_address),   /*[18:0]*/
518
    .burst_read_ready   (burst_read_vga_ready),
519
    .burst_read_data    (burst_read_data),          /*[35:0]*/
520
 
521
    // ADV7123 Video DAC hardware interface
522
    .vga_r              (vga_r),        /*[9:0]*/
523
    .vga_g              (vga_g),        /*[9:0]*/
524
    .vga_b              (vga_b),        /*[9:0]*/
525
    .vga_blank_n        (vga_blank_n),
526
    .vga_sync_n         (vga_sync_n),
527
    .vga_clock          (vga_clock),
528
    .vga_hsync          (vga_hsync),
529
    .vga_vsync          (vga_vsync)
530
);
531
 
532
/***********************************************************************************************************************
533
 * drv_eth_vga_capture
534
 **********************************************************************************************************************/
535
drv_eth_vga_capture drv_eth_vga_capture_inst(
536
    .clk_30         (clk_30),
537
    .clk_25         (clk_25),
538
    .reset_n        (reset_n),
539
 
540
    // Captured VGA output signals
541
    .display_valid  (display_valid),
542
    .vga_r          (vga_r),
543
    .vga_g          (vga_g),
544
    .vga_b          (vga_b),
545
 
546
    // DM9000A Ethernet hardware interface
547
    .enet_clk_25(enet_clk_25),
548
    .enet_reset_n(enet_reset_n),
549
    .enet_cs_n(enet_cs_n),
550
    .enet_irq(enet_irq),
551
 
552
    .enet_ior_n(enet_ior_n),
553
    .enet_iow_n(enet_iow_n),
554
    .enet_cmd(enet_cmd),
555
    .enet_data(enet_data) /*[15:0]*/
556
);
557
 
558
/***********************************************************************************************************************
559
 * drv_debug
560
 **********************************************************************************************************************/
561
 
562
drv_debug drv_debug_inst(
563
    .CLK_I          (clk_30),
564
    .reset_n        (reset_n),
565
 
566
    // Internal debug signals
567
    .master_adr_o   (master_adr_o),
568
    .debug_pc       (debug_pc),
569
    .debug_syscon   (debug_syscon),
570
    .debug_track    (debug_track),
571
 
572
    // Switches and hex leds hardware interface
573
    // hex output
574
    .hex0           (hex0),
575
    .hex1           (hex1),
576
    .hex2           (hex2),
577
    .hex3           (hex3),
578
    .hex4           (hex4),
579
    .hex5           (hex5),
580
    .hex6           (hex6),
581
    .hex7           (hex7),
582
    // switches input
583
    .debug_sw_pc    (debug_sw1_pc),
584
    .debug_sw_adr   (debug_sw2_adr)
585
);
586
 
587
 
588
/***********************************************************************************************************************
589
 * control_osd
590
 **********************************************************************************************************************/
591
wire        management_mode;
592
wire        on_screen_display;
593
wire [7:0]  character;
594
 
595
wire        floppy_inserted;
596
wire [31:0] floppy_sector;
597
wire        floppy_write_enabled;
598
wire        joystick_enable;
599
wire        reset_request;
600
 
601
control_osd control_osd_inst(
602
    .CLK_I                  (clk_30),
603
    .reset_n                (reset_n),
604
    .reset_request          (reset_request),
605
    .management_mode        (management_mode),
606
 
607
    // WISHBONE master
608
    .CYC_O                  (masterR2_cyc_o),
609
    .STB_O                  (masterR2_stb_o),
610
    .WE_O                   (masterR2_we_o),
611
    .ADR_O                  (masterR2_adr_o), /*[31:2]*/
612
    .SEL_O                  (masterR2_sel_o),
613
    .master_DAT_O           (masterR2_dat_o),
614
    .master_DAT_I           (slave_dat_o),
615
    .ACK_I                  (masterR2_ack_i),
616
 
617
    // WISHBONE slave
618
    .ADR_I                  (master_adr_o),
619
    .CYC_I                  (slave3_cyc_i),
620
    .WE_I                   (master_we_o),
621
    .STB_I                  (slave3_stb_i),
622
    .SEL_I                  (master_sel_o),
623
    .slave_DAT_I            (master_dat_o),
624
    .slave_DAT_O            (slave3_dat_o),
625
    .ACK_O                  (slave3_ack_o),
626
    .RTY_O                  (slave3_rty_o),
627
    .ERR_O                  (slave3_err_o),
628
 
629
    // On-Screen-Display management interface
630
    .request_osd            (request_osd),
631
    .on_screen_display      (on_screen_display),
632
 
633
    .osd_line               (osd_line),
634
    .osd_column             (osd_column),
635
    .character              (character),
636
 
637
    .joystick_enable        (joystick_enable),
638
    .keyboard_select        (joystick_1_fire),
639
    .keyboard_up            (joystick_1_up),
640
    .keyboard_down          (joystick_1_down),
641
 
642
    // On-Screen-Display floppy management interface
643
    .floppy_inserted        (floppy_inserted),
644
    .floppy_sector          (floppy_sector),
645
    .floppy_write_enabled   (floppy_write_enabled),
646
    .floppy_error           (floppy_error)
647
);
648
 
649
 
650
/***********************************************************************************************************************
651
 * bus_terminator
652
 **********************************************************************************************************************/
653
 
654
bus_terminator bus_terminator_inst(
655
    .CLK_I(clk_30),
656
    .reset_n(reset_n),
657
 
658
    // WISHBONE slave
659
    .ADR_I                  (master_adr_o),
660
    .CYC_I                  (slave0_cyc_i),
661
    .WE_I                   (master_we_o),
662
    .STB_I                  (slave0_stb_i),
663
    .SEL_I                  (master_sel_o),
664
    .slave_DAT_I            (master_dat_o),
665
    .slave_DAT_O            (slave0_dat_o),
666
    .ACK_O                  (slave0_ack_o),
667
    .RTY_O                  (slave0_rty_o),
668
    .ERR_O                  (slave0_err_o),
669
 
670
    // ao68000 interrupt cycle indicator
671
    .cpu_space_cycle( masterR3_cyc_o == 1'b1 && masterR3_stb_o == 1'b1 && masterR3_we_o == 1'b0 && fc == 3'd7 )
672
);
673
 
674
 
675
/***********************************************************************************************************************
676
 * ao68000
677
 **********************************************************************************************************************/
678
wire [31:0] debug_pc;
679
wire [2:0]  fc;
680
 
681
ao68000 ao68000_inst(
682
        .CLK_I              (clk_30),
683
        .reset_n            (management_reset_n),
684
 
685
    // WISHBONE master
686
        .CYC_O              (masterR3_cyc_o),
687
        .ADR_O              (masterR3_adr_o),
688
        .DAT_O              (masterR3_dat_o),
689
        .DAT_I              (slave_dat_o),
690
        .SEL_O              (masterR3_sel_o),
691
        .STB_O              (masterR3_stb_o),
692
        .WE_O               (masterR3_we_o),
693
 
694
        .ACK_I              (masterR3_ack_i),
695
        .ERR_I              (masterR3_err_i),
696
        .RTY_I              (masterR3_rty_i),
697
 
698
        // TAG_TYPE: TGC_O
699
        .SGL_O              (),
700
        .BLK_O              (),
701
        .RMW_O              (),
702
 
703
        // TAG_TYPE: TGA_O
704
        .CTI_O              (),
705
        .BTE_O              (),
706
 
707
        // TAG_TYPE: TGC_O
708
        .fc_o               (fc),
709
 
710
        //****************** OTHER
711
        /* interrupt acknowlege:
712
         * ACK_I: interrupt vector on DAT_I[7:0]
713
         * ERR_I: spurious interrupt
714
         * RTY_I: autovector
715
         */
716
        .ipl_i              (interrupt),
717
        .reset_o            (),
718
        .blocked_o          (),
719
 
720
        .debug_pc           (debug_pc),
721
        .debug_68k_state    (debug_68k_state)
722
);
723
 
724
/***********************************************************************************************************************
725
 * ocs_video
726
 **********************************************************************************************************************/
727
 
728
wire        burst_read_video_request;
729
wire [31:2] burst_read_video_address;
730
wire        burst_read_video_ready;
731
 
732
wire        burst_write_request;
733
wire [31:2] burst_write_address;
734
wire [35:0] burst_write_data;
735
wire        burst_write_ready;
736
 
737
wire        na_int_ena_write;
738
wire [15:0] na_int_ena;
739
wire [1:0]  na_int_ena_sel;
740
 
741
wire        na_dma_con_write;
742
wire [15:0] na_dma_con;
743
wire [1:0]  na_dma_con_sel;
744
 
745
wire [15:0] na_clx_dat;
746
 
747
ocs_video ocs_video_inst(
748
    .CLK_I              (clk_30),
749
    .reset_n            (management_reset_n),
750
 
751
    // WISHBONE master
752
    .CYC_O              (masterP_cyc_o),
753
    .STB_O              (masterP_stb_o),
754
    .WE_O               (masterP_we_o),
755
    .ADR_O              (masterP_adr_o), /*[31:2]*/
756
    .SEL_O              (masterP_sel_o),
757
    .master_DAT_I       (slave_dat_o),
758
    .ACK_I              (masterP_ack_i),
759
 
760
    // WISHBONE slave
761
    .CYC_I              (slave4_cyc_i),
762
    .STB_I              (slave4_stb_i),
763
    .WE_I               (master_we_o),
764
    .ADR_I              (master_adr_o[8:2]), /*[8:2]*/
765
    .SEL_I              (master_sel_o),
766
    .slave_DAT_I        (master_dat_o),
767
    .ACK_O              (slave4_ack_o),
768
 
769
    // Not aligned register access on a 32-bit WISHBONE bus
770
        // CLXDAT read not implemented here
771
    .na_clx_dat_read    (na_clx_dat_read),
772
    .na_clx_dat         (na_clx_dat),
773
        // INTENA write implemented here
774
    .na_int_ena_write   (na_int_ena_write),
775
    .na_int_ena         (na_int_ena),       /*[15:0]*/
776
    .na_int_ena_sel     (na_int_ena_sel),   /*[1:0]*/
777
        // DMACON write implemented here
778
    .na_dma_con_write   (na_dma_con_write),
779
    .na_dma_con         (na_dma_con),       /*[15:0]*/
780
    .na_dma_con_sel     (na_dma_con_sel),   /*[1:0]*/
781
 
782
    // Direct drv_ssram read/write DMA burst video interface
783
    // bitplain burst read
784
        .burst_read_request (burst_read_video_request),
785
        .burst_read_address (burst_read_video_address), /*[18:0]*/
786
        .burst_read_ready   (burst_read_video_ready),
787
        .burst_read_data    (burst_read_data[31:0]),    /*[31:0]*/
788
 
789
    // video output burst write
790
    .burst_write_request(burst_write_request),
791
    .burst_write_address(burst_write_address),
792
    .burst_write_data   (burst_write_data),
793
    .burst_write_ready  (burst_write_ready),
794
 
795
    // Internal OCS ports
796
    .line_start         (line_start),
797
    .line_pre_start     (line_pre_start),
798
    .line_number        (line_number),
799
    .column_number      (column_number),
800
 
801
    .dma_con            (dma_con) /*[10:0]*/
802
);
803
 
804
/***********************************************************************************************************************
805
 * ocs_control
806
 **********************************************************************************************************************/
807
 
808
wire        line_start;
809
wire        line_pre_start;
810
wire [8:0]  line_number;
811
wire [8:0]  column_number;
812
 
813
wire        pulse_709379_hz;
814
wire        pulse_color;
815
 
816
wire [2:0]  interrupt;
817
 
818
wire [10:0] dma_con;
819
wire [14:0] adk_con;
820
 
821
wire        na_pot0dat_read;
822
 
823
ocs_control ocs_control_inst(
824
    .clk_30             (clk_30),
825
    .reset_n            (management_reset_n),
826
 
827
    // WISHBONE slave
828
    .CYC_I              (slave5_cyc_i),
829
    .STB_I              (slave5_stb_i),
830
    .WE_I               (master_we_o),
831
    .ADR_I              (master_adr_o[8:2]),
832
    .SEL_I              (master_sel_o),
833
    .slave_DAT_I        (master_dat_o),
834
    .slave_DAT_O        (slave5_dat_o),
835
    .ACK_O              (slave5_ack_o),
836
 
837
    // Not aligned register access on a 32-bit WISHBONE bus
838
        // INTENA write not implemented here
839
    .na_int_ena_write   (na_int_ena_write),
840
    .na_int_ena         (na_int_ena), /*[15:0]*/
841
    .na_int_ena_sel     (na_int_ena_sel), /*[1:0]*/
842
        // DMACON write not implemented here
843
    .na_dma_con_write   (na_dma_con_write),
844
    .na_dma_con         (na_dma_con), /*[15:0]*/
845
    .na_dma_con_sel     (na_dma_con_sel), /*[1:0]*/
846
        // POT0DAT read implemented here
847
    .na_pot0dat_read    (na_pot0dat_read),
848
    .na_pot0dat         (na_pot0dat),
849
 
850
    // Internal OCS ports: beam counters
851
    .line_start         (line_start),
852
    .line_pre_start     (line_pre_start),
853
    .line_number        (line_number),
854
    .column_number      (column_number),
855
 
856
    // Internal OCS ports: clock pulses for CIA and audio
857
    .pulse_709379_hz    (pulse_709379_hz),
858
    .pulse_color        (pulse_color),
859
 
860
    // Internal OCS ports: global registers and blitter signals
861
    .dma_con            (dma_con), /*[10:0]*/
862
    .adk_con            (adk_con), /*[14:0]*/
863
 
864
    .blitter_busy       (blitter_busy),
865
    .blitter_zero       (blitter_zero),
866
 
867
    // Internal OCS ports: interrupts
868
    .blitter_irq        (blitter_irq),
869
    .cia_a_irq          (~cia_a_irq_n),
870
    .cia_b_irq          (~cia_b_irq_n),
871
    .floppy_syn_irq     (floppy_syn_irq),
872
    .floppy_blk_irq     (floppy_blk_irq),
873
    .serial_rbf_irq     (1'b0),
874
    .serial_tbe_irq     (1'b0),
875
    .audio_irq          (audio_irq),
876
 
877
    .interrupt          (interrupt)
878
);
879
 
880
/***********************************************************************************************************************
881
 * ocs_blitter
882
 **********************************************************************************************************************/
883
 
884
wire blitter_zero;
885
wire blitter_busy;
886
wire blitter_irq;
887
 
888
ocs_blitter ocs_blitter_inst(
889
    .CLK_I          (clk_30),
890
    .reset_n        (management_reset_n),
891
 
892
    // WISHBONE master
893
    .CYC_O          (masterR7_cyc_o),
894
    .STB_O          (masterR7_stb_o),
895
    .WE_O           (masterR7_we_o),
896
    .ADR_O          (masterR7_adr_o),
897
    .SEL_O          (masterR7_sel_o),
898
    .master_DAT_O   (masterR7_dat_o),
899
    .master_DAT_I   (slave_dat_o),
900
    .ACK_I          (masterR7_ack_i),
901
 
902
    // WISHBONE slave
903
    .CYC_I          (slave6_cyc_i),
904
    .STB_I          (slave6_stb_i),
905
    .WE_I           (master_we_o),
906
    .ADR_I          (master_adr_o[8:2]),
907
    .SEL_I          (master_sel_o),
908
    .slave_DAT_I    (master_dat_o),
909
    .ACK_O          (slave6_ack_o),
910
 
911
    // Internal OCS ports
912
    .dma_con        (dma_con), /*[10:0]*/
913
 
914
    .blitter_irq    (blitter_irq),
915
    .blitter_zero   (blitter_zero),
916
    .blitter_busy   (blitter_busy)
917
);
918
 
919
/***********************************************************************************************************************
920
 * ocs_copper
921
 **********************************************************************************************************************/
922
 
923
ocs_copper ocs_copper_inst(
924
    .CLK_I          (clk_30),
925
    .reset_n        (management_reset_n),
926
 
927
    // WISHBONE master
928
    .CYC_O          (masterR4_cyc_o),
929
    .STB_O          (masterR4_stb_o),
930
    .WE_O           (masterR4_we_o),
931
    .ADR_O          (masterR4_adr_o),
932
    .SEL_O          (masterR4_sel_o),
933
    .master_DAT_O   (masterR4_dat_o),
934
    .master_DAT_I   (slave_dat_o),
935
    .ACK_I          (masterR4_ack_i),
936
 
937
    // WISHBONE slave
938
    .CYC_I          (slave7_cyc_i),
939
    .STB_I          (slave7_stb_i),
940
    .WE_I           (master_we_o),
941
    .ADR_I          (master_adr_o[8:2]),
942
    .SEL_I          (master_sel_o),
943
    .slave_DAT_I    (master_dat_o),
944
    .ACK_O          (slave7_ack_o),
945
 
946
    // Internal OCS ports
947
    .line_start     (line_start),
948
    .line_number    (line_number),  /*[8:0]*/
949
    .column_number  (column_number),/*[8:0]*/
950
 
951
    .dma_con        (dma_con), /*[10:0]*/
952
    .blitter_busy   (blitter_busy)
953
);
954
 
955
/***********************************************************************************************************************
956
 * CIA-A
957
 **********************************************************************************************************************/
958
wire [7:0]  cia_a_pa;
959
wire [7:0]  cia_a_pa_i;
960
wire        cia_a_irq_n;
961
wire        cia_a_sp_o;
962
 
963
wire [7:0]  cia_a_output;
964
assign slave8_dat_o = {8'd0, cia_a_output, 8'd0, cia_a_output};
965
 
966
cia8520 cia8520_a_inst(
967
    .CLK_I              (clk_30),
968
    .reset_n            (management_reset_n),
969
 
970
    // WISHBONE slave
971
    .CYC_I              (slave8_cyc_i),
972
    .STB_I              (slave8_stb_i),
973
    .WE_I               (master_we_o),
974
    .ADR_I              (master_adr_o[11:8]),
975
    .DAT_I              (master_dat_o[23:16]),
976
    .ACK_O              (slave8_ack_o),
977
    .DAT_O              (cia_a_output),
978
 
979
    // Internal OCS ports
980
    .pulse_709379_hz    (pulse_709379_hz),
981
 
982
    // 8520 synchronous interface
983
    .pa_o               (cia_a_pa),
984
    .pb_o               (),
985
    .pa_i               ( {cia_a_pa_i[7:2], 2'b11} ),
986
    .pb_i               (8'hFF),
987
 
988
    .flag_n             (1'b1),
989
    .pc_n               (),
990
    .tod                (line_start == 1'b1 && line_number == 9'd0),
991
    .irq_n              (cia_a_irq_n),
992
 
993
    .sp_i               (sp_to_cia_a),
994
    .sp_o               (cia_a_sp_o),
995
    .cnt_i              (cnt_to_cia_a),
996
    .cnt_o              ()
997
);
998
 
999
/***********************************************************************************************************************
1000
 * CIA-B
1001
 **********************************************************************************************************************/
1002
wire [7:0]  cia_b_pb;
1003
wire        cia_b_irq_n;
1004
wire        cia_b_flag_n;
1005
 
1006
wire [7:0]  cia_b_output;
1007
assign slave9_dat_o = {cia_b_output, 8'd0, cia_a_output, 8'd0};
1008
 
1009
cia8520 cia8520_b_inst(
1010
    .CLK_I              (clk_30),
1011
    .reset_n            (management_reset_n),
1012
 
1013
    // WISHBONE slave
1014
    .CYC_I              (slave9_cyc_i),
1015
    .STB_I              (slave9_stb_i),
1016
    .WE_I               (master_we_o),
1017
    .ADR_I              (master_adr_o[11:8]),
1018
    .DAT_I              (master_dat_o[31:24]),
1019
    .ACK_O              (slave9_ack_o),
1020
    .DAT_O              (cia_b_output),
1021
 
1022
    // Internal OCS ports
1023
    .pulse_709379_hz    (pulse_709379_hz),
1024
 
1025
    // 8520 synchronous interface
1026
    .pa_o               (),
1027
    .pb_o               (cia_b_pb),
1028
    .pa_i               (8'hFF),
1029
    .pb_i               (8'hFF),
1030
 
1031
    .flag_n             (cia_b_flag_n),
1032
    .pc_n               (),
1033
    .tod                (line_start == 1'b1),
1034
    .irq_n              (cia_b_irq_n),
1035
 
1036
    .sp_i               (1'b0),
1037
    .sp_o               (),
1038
    .cnt_i              (1'b0),
1039
    .cnt_o              ()
1040
);
1041
 
1042
/***********************************************************************************************************************
1043
 * ocs_serial
1044
 **********************************************************************************************************************/
1045
wire na_dskbytr_read;
1046
 
1047
ocs_serial ocs_serial_inst(
1048
    .CLK_I          (clk_30),
1049
    .reset_n        (management_reset_n),
1050
 
1051
    // WISHBONE slave
1052
    .CYC_I          (slave10_cyc_i),
1053
    .STB_I          (slave10_stb_i),
1054
    .WE_I           (master_we_o),
1055
    .ADR_I          (master_adr_o[8:2]),
1056
    .SEL_I          (master_sel_o),
1057
    .DAT_I          (master_dat_o),
1058
    .DAT_O          (slave10_dat_o),
1059
    .ACK_O          (slave10_ack_o),
1060
 
1061
    // Not aligned register access on a 32-bit WISHBONE bus
1062
        // DSKBYTR implemented here
1063
    .na_dskbytr_read(na_dskbytr_read),
1064
    .na_dskbytr     (na_dskbytr)
1065
);
1066
 
1067
/***********************************************************************************************************************
1068
 * ocs_floppy
1069
 **********************************************************************************************************************/
1070
wire [15:0] na_dskbytr;
1071
wire        floppy_error;
1072
 
1073
wire        floppy_syn_irq;
1074
wire        floppy_blk_irq;
1075
 
1076
wire [7:0]  debug_track;
1077
 
1078
ocs_floppy ocs_floppy_inst(
1079
    .CLK_I                  (clk_30),
1080
    .reset_n                (management_reset_n),
1081
 
1082
    // On-Screen-Display management interface
1083
    .floppy_inserted        (floppy_inserted),
1084
    .floppy_sector          (floppy_sector),
1085
    .floppy_write_enabled   (floppy_write_enabled),
1086
    .floppy_error           (floppy_error),
1087
 
1088
    // WISHBONE master
1089
    .CYC_O                  (masterR5_cyc_o),
1090
    .STB_O                  (masterR5_stb_o),
1091
    .WE_O                   (masterR5_we_o),
1092
    .ADR_O                  (masterR5_adr_o),
1093
    .SEL_O                  (masterR5_sel_o),
1094
    .master_DAT_O           (masterR5_dat_o),
1095
    .master_DAT_I           (slave_dat_o),
1096
    .ACK_I                  (masterR5_ack_i),
1097
 
1098
    // WISHBONE slave for OCS registers
1099
    .CYC_I                  (slave11_cyc_i),
1100
    .STB_I                  (slave11_stb_i),
1101
    .WE_I                   (master_we_o),
1102
    .ADR_I                  (master_adr_o[8:2]),
1103
    .SEL_I                  (master_sel_o),
1104
    .slave_DAT_I            (master_dat_o),
1105
    .ACK_O                  (slave11_ack_o),
1106
 
1107
    // WISHBONE slave for floppy buffer
1108
    .buffer_CYC_I           (slave12_cyc_i),
1109
    .buffer_STB_I           (slave12_stb_i),
1110
    .buffer_WE_I            (master_we_o),
1111
    .buffer_ADR_I           (master_adr_o[13:2]),
1112
    .buffer_SEL_I           (master_sel_o),
1113
    .buffer_DAT_I           (master_dat_o),
1114
    .buffer_DAT_O           (slave12_dat_o),
1115
    .buffer_ACK_O           (slave12_ack_o),
1116
 
1117
    // Not aligned register access on a 32-bit WISHBONE bus
1118
        // DSKBYTR read not implemented here
1119
    .na_dskbytr_read        (na_dskbytr_read),
1120
    .na_dskbytr             (na_dskbytr),
1121
 
1122
    // Internal OCS ports
1123
    .line_start             (line_start),
1124
 
1125
    .dma_con                (dma_con), /*[10:0]*/
1126
    .adk_con                (adk_con), /*[14:0]*/
1127
 
1128
    .floppy_syn_irq         (floppy_syn_irq),
1129
    .floppy_blk_irq         (floppy_blk_irq),
1130
 
1131
    // Floppy CIA interface
1132
    .fl_rdy_n               (cia_a_pa_i[5]),
1133
    .fl_tk0_n               (cia_a_pa_i[4]),
1134
    .fl_wpro_n              (cia_a_pa_i[3]),
1135
    .fl_chng_n              (cia_a_pa_i[2]),
1136
    .fl_index_n             (cia_b_flag_n),
1137
 
1138
    .fl_mtr_n               (cia_b_pb[7]),
1139
    .fl_sel_n               (cia_b_pb[6:3]),
1140
    .fl_side_n              (cia_b_pb[2]),
1141
    .fl_dir                 (cia_b_pb[1]),
1142
    .fl_step_n              (cia_b_pb[0]),
1143
 
1144
    // Debug signals
1145
    .debug_floppy           (debug_floppy),
1146
    .debug_track            (debug_track)
1147
);
1148
 
1149
/***********************************************************************************************************************
1150
 * ocs_input
1151
 **********************************************************************************************************************/
1152
wire        sp_to_cia_a;
1153
wire        cnt_to_cia_a;
1154
 
1155
wire [15:0] na_pot0dat;
1156
wire        na_clx_dat_read;
1157
 
1158
wire        keyboard_ready;
1159
 
1160
ocs_input ocs_input_inst(
1161
    .CLK_I              (clk_30),
1162
    .reset_n            (management_reset_n),
1163
 
1164
    // On-Screen-Display management interface
1165
    .on_screen_display  (on_screen_display),
1166
    .enable_joystick_1  (joystick_enable),
1167
 
1168
    // WISHBONE slave
1169
    .CYC_I              (slave13_cyc_i),
1170
    .STB_I              (slave13_stb_i),
1171
    .WE_I               (master_we_o),
1172
    .ADR_I              (master_adr_o[8:2]),
1173
    .SEL_I              (master_sel_o),
1174
    .DAT_I              (master_dat_o),
1175
    .DAT_O              (slave13_dat_o),
1176
    .ACK_O              (slave13_ack_o),
1177
 
1178
    // Not aligned register access on a 32-bit WISHBONE bus
1179
        // CLXDAT read implemented here
1180
    .na_clx_dat_read    (na_clx_dat_read),
1181
    .na_clx_dat         (na_clx_dat),
1182
        // POT0DAT read not implemented here
1183
    .na_pot0dat_read    (na_pot0dat_read),
1184
    .na_pot0dat         (na_pot0dat),
1185
 
1186
    // User input CIA interface
1187
    // keyboard output
1188
    .sp_from_cia        (cia_a_sp_o),
1189
    .sp_to_cia          (sp_to_cia_a),
1190
    .cnt_to_cia         (cnt_to_cia_a),
1191
 
1192
    // CIA-A fire buttons
1193
    .ciaa_fire_0_n      (cia_a_pa_i[6]),
1194
    .ciaa_fire_1_n      (cia_a_pa_i[7]),
1195
 
1196
    // drv_keyboard interface
1197
    .keyboard_ready     (keyboard_ready),
1198
    .keyboard_event     (keyboard_event),
1199
    .keyboard_scancode  (keyboard_scancode), /*[8:0]*/
1200
 
1201
    // joystick on port 1
1202
    .joystick_1_up      (joystick_1_up),
1203
    .joystick_1_down    (joystick_1_down),
1204
    .joystick_1_left    (joystick_1_left),
1205
    .joystick_1_right   (joystick_1_right),
1206
    .joystick_1_fire    (joystick_1_fire),
1207
 
1208
    // drv_mouse interface
1209
    .mouse_moved        (mouse_moved),
1210
    .mouse_y_move       (mouse_y_move), /*[8:0]*/
1211
    .mouse_x_move       (mouse_x_move), /*[8:0]*/
1212
    .mouse_left_button  (mouse_left_button),
1213
    .mouse_right_button (mouse_right_button),
1214
    .mouse_middle_button(mouse_middle_button)
1215
);
1216
 
1217
/***********************************************************************************************************************
1218
 * ocs_audio
1219
 **********************************************************************************************************************/
1220
wire [5:0] volume0;
1221
wire [5:0] volume1;
1222
wire [5:0] volume2;
1223
wire [5:0] volume3;
1224
wire [7:0] sample0;
1225
wire [7:0] sample1;
1226
wire [7:0] sample2;
1227
wire [7:0] sample3;
1228
 
1229
wire [3:0] audio_irq;
1230
 
1231
ocs_audio ocs_audio_inst(
1232
    .CLK_I          (clk_30),
1233
    .reset_n        (management_reset_n),
1234
 
1235
    // WISHBONE master
1236
    .CYC_O          (masterR6_cyc_o),
1237
    .STB_O          (masterR6_stb_o),
1238
    .WE_O           (masterR6_we_o),
1239
    .ADR_O          (masterR6_adr_o),
1240
    .SEL_O          (masterR6_sel_o),
1241
    .master_DAT_I   (slave_dat_o),
1242
    .ACK_I          (masterR6_ack_i),
1243
 
1244
    // WISHBONE slave
1245
    .CYC_I          (slave14_cyc_i),
1246
    .STB_I          (slave14_stb_i),
1247
    .WE_I           (master_we_o),
1248
    .ADR_I          (master_adr_o[8:2]),
1249
    .SEL_I          (master_sel_o),
1250
    .slave_DAT_I    (master_dat_o),
1251
    .ACK_O          (slave14_ack_o),
1252
 
1253
    // Internal OCS ports
1254
    .pulse_color    (pulse_color),
1255
    .line_start     (line_start),
1256
 
1257
    .dma_con        (dma_con),
1258
    .adk_con        (adk_con),
1259
 
1260
    .audio_irq      (audio_irq),
1261
 
1262
    // drv_audio interface
1263
    .volume0        (volume0), /*[6:0]*/
1264
    .volume1        (volume1), /*[6:0]*/
1265
    .volume2        (volume2), /*[6:0]*/
1266
    .volume3        (volume3), /*[6:0]*/
1267
 
1268
    .sample0        (sample0), /*[7:0]*/
1269
    .sample1        (sample1), /*[7:0]*/
1270
    .sample2        (sample2), /*[7:0]*/
1271
    .sample3        (sample3)  /*[7:0]*/
1272
);
1273
 
1274
/***********************************************************************************************************************
1275
 * bus_syscon
1276
 **********************************************************************************************************************/
1277
 
1278
wire        masterP_cyc_o;
1279
wire        masterP_stb_o;
1280
wire        masterP_we_o;
1281
wire [31:2] masterP_adr_o;
1282
wire [3:0]  masterP_sel_o;
1283
wire [31:0] masterP_dat_o;
1284
wire        masterP_ack_i;
1285
wire        masterP_rty_i;
1286
wire        masterP_err_i;
1287
 
1288
wire        masterR1_cyc_o;
1289
wire        masterR1_stb_o;
1290
wire        masterR1_we_o;
1291
wire [31:2] masterR1_adr_o;
1292
wire [3:0]  masterR1_sel_o;
1293
wire [31:0] masterR1_dat_o;
1294
wire        masterR1_ack_i;
1295
wire        masterR1_rty_i;
1296
wire        masterR1_err_i;
1297
 
1298
wire        masterR2_cyc_o;
1299
wire        masterR2_stb_o;
1300
wire        masterR2_we_o;
1301
wire [31:2] masterR2_adr_o;
1302
wire [3:0]  masterR2_sel_o;
1303
wire [31:0] masterR2_dat_o;
1304
wire        masterR2_ack_i;
1305
wire        masterR2_rty_i;
1306
wire        masterR2_err_i;
1307
 
1308
wire        masterR3_cyc_o;
1309
wire        masterR3_stb_o;
1310
wire        masterR3_we_o;
1311
wire [31:2] masterR3_adr_o;
1312
wire [3:0]  masterR3_sel_o;
1313
wire [31:0] masterR3_dat_o;
1314
wire        masterR3_ack_i;
1315
wire        masterR3_rty_i;
1316
wire        masterR3_err_i;
1317
 
1318
wire        masterR4_cyc_o;
1319
wire        masterR4_stb_o;
1320
wire        masterR4_we_o;
1321
wire [31:2] masterR4_adr_o;
1322
wire [3:0]  masterR4_sel_o;
1323
wire [31:0] masterR4_dat_o;
1324
wire        masterR4_ack_i;
1325
wire        masterR4_rty_i;
1326
wire        masterR4_err_i;
1327
 
1328
wire        masterR5_cyc_o;
1329
wire        masterR5_stb_o;
1330
wire        masterR5_we_o;
1331
wire [31:2] masterR5_adr_o;
1332
wire [3:0]  masterR5_sel_o;
1333
wire [31:0] masterR5_dat_o;
1334
wire        masterR5_ack_i;
1335
wire        masterR5_rty_i;
1336
wire        masterR5_err_i;
1337
 
1338
wire        masterR6_cyc_o;
1339
wire        masterR6_stb_o;
1340
wire        masterR6_we_o;
1341
wire [31:2] masterR6_adr_o;
1342
wire [3:0]  masterR6_sel_o;
1343
wire [31:0] masterR6_dat_o;
1344
wire        masterR6_ack_i;
1345
wire        masterR6_rty_i;
1346
wire        masterR6_err_i;
1347
 
1348
wire        masterR7_cyc_o;
1349
wire        masterR7_stb_o;
1350
wire        masterR7_we_o;
1351
wire [31:2] masterR7_adr_o;
1352
wire [3:0]  masterR7_sel_o;
1353
wire [31:0] masterR7_dat_o;
1354
wire        masterR7_ack_i;
1355
wire        masterR7_rty_i;
1356
wire        masterR7_err_i;
1357
 
1358
wire [31:2] master_adr_o;
1359
wire        master_we_o;
1360
wire [3:0]  master_sel_o;
1361
wire [31:0] master_dat_o;
1362
wire [31:0] slave_dat_o;
1363
 
1364
wire [31:2] master_adr_early_o;
1365
 
1366
wire        slave0_ack_o;
1367
wire        slave0_rty_o;
1368
wire        slave0_err_o;
1369
wire [31:0] slave0_dat_o;
1370
wire        slave0_cyc_i;
1371
wire        slave0_stb_i;
1372
 
1373
wire        slave1_ack_o;
1374
wire        slave1_rty_o;
1375
wire        slave1_err_o;
1376
wire [31:0] slave1_dat_o;
1377
wire        slave1_cyc_i;
1378
wire        slave1_stb_i;
1379
 
1380
wire        slave2_ack_o;
1381
wire        slave2_rty_o    = 1'b0;
1382
wire        slave2_err_o    = 1'b0;
1383
wire [31:0] slave2_dat_o;
1384
wire        slave2_cyc_i;
1385
wire        slave2_stb_i;
1386
 
1387
wire        slave3_ack_o;
1388
wire        slave3_rty_o;
1389
wire        slave3_err_o;
1390
wire [31:0] slave3_dat_o;
1391
wire        slave3_cyc_i;
1392
wire        slave3_stb_i;
1393
 
1394
wire        slave4_ack_o;
1395
wire        slave4_rty_o    = 1'b0;
1396
wire        slave4_err_o    = 1'b0;
1397
wire [31:0] slave4_dat_o;
1398
wire        slave4_cyc_i;
1399
wire        slave4_stb_i;
1400
 
1401
wire        slave5_ack_o;
1402
wire        slave5_rty_o    = 1'b0;
1403
wire        slave5_err_o    = 1'b0;
1404
wire [31:0] slave5_dat_o;
1405
wire        slave5_cyc_i;
1406
wire        slave5_stb_i;
1407
 
1408
wire        slave6_ack_o;
1409
wire        slave6_rty_o    = 1'b0;
1410
wire        slave6_err_o    = 1'b0;
1411
wire [31:0] slave6_dat_o;
1412
wire        slave6_cyc_i;
1413
wire        slave6_stb_i;
1414
 
1415
wire        slave7_ack_o;
1416
wire        slave7_rty_o    = 1'b0;
1417
wire        slave7_err_o    = 1'b0;
1418
wire [31:0] slave7_dat_o;
1419
wire        slave7_cyc_i;
1420
wire        slave7_stb_i;
1421
 
1422
wire        slave8_ack_o;
1423
wire        slave8_rty_o    = 1'b0;
1424
wire        slave8_err_o    = 1'b0;
1425
wire [31:0] slave8_dat_o;
1426
wire        slave8_cyc_i;
1427
wire        slave8_stb_i;
1428
 
1429
wire        slave9_ack_o;
1430
wire        slave9_rty_o    = 1'b0;
1431
wire        slave9_err_o    = 1'b0;
1432
wire [31:0] slave9_dat_o;
1433
wire        slave9_cyc_i;
1434
wire        slave9_stb_i;
1435
 
1436
wire        slave10_ack_o;
1437
wire        slave10_rty_o   = 1'b0;
1438
wire        slave10_err_o   = 1'b0;
1439
wire [31:0] slave10_dat_o;
1440
wire        slave10_cyc_i;
1441
wire        slave10_stb_i;
1442
 
1443
wire        slave11_ack_o;
1444
wire        slave11_rty_o   = 1'b0;
1445
wire        slave11_err_o   = 1'b0;
1446
wire [31:0] slave11_dat_o;
1447
wire        slave11_cyc_i;
1448
wire        slave11_stb_i;
1449
 
1450
wire        slave12_ack_o;
1451
wire        slave12_rty_o   = 1'b0;
1452
wire        slave12_err_o   = 1'b0;
1453
wire [31:0] slave12_dat_o;
1454
wire        slave12_cyc_i;
1455
wire        slave12_stb_i;
1456
 
1457
wire        slave13_ack_o;
1458
wire        slave13_rty_o   = 1'b0;
1459
wire        slave13_err_o   = 1'b0;
1460
wire [31:0] slave13_dat_o;
1461
wire        slave13_cyc_i;
1462
wire        slave13_stb_i;
1463
 
1464
wire        slave14_ack_o;
1465
wire        slave14_rty_o   = 1'b0;
1466
wire        slave14_err_o   = 1'b0;
1467
wire [31:0] slave14_dat_o;
1468
wire        slave14_cyc_i;
1469
wire        slave14_stb_i;
1470
 
1471
wire        slave15_ack_o   = 1'b0;
1472
wire        slave15_rty_o   = 1'b0;
1473
wire        slave15_err_o   = 1'b0;
1474
wire [31:0] slave15_dat_o;
1475
wire        slave15_cyc_i;
1476
wire        slave15_stb_i;
1477
 
1478
wire [7:0]  debug_syscon;
1479
 
1480
bus_syscon syscon_inst(
1481
    .CLK_I              (clk_30),
1482
    .reset_n            (reset_n),
1483
    .halt_switch        (debug_sw3_halt),
1484
 
1485
    // Priority WISHBONE master interfaces
1486
    .masterP_cyc_o      (masterP_cyc_o),
1487
    .masterP_stb_o      (masterP_stb_o),
1488
    .masterP_we_o       (masterP_we_o),
1489
    .masterP_adr_o      (masterP_adr_o), /*[31:2]*/
1490
    .masterP_sel_o      (masterP_sel_o), /*[3:0]*/
1491
    .masterP_dat_o      (masterP_dat_o), /*[31:0]*/
1492
    .masterP_ack_i      (masterP_ack_i),
1493
    .masterP_rty_i      (masterP_rty_i),
1494
    .masterP_err_i      (masterP_err_i),
1495
 
1496
    // Round-robin WISHBONE master interfaces
1497
    .masterR1_cyc_o     (masterR1_cyc_o),
1498
    .masterR1_stb_o     (masterR1_stb_o),
1499
    .masterR1_we_o      (masterR1_we_o),
1500
    .masterR1_adr_o     (masterR1_adr_o), /*[31:2]*/
1501
    .masterR1_sel_o     (masterR1_sel_o), /*[3:0]*/
1502
    .masterR1_dat_o     (masterR1_dat_o), /*[31:0]*/
1503
    .masterR1_ack_i     (masterR1_ack_i),
1504
    .masterR1_rty_i     (masterR1_rty_i),
1505
    .masterR1_err_i     (masterR1_err_i),
1506
 
1507
    .masterR2_cyc_o     (masterR2_cyc_o),
1508
    .masterR2_stb_o     (masterR2_stb_o),
1509
    .masterR2_we_o      (masterR2_we_o),
1510
    .masterR2_adr_o     (masterR2_adr_o), /*[31:2]*/
1511
    .masterR2_sel_o     (masterR2_sel_o), /*[3:0]*/
1512
    .masterR2_dat_o     (masterR2_dat_o), /*[31:0]*/
1513
    .masterR2_ack_i     (masterR2_ack_i),
1514
    .masterR2_rty_i     (masterR2_rty_i),
1515
    .masterR2_err_i     (masterR2_err_i),
1516
 
1517
    .masterR3_cyc_o     (masterR3_cyc_o),
1518
    .masterR3_stb_o     (masterR3_stb_o),
1519
    .masterR3_we_o      (masterR3_we_o),
1520
    .masterR3_adr_o     (masterR3_adr_o), /*[31:2]*/
1521
    .masterR3_sel_o     (masterR3_sel_o), /*[3:0]*/
1522
    .masterR3_dat_o     (masterR3_dat_o), /*[31:0]*/
1523
    .masterR3_ack_i     (masterR3_ack_i),
1524
    .masterR3_rty_i     (masterR3_rty_i),
1525
    .masterR3_err_i     (masterR3_err_i),
1526
 
1527
    .masterR4_cyc_o     (masterR4_cyc_o),
1528
    .masterR4_stb_o     (masterR4_stb_o),
1529
    .masterR4_we_o      (masterR4_we_o),
1530
    .masterR4_adr_o     (masterR4_adr_o), /*[31:2]*/
1531
    .masterR4_sel_o     (masterR4_sel_o), /*[3:0]*/
1532
    .masterR4_dat_o     (masterR4_dat_o), /*[31:0]*/
1533
    .masterR4_ack_i     (masterR4_ack_i),
1534
    .masterR4_rty_i     (masterR4_rty_i),
1535
    .masterR4_err_i     (masterR4_err_i),
1536
 
1537
    .masterR5_cyc_o     (masterR5_cyc_o),
1538
    .masterR5_stb_o     (masterR5_stb_o),
1539
    .masterR5_we_o      (masterR5_we_o),
1540
    .masterR5_adr_o     (masterR5_adr_o), /*[31:2]*/
1541
    .masterR5_sel_o     (masterR5_sel_o), /*[3:0]*/
1542
    .masterR5_dat_o     (masterR5_dat_o), /*[31:0]*/
1543
    .masterR5_ack_i     (masterR5_ack_i),
1544
    .masterR5_rty_i     (masterR5_rty_i),
1545
    .masterR5_err_i     (masterR5_err_i),
1546
 
1547
    .masterR6_cyc_o     (masterR6_cyc_o),
1548
    .masterR6_stb_o     (masterR6_stb_o),
1549
    .masterR6_we_o      (masterR6_we_o),
1550
    .masterR6_adr_o     (masterR6_adr_o), /*[31:2]*/
1551
    .masterR6_sel_o     (masterR6_sel_o), /*[3:0]*/
1552
    .masterR6_dat_o     (masterR6_dat_o), /*[31:0]*/
1553
    .masterR6_ack_i     (masterR6_ack_i),
1554
    .masterR6_rty_i     (masterR6_rty_i),
1555
    .masterR6_err_i     (masterR6_err_i),
1556
 
1557
    .masterR7_cyc_o     (masterR7_cyc_o),
1558
    .masterR7_stb_o     (masterR7_stb_o),
1559
    .masterR7_we_o      (masterR7_we_o),
1560
    .masterR7_adr_o     (masterR7_adr_o), /*[31:2]*/
1561
    .masterR7_sel_o     (masterR7_sel_o), /*[3:0]*/
1562
    .masterR7_dat_o     (masterR7_dat_o), /*[31:0]*/
1563
    .masterR7_ack_i     (masterR7_ack_i),
1564
    .masterR7_rty_i     (masterR7_rty_i),
1565
    .masterR7_err_i     (masterR7_err_i),
1566
 
1567
    // Common WISHBONE master signals
1568
    .master_adr_o       (master_adr_o),       /*[31:2]*/
1569
    .master_we_o        (master_we_o),
1570
    .master_sel_o       (master_sel_o),       /*[3:0]*/
1571
    .master_dat_o       (master_dat_o),       /*[31:0]*/
1572
    .slave_dat_o        (slave_dat_o),        /*[31:0]*/
1573
 
1574
    // AND/OR master address mask signals
1575
    .master_adr_early_o (master_adr_early_o), /*[31:2]*/
1576
    .master_adr_and_mask(
1577
        ({master_adr_early_o, 2'b00} >= 32'h00000000 && {master_adr_early_o, 2'b00} <= 32'h001FFFFC && management_mode == 1'b0) ?
1578
                        30'b0000_0000_0000_1111_1111_1111_1111_11 :
1579
        (({master_adr_early_o, 2'b00} >= 32'h10100000 && {master_adr_early_o, 2'b00} <= 32'h101BFFFC) ||
1580
         ({master_adr_early_o, 2'b00} >= 32'h00FC0000 && {master_adr_early_o, 2'b00} <= 32'h00FFFFFC) ) ?
1581
                        30'b0000_0000_0001_1111_1111_1111_1111_11 :
1582
                        30'b1111_1111_1111_1111_1111_1111_1111_11
1583
    ),
1584
    .master_adr_or_mask(
1585
        ({master_adr_early_o, 2'b00} >= 32'h00000000 && {master_adr_early_o, 2'b00} <= 32'h001FFFFC && management_mode == 1'b0 && cia_a_pa[0] == 1'b1) ?
1586
                        30'b0000_0000_0001_1100_0000_0000_0000_00 :
1587
                        30'b0000_0000_0000_0000_0000_0000_0000_00
1588
    ),
1589
 
1590
    // WISHBONE slave interfaces
1591
    // bus_terminator
1592
    .slave0_cyc_i(slave0_cyc_i),
1593
    .slave0_stb_i(slave0_stb_i),
1594
    .slave0_ack_o(slave0_ack_o),
1595
    .slave0_rty_o(slave0_rty_o),
1596
    .slave0_err_o(slave0_err_o),
1597
    .slave0_dat_o(slave0_dat_o), /*[31:0]*/
1598
 
1599
    // bus_sd
1600
    .slave1_selected    (
1601
        {master_adr_early_o, 2'b00} >= 32'h10001000 && {master_adr_early_o, 2'b00} <= 32'h1000100F
1602
    ),
1603
    .slave1_cyc_i       (slave1_cyc_i),
1604
    .slave1_stb_i       (slave1_stb_i),
1605
    .slave1_ack_o       (slave1_ack_o),
1606
    .slave1_rty_o       (slave1_rty_o),
1607
    .slave1_err_o       (slave1_err_o),
1608
    .slave1_dat_o       (slave1_dat_o), /*[31:0]*/
1609
 
1610
    // bus_ssram
1611
    .slave2_selected    (
1612
        ({master_adr_early_o, 2'b00} >= 32'h00000000 && {master_adr_early_o, 2'b00} <= 32'h001FFFFC) ||
1613
        ({master_adr_early_o, 2'b00} >= 32'h10100000 && {master_adr_early_o, 2'b00} <= 32'h101BFFFC) ||
1614
        ({master_adr_early_o, 2'b00} >= 32'h00FC0000 && {master_adr_early_o, 2'b00} <= 32'h00FFFFFC)
1615
    ),
1616
    .slave2_cyc_i       (slave2_cyc_i),
1617
    .slave2_stb_i       (slave2_stb_i),
1618
    .slave2_ack_o       (slave2_ack_o),
1619
    .slave2_rty_o       (slave2_rty_o),
1620
    .slave2_err_o       (slave2_err_o),
1621
    .slave2_dat_o       (slave2_dat_o), /*[31:0]*/
1622
 
1623
    // control_osd
1624
    .slave3_selected    (
1625
        {master_adr_early_o, 2'b00} >= 32'h10000000 && {master_adr_early_o, 2'b00} <= 32'h10000FFF
1626
    ),
1627
    .slave3_cyc_i       (slave3_cyc_i),
1628
    .slave3_stb_i       (slave3_stb_i),
1629
    .slave3_ack_o       (slave3_ack_o),
1630
    .slave3_rty_o       (slave3_rty_o),
1631
    .slave3_err_o       (slave3_err_o),
1632
    .slave3_dat_o       (slave3_dat_o), /*[31:0]*/
1633
 
1634
    // ocs_video: 08C-09B, 100-10B, 0E0-0F7, 120-1BF, 110-11B
1635
    .slave4_selected    ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1636
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h08C && {master_adr_early_o[8:2], 2'b00} <= 9'h098 ) ||
1637
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h100 && {master_adr_early_o[8:2], 2'b00} <= 9'h108 ) ||
1638
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h0E0 && {master_adr_early_o[8:2], 2'b00} <= 9'h0F4 ) ||
1639
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h110 && {master_adr_early_o[8:2], 2'b00} <= 9'h118 ) ||
1640
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h120 && {master_adr_early_o[8:2], 2'b00} <= 9'h1BC ) )
1641
    ),
1642
    .slave4_cyc_i       (slave4_cyc_i),
1643
    .slave4_stb_i       (slave4_stb_i),
1644
    .slave4_ack_o       (slave4_ack_o),
1645
    .slave4_rty_o       (slave4_rty_o),
1646
    .slave4_err_o       (slave4_err_o),
1647
    .slave4_dat_o       (slave4_dat_o), /*[31:0]*/
1648
 
1649
    // ocs_control: 000-007 R, 09C-09F, 010-013 R, 01C-01F R, 028-02B
1650
    .slave5_selected    ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1651
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h000 && {master_adr_early_o[8:2], 2'b00} <= 9'h004 ) ||
1652
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h09C && {master_adr_early_o[8:2], 2'b00} <= 9'h09C ) ||
1653
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h010 && {master_adr_early_o[8:2], 2'b00} <= 9'h010 ) ||
1654
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h01C && {master_adr_early_o[8:2], 2'b00} <= 9'h01C ) ||
1655
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h028 && {master_adr_early_o[8:2], 2'b00} <= 9'h028 ) )
1656
    ),
1657
    .slave5_cyc_i       (slave5_cyc_i),
1658
    .slave5_stb_i       (slave5_stb_i),
1659
    .slave5_ack_o       (slave5_ack_o),
1660
    .slave5_rty_o       (slave5_rty_o),
1661
    .slave5_err_o       (slave5_err_o),
1662
    .slave5_dat_o       (slave5_dat_o), /*[31:0]*/
1663
 
1664
    // ocs_blitter: 040-059, 060-067, 070-075 
1665
    .slave6_selected    ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1666
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h040 && {master_adr_early_o[8:2], 2'b00} <= 9'h058 ) ||
1667
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h060 && {master_adr_early_o[8:2], 2'b00} <= 9'h064 ) ||
1668
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h070 && {master_adr_early_o[8:2], 2'b00} <= 9'h074 ) )
1669
    ),
1670
    .slave6_cyc_i       (slave6_cyc_i),
1671
    .slave6_stb_i       (slave6_stb_i),
1672
    .slave6_ack_o       (slave6_ack_o),
1673
    .slave6_rty_o       (slave6_rty_o),
1674
    .slave6_err_o       (slave6_err_o),
1675
    .slave6_dat_o       (slave6_dat_o), /*[31:0]*/
1676
 
1677
    // ocs_copper: 02C-02F, 080-08B
1678
    .slave7_selected    ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1679
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h02C && {master_adr_early_o[8:2], 2'b00} <= 9'h02C ) ||
1680
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h080 && {master_adr_early_o[8:2], 2'b00} <= 9'h088 ) )
1681
    ),
1682
    .slave7_cyc_i       (slave7_cyc_i),
1683
    .slave7_stb_i       (slave7_stb_i),
1684
    .slave7_ack_o       (slave7_ack_o),
1685
    .slave7_rty_o       (slave7_rty_o),
1686
    .slave7_err_o       (slave7_err_o),
1687
    .slave7_dat_o       (slave7_dat_o), /*[31:0]*/
1688
 
1689
    // cia-a: 0000_0000_101*_****_**10_****_****_****
1690
    .slave8_selected    (
1691
        master_adr_early_o[31:21] == 11'b0000_0000_101 && master_adr_early_o[13:12] == 2'b10
1692
    ),
1693
    .slave8_cyc_i       (slave8_cyc_i),
1694
    .slave8_stb_i       (slave8_stb_i),
1695
    .slave8_ack_o       (slave8_ack_o),
1696
    .slave8_rty_o       (slave8_rty_o),
1697
    .slave8_err_o       (slave8_err_o),
1698
    .slave8_dat_o       (slave8_dat_o), /*[31:0]*/
1699
 
1700
    // cia-b: 0000_0000_101*_****_**01_****_****_****
1701
    .slave9_selected    (
1702
        master_adr_early_o[31:21] == 11'b0000_0000_101 && master_adr_early_o[13:12] == 2'b01
1703
    ),
1704
    .slave9_cyc_i       (slave9_cyc_i),
1705
    .slave9_stb_i       (slave9_stb_i),
1706
    .slave9_ack_o       (slave9_ack_o),
1707
    .slave9_rty_o       (slave9_rty_o),
1708
    .slave9_err_o       (slave9_err_o),
1709
    .slave9_dat_o       (slave9_dat_o), /*[31:0]*/
1710
 
1711
    // ocs_serial: 018-01B R, 030-033
1712
    .slave10_selected   ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1713
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h018 && {master_adr_early_o[8:2], 2'b00} <= 9'h018 ) ||
1714
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h030 && {master_adr_early_o[8:2], 2'b00} <= 9'h030 ) )
1715
    ),
1716
    .slave10_cyc_i      (slave10_cyc_i),
1717
    .slave10_stb_i      (slave10_stb_i),
1718
    .slave10_ack_o      (slave10_ack_o),
1719
    .slave10_rty_o      (slave10_rty_o),
1720
    .slave10_err_o      (slave10_err_o),
1721
    .slave10_dat_o      (slave10_dat_o), /*[31:0]*/
1722
 
1723
    // ocs_floppy: 020-027, 07C-07F
1724
    .slave11_selected   ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1725
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h020 && {master_adr_early_o[8:2], 2'b00} <= 9'h027 ) ||
1726
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h07C && {master_adr_early_o[8:2], 2'b00} <= 9'h07F ) )
1727
    ),
1728
    .slave11_cyc_i      (slave11_cyc_i),
1729
    .slave11_stb_i      (slave11_stb_i),
1730
    .slave11_ack_o      (slave11_ack_o),
1731
    .slave11_rty_o      (slave11_rty_o),
1732
    .slave11_err_o      (slave11_err_o),
1733
    .slave11_dat_o      (slave11_dat_o), /*[31:0]*/
1734
 
1735
    // ocs_floppy memory buffer: 0x10004000 - 0x100055FF
1736
    .slave12_selected   (
1737
        {master_adr_early_o[31:2], 2'b00} >= 32'h10004000 && {master_adr_early_o[31:2], 2'b00} <= 32'h100055FF
1738
    ),
1739
    .slave12_cyc_i      (slave12_cyc_i),
1740
    .slave12_stb_i      (slave12_stb_i),
1741
    .slave12_ack_o      (slave12_ack_o),
1742
    .slave12_rty_o      (slave12_rty_o),
1743
    .slave12_err_o      (slave12_err_o),
1744
    .slave12_dat_o      (slave12_dat_o), /*[31:0]*/
1745
 
1746
    // ocs_input: 008-00F R, 014-017 R, 034-037
1747
    .slave13_selected   ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1748
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h008 && {master_adr_early_o[8:2], 2'b00} <= 9'h00F ) ||
1749
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h014 && {master_adr_early_o[8:2], 2'b00} <= 9'h017 ) ||
1750
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h034 && {master_adr_early_o[8:2], 2'b00} <= 9'h037 ) )
1751
    ),
1752
    .slave13_cyc_i      (slave13_cyc_i),
1753
    .slave13_stb_i      (slave13_stb_i),
1754
    .slave13_ack_o      (slave13_ack_o),
1755
    .slave13_rty_o      (slave13_rty_o),
1756
    .slave13_err_o      (slave13_err_o),
1757
    .slave13_dat_o      (slave13_dat_o), /*[31:0]*/
1758
 
1759
    // ocs_audio: 0A0-0AB, 0B0-0BB, 0C0-0CB, 0D0-0DB
1760
    .slave14_selected   ( master_adr_early_o[31:21] == 11'b0000_0000_110 && (
1761
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h0A0 && {master_adr_early_o[8:2], 2'b00} <= 9'h0AB ) ||
1762
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h0B0 && {master_adr_early_o[8:2], 2'b00} <= 9'h0BB ) ||
1763
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h0C0 && {master_adr_early_o[8:2], 2'b00} <= 9'h0CB ) ||
1764
        ( {master_adr_early_o[8:2], 2'b00} >= 9'h0D0 && {master_adr_early_o[8:2], 2'b00} <= 9'h0DB ) )
1765
    ),
1766
    .slave14_cyc_i      (slave14_cyc_i),
1767
    .slave14_stb_i      (slave14_stb_i),
1768
    .slave14_ack_o      (slave14_ack_o),
1769
    .slave14_rty_o      (slave14_rty_o),
1770
    .slave14_err_o      (slave14_err_o),
1771
    .slave14_dat_o      (slave14_dat_o), /*[31:0]*/
1772
 
1773
    // not used
1774
    .slave15_selected   (
1775
        1'b0
1776
    ),
1777
    .slave15_cyc_i      (slave15_cyc_i),
1778
    .slave15_stb_i      (slave15_stb_i),
1779
    .slave15_ack_o      (slave15_ack_o),
1780
    .slave15_rty_o      (slave15_rty_o),
1781
    .slave15_err_o      (slave15_err_o),
1782
    .slave15_dat_o      (slave15_dat_o), /*[31:0]*/
1783
 
1784
    // Debug signals
1785
    .debug_syscon       (debug_syscon)
1786
);
1787
 
1788
endmodule
1789
 

powered by: WebSVN 2.1.0

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