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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [rtl/] [verilog/] [minsoc_top.v] - Blame information for rev 55

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

Line No. Rev Author Line
1 2 rfajardo
`include "minsoc_defines.v"
2
`include "or1200_defines.v"
3
 
4
module minsoc_top (
5
   clk,reset
6
 
7
   //JTAG ports
8
`ifdef GENERIC_TAP
9
   , jtag_tdi,jtag_tms,jtag_tck,
10
   jtag_tdo,jtag_vref,jtag_gnd
11
`endif
12
 
13
   //SPI ports
14
`ifdef START_UP
15
   , spi_flash_mosi, spi_flash_miso, spi_flash_sclk, spi_flash_ss
16
`endif
17
 
18
   //UART ports
19
`ifdef UART
20
   , uart_stx,uart_srx
21
`endif
22
 
23
        // Ethernet ports
24
`ifdef ETHERNET
25
        , eth_col, eth_crs, eth_trste, eth_tx_clk,
26
        eth_tx_en, eth_tx_er, eth_txd, eth_rx_clk,
27
        eth_rx_dv, eth_rx_er, eth_rxd, eth_fds_mdint,
28
        eth_mdc, eth_mdio
29
`endif
30
);
31
 
32
//
33
// I/O Ports
34
//
35
 
36
   input         clk;
37
   input         reset;
38
 
39
//
40
// SPI controller external i/f wires
41
//
42
`ifdef START_UP
43
output spi_flash_mosi;
44
input spi_flash_miso;
45
output spi_flash_sclk;
46
output [1:0] spi_flash_ss;
47
`endif
48
 
49
//
50
// UART
51
//
52
`ifdef UART
53
   output        uart_stx;
54
   input         uart_srx;
55
`endif
56
 
57
//
58
// Ethernet
59
//
60
`ifdef ETHERNET
61
output                  eth_tx_er;
62
input                   eth_tx_clk;
63
output                  eth_tx_en;
64
output  [3:0]            eth_txd;
65
input                   eth_rx_er;
66
input                   eth_rx_clk;
67
input                   eth_rx_dv;
68
input   [3:0]            eth_rxd;
69
input                   eth_col;
70
input                   eth_crs;
71
output                  eth_trste;
72
input                   eth_fds_mdint;
73
inout                   eth_mdio;
74
output                  eth_mdc;
75
`endif
76
 
77
//
78
// JTAG
79
//
80
`ifdef GENERIC_TAP
81
   input         jtag_tdi;
82
   input         jtag_tms;
83
   input         jtag_tck;
84
   output        jtag_tdo;
85
   output        jtag_vref;
86
   output        jtag_gnd;
87
 
88
 
89
assign jtag_vref = 1'b1;
90
assign jtag_gnd = 1'b0;
91
`endif
92
 
93
wire rstn;
94
 
95 7 rfajardo
`ifdef POSITIVE_RESET
96 2 rfajardo
assign rstn = ~reset;
97 7 rfajardo
`elsif NEGATIVE_RESET
98
assign rstn = reset;
99
`endif
100 2 rfajardo
 
101
//
102
// Internal wires
103
//
104
 
105
//
106
// Debug core master i/f wires
107
//
108
wire    [31:0]           wb_dm_adr_o;
109
wire    [31:0]           wb_dm_dat_i;
110
wire    [31:0]           wb_dm_dat_o;
111
wire    [3:0]            wb_dm_sel_o;
112
wire                    wb_dm_we_o;
113
wire                    wb_dm_stb_o;
114
wire                    wb_dm_cyc_o;
115
wire                    wb_dm_ack_i;
116
wire                    wb_dm_err_i;
117
 
118
//
119
// Debug <-> RISC wires
120
//
121
wire    [3:0]            dbg_lss;
122
wire    [1:0]            dbg_is;
123
wire    [10:0]           dbg_wp;
124
wire                    dbg_bp;
125
wire    [31:0]           dbg_dat_dbg;
126
wire    [31:0]           dbg_dat_risc;
127
wire    [31:0]           dbg_adr;
128
wire                    dbg_ewt;
129
wire                    dbg_stall;
130 20 rfajardo
wire            dbg_we;
131
wire            dbg_stb;
132
wire            dbg_ack;
133 2 rfajardo
 
134
//
135
// RISC instruction master i/f wires
136
//
137
wire    [31:0]           wb_rim_adr_o;
138
wire                    wb_rim_cyc_o;
139
wire    [31:0]           wb_rim_dat_i;
140
wire    [31:0]           wb_rim_dat_o;
141
wire    [3:0]            wb_rim_sel_o;
142
wire                    wb_rim_ack_i;
143
wire                    wb_rim_err_i;
144
wire                    wb_rim_rty_i = 1'b0;
145
wire                    wb_rim_we_o;
146
wire                    wb_rim_stb_o;
147
wire    [31:0]           wb_rif_dat_i;
148
wire                    wb_rif_ack_i;
149
 
150
//
151
// RISC data master i/f wires
152
//
153
wire    [31:0]           wb_rdm_adr_o;
154
wire                    wb_rdm_cyc_o;
155
wire    [31:0]           wb_rdm_dat_i;
156
wire    [31:0]           wb_rdm_dat_o;
157
wire    [3:0]            wb_rdm_sel_o;
158
wire                    wb_rdm_ack_i;
159
wire                    wb_rdm_err_i;
160
wire                    wb_rdm_rty_i = 1'b0;
161
wire                    wb_rdm_we_o;
162
wire                    wb_rdm_stb_o;
163
 
164
//
165
// RISC misc
166
//
167 31 rfajardo
wire    [`OR1200_PIC_INTS-1:0]           pic_ints;
168 2 rfajardo
 
169
//
170
// Flash controller slave i/f wires
171
//
172
wire    [31:0]           wb_fs_dat_i;
173
wire    [31:0]           wb_fs_dat_o;
174
wire    [31:0]           wb_fs_adr_i;
175
wire    [3:0]            wb_fs_sel_i;
176
wire                    wb_fs_we_i;
177
wire                    wb_fs_cyc_i;
178
wire                    wb_fs_stb_i;
179
wire                    wb_fs_ack_o;
180
wire                    wb_fs_err_o;
181
 
182
//
183
// SPI controller slave i/f wires
184
//
185
wire    [31:0]           wb_sp_dat_i;
186
wire    [31:0]           wb_sp_dat_o;
187
wire    [31:0]           wb_sp_adr_i;
188
wire    [3:0]            wb_sp_sel_i;
189
wire                    wb_sp_we_i;
190
wire                    wb_sp_cyc_i;
191
wire                    wb_sp_stb_i;
192
wire                    wb_sp_ack_o;
193
wire                    wb_sp_err_o;
194
 
195
//
196
// SPI controller external i/f wires
197
//
198
wire spi_flash_mosi;
199
wire spi_flash_miso;
200
wire spi_flash_sclk;
201
wire [1:0] spi_flash_ss;
202
 
203
//
204
// SRAM controller slave i/f wires
205
//
206
wire    [31:0]           wb_ss_dat_i;
207
wire    [31:0]           wb_ss_dat_o;
208
wire    [31:0]           wb_ss_adr_i;
209
wire    [3:0]            wb_ss_sel_i;
210
wire                    wb_ss_we_i;
211
wire                    wb_ss_cyc_i;
212
wire                    wb_ss_stb_i;
213
wire                    wb_ss_ack_o;
214
wire                    wb_ss_err_o;
215
 
216
//
217
// Ethernet core master i/f wires
218
//
219
wire    [31:0]           wb_em_adr_o;
220
wire    [31:0]           wb_em_dat_i;
221
wire    [31:0]           wb_em_dat_o;
222
wire    [3:0]            wb_em_sel_o;
223
wire                    wb_em_we_o;
224
wire                    wb_em_stb_o;
225
wire                    wb_em_cyc_o;
226
wire                    wb_em_ack_i;
227
wire                    wb_em_err_i;
228
 
229
//
230
// Ethernet core slave i/f wires
231
//
232
wire    [31:0]           wb_es_dat_i;
233
wire    [31:0]           wb_es_dat_o;
234
wire    [31:0]           wb_es_adr_i;
235
wire    [3:0]            wb_es_sel_i;
236
wire                    wb_es_we_i;
237
wire                    wb_es_cyc_i;
238
wire                    wb_es_stb_i;
239
wire                    wb_es_ack_o;
240
wire                    wb_es_err_o;
241
 
242
//
243
// Ethernet external i/f wires
244
//
245
wire                    eth_mdo;
246
wire                    eth_mdoe;
247
 
248
//
249
// UART16550 core slave i/f wires
250
//
251
wire    [31:0]           wb_us_dat_i;
252
wire    [31:0]           wb_us_dat_o;
253
wire    [31:0]           wb_us_adr_i;
254
wire    [3:0]            wb_us_sel_i;
255
wire                    wb_us_we_i;
256
wire                    wb_us_cyc_i;
257
wire                    wb_us_stb_i;
258
wire                    wb_us_ack_o;
259
wire                    wb_us_err_o;
260
 
261
//
262
// UART external i/f wires
263
//
264
wire                    uart_stx;
265
wire                    uart_srx;
266
 
267
//
268
// Reset debounce
269
//
270
reg                     rst_r;
271
reg                     wb_rst;
272
 
273
//
274
// Global clock
275
//
276
wire                    wb_clk;
277
 
278
//
279
// Reset debounce
280
//
281
always @(posedge wb_clk or negedge rstn)
282
        if (~rstn)
283
                rst_r <= 1'b1;
284
        else
285
                rst_r <= #1 1'b0;
286
 
287
//
288
// Reset debounce
289
//
290
always @(posedge wb_clk)
291
        wb_rst <= #1 rst_r;
292
 
293
//
294 7 rfajardo
// Clock Divider
295 2 rfajardo
//
296
minsoc_clock_manager #
297
(
298 52 javieralso
   .divisor(`CLOCK_DIVISOR),
299
   .multiplier(`CLOCK_MULTIPLIER)
300 2 rfajardo
)
301
clk_adjust (
302
        .clk_i(clk),
303
        .clk_o(wb_clk)
304
);
305
 
306
//
307
// Unused WISHBONE signals
308
//
309
assign wb_us_err_o = 1'b0;
310
assign wb_fs_err_o = 1'b0;
311
assign wb_sp_err_o = 1'b0;
312
 
313
//
314
// Unused interrupts
315
//
316
assign pic_ints[`APP_INT_RES1] = 'b0;
317
assign pic_ints[`APP_INT_RES2] = 'b0;
318
assign pic_ints[`APP_INT_RES3] = 'b0;
319
assign pic_ints[`APP_INT_PS2] = 'b0;
320
 
321
//
322
// Ethernet tri-state
323
//
324
`ifdef ETHERNET
325
assign eth_mdio = eth_mdoe ? eth_mdo : 1'bz;
326
assign eth_trste = `ETH_RESET;
327
`endif
328
 
329
 
330
//
331
// RISC Instruction address for Flash
332
//
333
// Until first access to real Flash area,
334
// CPU instruction is fixed to jump to the Flash area.
335
// After Flash area is accessed, CPU instructions 
336
// come from the tc_top (wishbone "switch").
337
//
338
`ifdef START_UP
339
reg jump_flash;
340
reg [3:0] rif_counter;
341
reg [31:0] rif_dat_int;
342
reg rif_ack_int;
343
 
344
always @(posedge wb_clk or negedge rstn)
345
begin
346
        if (!rstn) begin
347
                jump_flash <= #1 1'b1;
348
                rif_counter <= 4'h0;
349
                rif_ack_int <= 1'b0;
350
        end
351
        else begin
352
                rif_ack_int <= 1'b0;
353
 
354
                if (wb_rim_cyc_o && (wb_rim_adr_o[31:32-`APP_ADDR_DEC_W] == `APP_ADDR_FLASH))
355
                        jump_flash <= #1 1'b0;
356
 
357
                if ( jump_flash == 1'b1 ) begin
358 33 rfajardo
                        if ( wb_rim_cyc_o && wb_rim_stb_o && ~wb_rim_we_o )
359
                                rif_ack_int <= 1'b1;
360
 
361
            if ( rif_ack_int == 1'b1 ) begin
362 2 rfajardo
                                rif_counter <= rif_counter + 1'b1;
363 33 rfajardo
                                rif_ack_int <= 1'b0;
364
            end
365 2 rfajardo
                end
366
        end
367
end
368
 
369
always @ (rif_counter)
370
begin
371
        case ( rif_counter )
372
                4'h0: rif_dat_int = { `OR1200_OR32_MOVHI , 5'h01 , 4'h0 , 1'b0 , `APP_ADDR_FLASH , 8'h00 };
373
                4'h1: rif_dat_int = { `OR1200_OR32_ORI , 5'h01 , 5'h01 , 16'h0000 };
374
                4'h2: rif_dat_int = { `OR1200_OR32_JR , 10'h000 , 5'h01 , 11'h000 };
375
                4'h3: rif_dat_int = { `OR1200_OR32_NOP , 10'h000 , 16'h0000 };
376
                default: rif_dat_int = 32'h0000_0000;
377
        endcase
378
end
379
 
380
assign wb_rif_dat_i = jump_flash ? rif_dat_int : wb_rim_dat_i;
381
 
382
assign wb_rif_ack_i = jump_flash ? rif_ack_int : wb_rim_ack_i;
383
 
384
`else
385
assign wb_rif_dat_i = wb_rim_dat_i;
386
assign wb_rif_ack_i = wb_rim_ack_i;
387
`endif
388
 
389
 
390
//
391
// TAP<->dbg_interface
392
//      
393
wire jtag_tck;
394
wire debug_tdi;
395
wire debug_tdo;
396
wire capture_dr;
397
wire shift_dr;
398
wire pause_dr;
399
wire update_dr;
400
 
401
wire debug_select;
402
wire test_logic_reset;
403
 
404
//
405
// Instantiation of the development i/f
406
//
407
adbg_top dbg_top  (
408
 
409
        // JTAG pins
410
      .tck_i    ( jtag_tck ),
411
      .tdi_i    ( debug_tdi ),
412
      .tdo_o    ( debug_tdo ),
413
      .rst_i    ( test_logic_reset ),           //cable without rst
414
 
415
        // Boundary Scan signals
416
      .capture_dr_i ( capture_dr ),
417
      .shift_dr_i  ( shift_dr ),
418
      .pause_dr_i  ( pause_dr ),
419
      .update_dr_i ( update_dr ),
420
 
421
      .debug_select_i( debug_select ),
422
        // WISHBONE common
423
      .wb_clk_i   ( wb_clk ),
424
 
425
      // WISHBONE master interface
426
      .wb_adr_o  ( wb_dm_adr_o ),
427
      .wb_dat_i  ( wb_dm_dat_i ),
428
      .wb_dat_o  ( wb_dm_dat_o ),
429
      .wb_sel_o  ( wb_dm_sel_o ),
430
      .wb_we_o   ( wb_dm_we_o  ),
431
      .wb_stb_o  ( wb_dm_stb_o ),
432
      .wb_cyc_o  ( wb_dm_cyc_o ),
433
      .wb_ack_i  ( wb_dm_ack_i ),
434
      .wb_err_i  ( wb_dm_err_i ),
435
      .wb_cti_o  ( ),
436
      .wb_bte_o  ( ),
437
 
438
      // RISC signals
439
      .cpu0_clk_i  ( wb_clk ),
440
      .cpu0_addr_o ( dbg_adr ),
441
      .cpu0_data_i ( dbg_dat_risc ),
442
      .cpu0_data_o ( dbg_dat_dbg ),
443
      .cpu0_bp_i   ( dbg_bp ),
444
      .cpu0_stall_o( dbg_stall ),
445 20 rfajardo
      .cpu0_stb_o  ( dbg_stb ),
446
      .cpu0_we_o   ( dbg_we ),
447 2 rfajardo
      .cpu0_ack_i  ( dbg_ack ),
448
      .cpu0_rst_o  ( )
449
 
450
);
451
 
452
//
453
// JTAG TAP controller instantiation
454
//
455
`ifdef GENERIC_TAP
456
tap_top tap_top(
457
         // JTAG pads
458
         .tms_pad_i(jtag_tms),
459
         .tck_pad_i(jtag_tck),
460
         .trstn_pad_i(rstn),
461
         .tdi_pad_i(jtag_tdi),
462
         .tdo_pad_o(jtag_tdo),
463
         .tdo_padoe_o( ),
464
 
465
         // TAP states
466
         .test_logic_reset_o( test_logic_reset ),
467
         .run_test_idle_o(),
468
         .shift_dr_o(shift_dr),
469
         .pause_dr_o(pause_dr),
470
         .update_dr_o(update_dr),
471
         .capture_dr_o(capture_dr),
472
 
473
         // Select signals for boundary scan or mbist
474
         .extest_select_o(),
475
         .sample_preload_select_o(),
476
         .mbist_select_o(),
477
         .debug_select_o(debug_select),
478
 
479
         // TDO signal that is connected to TDI of sub-modules.
480
         .tdi_o(debug_tdi),
481
 
482
         // TDI signals from sub-modules
483
         .debug_tdo_i(debug_tdo),    // from debug module
484
         .bs_chain_tdo_i(1'b0), // from Boundary Scan Chain
485
         .mbist_tdo_i(1'b0)     // from Mbist Chain
486
);
487
`elsif FPGA_TAP
488
`ifdef ALTERA_FPGA
489
altera_virtual_jtag tap_top(
490
        .tck_o(jtag_tck),
491 26 rfajardo
        .debug_tdo_i(debug_tdo),
492 2 rfajardo
        .tdi_o(debug_tdi),
493
        .test_logic_reset_o(test_logic_reset),
494
        .run_test_idle_o(),
495
        .shift_dr_o(shift_dr),
496
        .capture_dr_o(capture_dr),
497
        .pause_dr_o(pause_dr),
498
        .update_dr_o(update_dr),
499
        .debug_select_o(debug_select)
500
);
501
`elsif XILINX_FPGA
502
minsoc_xilinx_internal_jtag tap_top(
503
        .tck_o( jtag_tck ),
504
        .debug_tdo_i( debug_tdo ),
505
        .tdi_o( debug_tdi ),
506
 
507
        .test_logic_reset_o( test_logic_reset ),
508
        .run_test_idle_o( ),
509
 
510
        .shift_dr_o( shift_dr ),
511
        .capture_dr_o( capture_dr ),
512
        .pause_dr_o( pause_dr ),
513
        .update_dr_o( update_dr ),
514
        .debug_select_o( debug_select )
515
);
516
`endif // !FPGA_TAP
517
 
518
`endif // !GENERIC_TAP
519
 
520
//
521
// Instantiation of the OR1200 RISC
522
//
523
or1200_top or1200_top (
524
 
525
        // Common
526
        .rst_i          ( wb_rst ),
527
        .clk_i          ( wb_clk ),
528
`ifdef OR1200_CLMODE_1TO2
529
        .clmode_i       ( 2'b01 ),
530
`else
531
`ifdef OR1200_CLMODE_1TO4
532
        .clmode_i       ( 2'b11 ),
533
`else
534
        .clmode_i       ( 2'b00 ),
535
`endif
536
`endif
537
 
538
        // WISHBONE Instruction Master
539
        .iwb_clk_i      ( wb_clk ),
540
        .iwb_rst_i      ( wb_rst ),
541
        .iwb_cyc_o      ( wb_rim_cyc_o ),
542
        .iwb_adr_o      ( wb_rim_adr_o ),
543
        .iwb_dat_i      ( wb_rif_dat_i ),
544
        .iwb_dat_o      ( wb_rim_dat_o ),
545
        .iwb_sel_o      ( wb_rim_sel_o ),
546
        .iwb_ack_i      ( wb_rif_ack_i ),
547
        .iwb_err_i      ( wb_rim_err_i ),
548
        .iwb_rty_i      ( wb_rim_rty_i ),
549
        .iwb_we_o       ( wb_rim_we_o  ),
550
        .iwb_stb_o      ( wb_rim_stb_o ),
551
 
552
        // WISHBONE Data Master
553
        .dwb_clk_i      ( wb_clk ),
554
        .dwb_rst_i      ( wb_rst ),
555
        .dwb_cyc_o      ( wb_rdm_cyc_o ),
556
        .dwb_adr_o      ( wb_rdm_adr_o ),
557
        .dwb_dat_i      ( wb_rdm_dat_i ),
558
        .dwb_dat_o      ( wb_rdm_dat_o ),
559
        .dwb_sel_o      ( wb_rdm_sel_o ),
560
        .dwb_ack_i      ( wb_rdm_ack_i ),
561
        .dwb_err_i      ( wb_rdm_err_i ),
562
        .dwb_rty_i      ( wb_rdm_rty_i ),
563
        .dwb_we_o       ( wb_rdm_we_o  ),
564
        .dwb_stb_o      ( wb_rdm_stb_o ),
565
 
566
        // Debug
567
        .dbg_stall_i    ( dbg_stall ),
568
        .dbg_dat_i      ( dbg_dat_dbg ),
569
        .dbg_adr_i      ( dbg_adr ),
570
        .dbg_ewt_i      ( 1'b0 ),
571
        .dbg_lss_o      ( dbg_lss ),
572
        .dbg_is_o       ( dbg_is ),
573
        .dbg_wp_o       ( dbg_wp ),
574
        .dbg_bp_o       ( dbg_bp ),
575
        .dbg_dat_o      ( dbg_dat_risc ),
576
        .dbg_ack_o      ( dbg_ack ),
577 20 rfajardo
        .dbg_stb_i      ( dbg_stb ),
578
        .dbg_we_i       ( dbg_we ),
579 2 rfajardo
 
580
        // Power Management
581
        .pm_clksd_o     ( ),
582
        .pm_cpustall_i  ( 1'b0 ),
583
        .pm_dc_gate_o   ( ),
584
        .pm_ic_gate_o   ( ),
585
        .pm_dmmu_gate_o ( ),
586
        .pm_immu_gate_o ( ),
587
        .pm_tt_gate_o   ( ),
588
        .pm_cpu_gate_o  ( ),
589
        .pm_wakeup_o    ( ),
590
        .pm_lvolt_o     ( ),
591
 
592
        // Interrupts
593
        .pic_ints_i     ( pic_ints )
594
);
595
 
596
//
597
// Startup OR1k
598
//
599
`ifdef START_UP
600
OR1K_startup OR1K_startup0
601
(
602
    .wb_adr_i(wb_fs_adr_i[6:2]),
603
    .wb_stb_i(wb_fs_stb_i),
604
    .wb_cyc_i(wb_fs_cyc_i),
605
    .wb_dat_o(wb_fs_dat_o),
606
    .wb_ack_o(wb_fs_ack_o),
607
    .wb_clk(wb_clk),
608
    .wb_rst(wb_rst)
609
);
610
 
611
spi_flash_top #
612
(
613
   .divider(0),
614
   .divider_len(2)
615
)
616
spi_flash_top0
617
(
618
   .wb_clk_i(wb_clk),
619
   .wb_rst_i(wb_rst),
620
   .wb_adr_i(wb_sp_adr_i[4:2]),
621
   .wb_dat_i(wb_sp_dat_i),
622
   .wb_dat_o(wb_sp_dat_o),
623
   .wb_sel_i(wb_sp_sel_i),
624
   .wb_we_i(wb_sp_we_i),
625
   .wb_stb_i(wb_sp_stb_i),
626
   .wb_cyc_i(wb_sp_cyc_i),
627
   .wb_ack_o(wb_sp_ack_o),
628
 
629
   .mosi_pad_o(spi_flash_mosi),
630
   .miso_pad_i(spi_flash_miso),
631
   .sclk_pad_o(spi_flash_sclk),
632
   .ss_pad_o(spi_flash_ss)
633
);
634
`else
635
assign wb_fs_dat_o = 32'h0000_0000;
636
assign wb_fs_ack_o = 1'b0;
637
assign wb_sp_dat_o = 32'h0000_0000;
638
assign wb_sp_ack_o = 1'b0;
639
`endif
640
 
641
//
642
// Instantiation of the SRAM controller
643
//
644
minsoc_onchip_ram_top #
645
(
646
    .adr_width(`MEMORY_ADR_WIDTH)     //16 blocks of 2048 bytes memory 32768
647
)
648
onchip_ram_top (
649
 
650
        // WISHBONE common
651
        .wb_clk_i       ( wb_clk ),
652
        .wb_rst_i       ( wb_rst ),
653
 
654
        // WISHBONE slave
655
        .wb_dat_i       ( wb_ss_dat_i ),
656
        .wb_dat_o       ( wb_ss_dat_o ),
657
        .wb_adr_i       ( wb_ss_adr_i ),
658
        .wb_sel_i       ( wb_ss_sel_i ),
659
        .wb_we_i        ( wb_ss_we_i  ),
660
        .wb_cyc_i       ( wb_ss_cyc_i ),
661
        .wb_stb_i       ( wb_ss_stb_i ),
662
        .wb_ack_o       ( wb_ss_ack_o ),
663
        .wb_err_o       ( wb_ss_err_o )
664
);
665
 
666
//
667
// Instantiation of the UART16550
668
//
669
`ifdef UART
670
uart_top uart_top (
671
 
672
        // WISHBONE common
673
        .wb_clk_i       ( wb_clk ),
674
        .wb_rst_i       ( wb_rst ),
675
 
676
        // WISHBONE slave
677
        .wb_adr_i       ( wb_us_adr_i[4:0] ),
678
        .wb_dat_i       ( wb_us_dat_i ),
679
        .wb_dat_o       ( wb_us_dat_o ),
680
        .wb_we_i        ( wb_us_we_i  ),
681
        .wb_stb_i       ( wb_us_stb_i ),
682
        .wb_cyc_i       ( wb_us_cyc_i ),
683
        .wb_ack_o       ( wb_us_ack_o ),
684
        .wb_sel_i       ( wb_us_sel_i ),
685
 
686
        // Interrupt request
687
        .int_o          ( pic_ints[`APP_INT_UART] ),
688
 
689
        // UART signals
690
        // serial input/output
691
        .stx_pad_o      ( uart_stx ),
692
        .srx_pad_i      ( uart_srx ),
693
 
694
        // modem signals
695
        .rts_pad_o      ( ),
696
        .cts_pad_i      ( 1'b0 ),
697
        .dtr_pad_o      ( ),
698
        .dsr_pad_i      ( 1'b0 ),
699
        .ri_pad_i       ( 1'b0 ),
700
        .dcd_pad_i      ( 1'b0 )
701
);
702
`else
703
assign wb_us_dat_o = 32'h0000_0000;
704
assign wb_us_ack_o = 1'b0;
705 17 rfajardo
 
706 16 rfajardo
assign pic_ints[`APP_INT_UART] = 1'b0;
707 2 rfajardo
`endif
708
 
709
//
710
// Instantiation of the Ethernet 10/100 MAC
711
//
712
`ifdef ETHERNET
713
eth_top eth_top (
714
 
715
        // WISHBONE common
716
        .wb_clk_i       ( wb_clk ),
717
        .wb_rst_i       ( wb_rst ),
718
 
719
        // WISHBONE slave
720
        .wb_dat_i       ( wb_es_dat_i ),
721
        .wb_dat_o       ( wb_es_dat_o ),
722
        .wb_adr_i       ( wb_es_adr_i[11:2] ),
723
        .wb_sel_i       ( wb_es_sel_i ),
724
        .wb_we_i        ( wb_es_we_i  ),
725
        .wb_cyc_i       ( wb_es_cyc_i ),
726
        .wb_stb_i       ( wb_es_stb_i ),
727
        .wb_ack_o       ( wb_es_ack_o ),
728
        .wb_err_o       ( wb_es_err_o ),
729
 
730
        // WISHBONE master
731
        .m_wb_adr_o     ( wb_em_adr_o ),
732
        .m_wb_sel_o     ( wb_em_sel_o ),
733
        .m_wb_we_o      ( wb_em_we_o  ),
734
        .m_wb_dat_o     ( wb_em_dat_o ),
735
        .m_wb_dat_i     ( wb_em_dat_i ),
736
        .m_wb_cyc_o     ( wb_em_cyc_o ),
737
        .m_wb_stb_o     ( wb_em_stb_o ),
738
        .m_wb_ack_i     ( wb_em_ack_i ),
739
        .m_wb_err_i     ( wb_em_err_i ),
740
 
741
        // TX
742
        .mtx_clk_pad_i  ( eth_tx_clk ),
743
        .mtxd_pad_o     ( eth_txd ),
744
        .mtxen_pad_o    ( eth_tx_en ),
745
        .mtxerr_pad_o   ( eth_tx_er ),
746
 
747
        // RX
748
        .mrx_clk_pad_i  ( eth_rx_clk ),
749
        .mrxd_pad_i     ( eth_rxd ),
750
        .mrxdv_pad_i    ( eth_rx_dv ),
751
        .mrxerr_pad_i   ( eth_rx_er ),
752
        .mcoll_pad_i    ( eth_col ),
753
        .mcrs_pad_i     ( eth_crs ),
754
 
755
        // MIIM
756
        .mdc_pad_o      ( eth_mdc ),
757
        .md_pad_i       ( eth_mdio ),
758
        .md_pad_o       ( eth_mdo ),
759
        .md_padoe_o     ( eth_mdoe ),
760
 
761
        // Interrupt
762
        .int_o          ( pic_ints[`APP_INT_ETH] )
763
);
764
`else
765
assign wb_es_dat_o = 32'h0000_0000;
766
assign wb_es_ack_o = 1'b0;
767 14 rfajardo
assign wb_es_err_o = 1'b0;
768 2 rfajardo
 
769
assign wb_em_adr_o = 32'h0000_0000;
770
assign wb_em_sel_o = 4'h0;
771
assign wb_em_we_o = 1'b0;
772
assign wb_em_dat_o = 32'h0000_0000;
773
assign wb_em_cyc_o = 1'b0;
774
assign wb_em_stb_o = 1'b0;
775 17 rfajardo
 
776 16 rfajardo
assign pic_ints[`APP_INT_ETH] = 1'b0;
777 2 rfajardo
`endif
778
 
779
//
780
// Instantiation of the Traffic COP
781
//
782
minsoc_tc_top #(`APP_ADDR_DEC_W,
783
         `APP_ADDR_SRAM,
784
         `APP_ADDR_DEC_W,
785
         `APP_ADDR_FLASH,
786
         `APP_ADDR_DECP_W,
787
         `APP_ADDR_PERIP,
788
         `APP_ADDR_DEC_W,
789
         `APP_ADDR_SPI,
790
         `APP_ADDR_ETH,
791
         `APP_ADDR_AUDIO,
792
         `APP_ADDR_UART,
793
         `APP_ADDR_PS2,
794
         `APP_ADDR_RES1,
795
         `APP_ADDR_RES2
796
        ) tc_top (
797
 
798
        // WISHBONE common
799
        .wb_clk_i       ( wb_clk ),
800
        .wb_rst_i       ( wb_rst ),
801
 
802
        // WISHBONE Initiator 0
803
        .i0_wb_cyc_i    ( 1'b0 ),
804
        .i0_wb_stb_i    ( 1'b0 ),
805
        .i0_wb_adr_i    ( 32'h0000_0000 ),
806
        .i0_wb_sel_i    ( 4'b0000 ),
807
        .i0_wb_we_i     ( 1'b0 ),
808
        .i0_wb_dat_i    ( 32'h0000_0000 ),
809
        .i0_wb_dat_o    ( ),
810
        .i0_wb_ack_o    ( ),
811
        .i0_wb_err_o    ( ),
812
 
813
        // WISHBONE Initiator 1
814
        .i1_wb_cyc_i    ( wb_em_cyc_o ),
815
        .i1_wb_stb_i    ( wb_em_stb_o ),
816
        .i1_wb_adr_i    ( wb_em_adr_o ),
817
        .i1_wb_sel_i    ( wb_em_sel_o ),
818
        .i1_wb_we_i     ( wb_em_we_o  ),
819
        .i1_wb_dat_i    ( wb_em_dat_o ),
820
        .i1_wb_dat_o    ( wb_em_dat_i ),
821
        .i1_wb_ack_o    ( wb_em_ack_i ),
822
        .i1_wb_err_o    ( wb_em_err_i ),
823
 
824
        // WISHBONE Initiator 2
825
        .i2_wb_cyc_i    ( 1'b0 ),
826
        .i2_wb_stb_i    ( 1'b0 ),
827
        .i2_wb_adr_i    ( 32'h0000_0000 ),
828
        .i2_wb_sel_i    ( 4'b0000 ),
829
        .i2_wb_we_i     ( 1'b0 ),
830
        .i2_wb_dat_i    ( 32'h0000_0000 ),
831
        .i2_wb_dat_o    ( ),
832
        .i2_wb_ack_o    ( ),
833
        .i2_wb_err_o    ( ),
834
 
835
        // WISHBONE Initiator 3
836
        .i3_wb_cyc_i    ( wb_dm_cyc_o ),
837
        .i3_wb_stb_i    ( wb_dm_stb_o ),
838
        .i3_wb_adr_i    ( wb_dm_adr_o ),
839
        .i3_wb_sel_i    ( wb_dm_sel_o ),
840
        .i3_wb_we_i     ( wb_dm_we_o  ),
841
        .i3_wb_dat_i    ( wb_dm_dat_o ),
842
        .i3_wb_dat_o    ( wb_dm_dat_i ),
843
        .i3_wb_ack_o    ( wb_dm_ack_i ),
844
        .i3_wb_err_o    ( wb_dm_err_i ),
845
 
846
        // WISHBONE Initiator 4
847
        .i4_wb_cyc_i    ( wb_rdm_cyc_o ),
848
        .i4_wb_stb_i    ( wb_rdm_stb_o ),
849
        .i4_wb_adr_i    ( wb_rdm_adr_o ),
850
        .i4_wb_sel_i    ( wb_rdm_sel_o ),
851
        .i4_wb_we_i     ( wb_rdm_we_o  ),
852
        .i4_wb_dat_i    ( wb_rdm_dat_o ),
853
        .i4_wb_dat_o    ( wb_rdm_dat_i ),
854
        .i4_wb_ack_o    ( wb_rdm_ack_i ),
855
        .i4_wb_err_o    ( wb_rdm_err_i ),
856
 
857
        // WISHBONE Initiator 5
858
        .i5_wb_cyc_i    ( wb_rim_cyc_o ),
859
        .i5_wb_stb_i    ( wb_rim_stb_o ),
860
        .i5_wb_adr_i    ( wb_rim_adr_o ),
861
        .i5_wb_sel_i    ( wb_rim_sel_o ),
862
        .i5_wb_we_i     ( wb_rim_we_o  ),
863
        .i5_wb_dat_i    ( wb_rim_dat_o ),
864
        .i5_wb_dat_o    ( wb_rim_dat_i ),
865
        .i5_wb_ack_o    ( wb_rim_ack_i ),
866
        .i5_wb_err_o    ( wb_rim_err_i ),
867
 
868
        // WISHBONE Initiator 6
869
        .i6_wb_cyc_i    ( 1'b0 ),
870
        .i6_wb_stb_i    ( 1'b0 ),
871
        .i6_wb_adr_i    ( 32'h0000_0000 ),
872
        .i6_wb_sel_i    ( 4'b0000 ),
873
        .i6_wb_we_i     ( 1'b0 ),
874
        .i6_wb_dat_i    ( 32'h0000_0000 ),
875
        .i6_wb_dat_o    ( ),
876
        .i6_wb_ack_o    ( ),
877
        .i6_wb_err_o    ( ),
878
 
879
        // WISHBONE Initiator 7
880
        .i7_wb_cyc_i    ( 1'b0 ),
881
        .i7_wb_stb_i    ( 1'b0 ),
882
        .i7_wb_adr_i    ( 32'h0000_0000 ),
883
        .i7_wb_sel_i    ( 4'b0000 ),
884
        .i7_wb_we_i     ( 1'b0 ),
885
        .i7_wb_dat_i    ( 32'h0000_0000 ),
886
        .i7_wb_dat_o    ( ),
887
        .i7_wb_ack_o    ( ),
888
        .i7_wb_err_o    ( ),
889
 
890
        // WISHBONE Target 0
891
        .t0_wb_cyc_o    ( wb_ss_cyc_i ),
892
        .t0_wb_stb_o    ( wb_ss_stb_i ),
893
        .t0_wb_adr_o    ( wb_ss_adr_i ),
894
        .t0_wb_sel_o    ( wb_ss_sel_i ),
895
        .t0_wb_we_o     ( wb_ss_we_i  ),
896
        .t0_wb_dat_o    ( wb_ss_dat_i ),
897
        .t0_wb_dat_i    ( wb_ss_dat_o ),
898
        .t0_wb_ack_i    ( wb_ss_ack_o ),
899
        .t0_wb_err_i    ( wb_ss_err_o ),
900
 
901
        // WISHBONE Target 1
902
        .t1_wb_cyc_o    ( wb_fs_cyc_i ),
903
        .t1_wb_stb_o    ( wb_fs_stb_i ),
904
        .t1_wb_adr_o    ( wb_fs_adr_i ),
905
        .t1_wb_sel_o    ( wb_fs_sel_i ),
906
        .t1_wb_we_o     ( wb_fs_we_i  ),
907
        .t1_wb_dat_o    ( wb_fs_dat_i ),
908
        .t1_wb_dat_i    ( wb_fs_dat_o ),
909
        .t1_wb_ack_i    ( wb_fs_ack_o ),
910
        .t1_wb_err_i    ( wb_fs_err_o ),
911
 
912
        // WISHBONE Target 2
913
        .t2_wb_cyc_o    ( wb_sp_cyc_i ),
914
        .t2_wb_stb_o    ( wb_sp_stb_i ),
915
        .t2_wb_adr_o    ( wb_sp_adr_i ),
916
        .t2_wb_sel_o    ( wb_sp_sel_i ),
917
        .t2_wb_we_o     ( wb_sp_we_i  ),
918
        .t2_wb_dat_o    ( wb_sp_dat_i ),
919
        .t2_wb_dat_i    ( wb_sp_dat_o ),
920
        .t2_wb_ack_i    ( wb_sp_ack_o ),
921
        .t2_wb_err_i    ( wb_sp_err_o ),
922
 
923
        // WISHBONE Target 3
924
        .t3_wb_cyc_o    ( wb_es_cyc_i ),
925
        .t3_wb_stb_o    ( wb_es_stb_i ),
926
        .t3_wb_adr_o    ( wb_es_adr_i ),
927
        .t3_wb_sel_o    ( wb_es_sel_i ),
928
        .t3_wb_we_o     ( wb_es_we_i  ),
929
        .t3_wb_dat_o    ( wb_es_dat_i ),
930
        .t3_wb_dat_i    ( wb_es_dat_o ),
931
        .t3_wb_ack_i    ( wb_es_ack_o ),
932
        .t3_wb_err_i    ( wb_es_err_o ),
933
 
934
        // WISHBONE Target 4
935
        .t4_wb_cyc_o    ( ),
936
        .t4_wb_stb_o    ( ),
937
        .t4_wb_adr_o    ( ),
938
        .t4_wb_sel_o    ( ),
939
        .t4_wb_we_o     ( ),
940
        .t4_wb_dat_o    ( ),
941
        .t4_wb_dat_i    ( 32'h0000_0000 ),
942
        .t4_wb_ack_i    ( 1'b0 ),
943
        .t4_wb_err_i    ( 1'b1 ),
944
 
945
        // WISHBONE Target 5
946
        .t5_wb_cyc_o    ( wb_us_cyc_i ),
947
        .t5_wb_stb_o    ( wb_us_stb_i ),
948
        .t5_wb_adr_o    ( wb_us_adr_i ),
949
        .t5_wb_sel_o    ( wb_us_sel_i ),
950
        .t5_wb_we_o     ( wb_us_we_i  ),
951
        .t5_wb_dat_o    ( wb_us_dat_i ),
952
        .t5_wb_dat_i    ( wb_us_dat_o ),
953
        .t5_wb_ack_i    ( wb_us_ack_o ),
954
        .t5_wb_err_i    ( wb_us_err_o ),
955
 
956
        // WISHBONE Target 6
957
        .t6_wb_cyc_o    ( ),
958
        .t6_wb_stb_o    ( ),
959
        .t6_wb_adr_o    ( ),
960
        .t6_wb_sel_o    ( ),
961
        .t6_wb_we_o     ( ),
962
        .t6_wb_dat_o    ( ),
963
        .t6_wb_dat_i    ( 32'h0000_0000 ),
964
        .t6_wb_ack_i    ( 1'b0 ),
965
        .t6_wb_err_i    ( 1'b1 ),
966
 
967
        // WISHBONE Target 7
968
        .t7_wb_cyc_o    ( ),
969
        .t7_wb_stb_o    ( ),
970
        .t7_wb_adr_o    ( ),
971
        .t7_wb_sel_o    ( ),
972
        .t7_wb_we_o     ( ),
973
        .t7_wb_dat_o    ( ),
974
        .t7_wb_dat_i    ( 32'h0000_0000 ),
975
        .t7_wb_ack_i    ( 1'b0 ),
976
        .t7_wb_err_i    ( 1'b1 ),
977
 
978
        // WISHBONE Target 8
979
        .t8_wb_cyc_o    ( ),
980
        .t8_wb_stb_o    ( ),
981
        .t8_wb_adr_o    ( ),
982
        .t8_wb_sel_o    ( ),
983
        .t8_wb_we_o     ( ),
984
        .t8_wb_dat_o    ( ),
985
        .t8_wb_dat_i    ( 32'h0000_0000 ),
986
        .t8_wb_ack_i    ( 1'b0 ),
987
        .t8_wb_err_i    ( 1'b1 )
988
);
989
 
990
//initial begin
991
//  $dumpvars(0);
992
//  $dumpfile("dump.vcd");
993
//end
994
 
995
endmodule

powered by: WebSVN 2.1.0

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