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

Subversion Repositories minsoc

[/] [minsoc/] [branches/] [verilator/] [rtl/] [verilog/] [minsoc_top.v] - Blame information for rev 167

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 56 javieralso
   .divisor(`CLOCK_DIVISOR)
299 2 rfajardo
)
300
clk_adjust (
301
        .clk_i(clk),
302
        .clk_o(wb_clk)
303
);
304
 
305
//
306
// Unused WISHBONE signals
307
//
308
assign wb_us_err_o = 1'b0;
309
assign wb_fs_err_o = 1'b0;
310
assign wb_sp_err_o = 1'b0;
311
 
312
//
313
// Unused interrupts
314
//
315
assign pic_ints[`APP_INT_RES1] = 'b0;
316
assign pic_ints[`APP_INT_RES2] = 'b0;
317
assign pic_ints[`APP_INT_RES3] = 'b0;
318
assign pic_ints[`APP_INT_PS2] = 'b0;
319
 
320
//
321
// Ethernet tri-state
322
//
323
`ifdef ETHERNET
324
assign eth_mdio = eth_mdoe ? eth_mdo : 1'bz;
325
assign eth_trste = `ETH_RESET;
326
`endif
327
 
328
 
329
//
330
// RISC Instruction address for Flash
331
//
332
// Until first access to real Flash area,
333
// CPU instruction is fixed to jump to the Flash area.
334
// After Flash area is accessed, CPU instructions 
335
// come from the tc_top (wishbone "switch").
336
//
337
`ifdef START_UP
338
reg jump_flash;
339
reg [3:0] rif_counter;
340
reg [31:0] rif_dat_int;
341
reg rif_ack_int;
342
 
343
always @(posedge wb_clk or negedge rstn)
344
begin
345
        if (!rstn) begin
346
                jump_flash <= #1 1'b1;
347
                rif_counter <= 4'h0;
348
                rif_ack_int <= 1'b0;
349
        end
350
        else begin
351
                rif_ack_int <= 1'b0;
352
 
353
                if (wb_rim_cyc_o && (wb_rim_adr_o[31:32-`APP_ADDR_DEC_W] == `APP_ADDR_FLASH))
354
                        jump_flash <= #1 1'b0;
355
 
356
                if ( jump_flash == 1'b1 ) begin
357 33 rfajardo
                        if ( wb_rim_cyc_o && wb_rim_stb_o && ~wb_rim_we_o )
358
                                rif_ack_int <= 1'b1;
359
 
360
            if ( rif_ack_int == 1'b1 ) begin
361 2 rfajardo
                                rif_counter <= rif_counter + 1'b1;
362 33 rfajardo
                                rif_ack_int <= 1'b0;
363
            end
364 2 rfajardo
                end
365
        end
366
end
367
 
368
always @ (rif_counter)
369
begin
370
        case ( rif_counter )
371
                4'h0: rif_dat_int = { `OR1200_OR32_MOVHI , 5'h01 , 4'h0 , 1'b0 , `APP_ADDR_FLASH , 8'h00 };
372
                4'h1: rif_dat_int = { `OR1200_OR32_ORI , 5'h01 , 5'h01 , 16'h0000 };
373
                4'h2: rif_dat_int = { `OR1200_OR32_JR , 10'h000 , 5'h01 , 11'h000 };
374
                4'h3: rif_dat_int = { `OR1200_OR32_NOP , 10'h000 , 16'h0000 };
375
                default: rif_dat_int = 32'h0000_0000;
376
        endcase
377
end
378
 
379
assign wb_rif_dat_i = jump_flash ? rif_dat_int : wb_rim_dat_i;
380
 
381
assign wb_rif_ack_i = jump_flash ? rif_ack_int : wb_rim_ack_i;
382
 
383
`else
384
assign wb_rif_dat_i = wb_rim_dat_i;
385
assign wb_rif_ack_i = wb_rim_ack_i;
386
`endif
387
 
388
 
389
//
390
// TAP<->dbg_interface
391
//      
392
wire jtag_tck;
393
wire debug_tdi;
394
wire debug_tdo;
395
wire capture_dr;
396
wire shift_dr;
397
wire pause_dr;
398
wire update_dr;
399
 
400
wire debug_select;
401
wire test_logic_reset;
402
 
403
//
404
// Instantiation of the development i/f
405
//
406
adbg_top dbg_top  (
407
 
408
        // JTAG pins
409
      .tck_i    ( jtag_tck ),
410
      .tdi_i    ( debug_tdi ),
411
      .tdo_o    ( debug_tdo ),
412
      .rst_i    ( test_logic_reset ),           //cable without rst
413
 
414
        // Boundary Scan signals
415
      .capture_dr_i ( capture_dr ),
416
      .shift_dr_i  ( shift_dr ),
417
      .pause_dr_i  ( pause_dr ),
418
      .update_dr_i ( update_dr ),
419
 
420
      .debug_select_i( debug_select ),
421
        // WISHBONE common
422
      .wb_clk_i   ( wb_clk ),
423
 
424
      // WISHBONE master interface
425
      .wb_adr_o  ( wb_dm_adr_o ),
426
      .wb_dat_i  ( wb_dm_dat_i ),
427
      .wb_dat_o  ( wb_dm_dat_o ),
428
      .wb_sel_o  ( wb_dm_sel_o ),
429
      .wb_we_o   ( wb_dm_we_o  ),
430
      .wb_stb_o  ( wb_dm_stb_o ),
431
      .wb_cyc_o  ( wb_dm_cyc_o ),
432
      .wb_ack_i  ( wb_dm_ack_i ),
433
      .wb_err_i  ( wb_dm_err_i ),
434
      .wb_cti_o  ( ),
435
      .wb_bte_o  ( ),
436
 
437
      // RISC signals
438
      .cpu0_clk_i  ( wb_clk ),
439
      .cpu0_addr_o ( dbg_adr ),
440
      .cpu0_data_i ( dbg_dat_risc ),
441
      .cpu0_data_o ( dbg_dat_dbg ),
442
      .cpu0_bp_i   ( dbg_bp ),
443
      .cpu0_stall_o( dbg_stall ),
444 20 rfajardo
      .cpu0_stb_o  ( dbg_stb ),
445
      .cpu0_we_o   ( dbg_we ),
446 2 rfajardo
      .cpu0_ack_i  ( dbg_ack ),
447
      .cpu0_rst_o  ( )
448
 
449
);
450
 
451
//
452
// JTAG TAP controller instantiation
453
//
454
`ifdef GENERIC_TAP
455
tap_top tap_top(
456
         // JTAG pads
457
         .tms_pad_i(jtag_tms),
458
         .tck_pad_i(jtag_tck),
459
         .trstn_pad_i(rstn),
460
         .tdi_pad_i(jtag_tdi),
461
         .tdo_pad_o(jtag_tdo),
462
         .tdo_padoe_o( ),
463
 
464
         // TAP states
465
         .test_logic_reset_o( test_logic_reset ),
466
         .run_test_idle_o(),
467
         .shift_dr_o(shift_dr),
468
         .pause_dr_o(pause_dr),
469
         .update_dr_o(update_dr),
470
         .capture_dr_o(capture_dr),
471
 
472
         // Select signals for boundary scan or mbist
473
         .extest_select_o(),
474
         .sample_preload_select_o(),
475
         .mbist_select_o(),
476
         .debug_select_o(debug_select),
477
 
478
         // TDO signal that is connected to TDI of sub-modules.
479
         .tdi_o(debug_tdi),
480
 
481
         // TDI signals from sub-modules
482
         .debug_tdo_i(debug_tdo),    // from debug module
483
         .bs_chain_tdo_i(1'b0), // from Boundary Scan Chain
484
         .mbist_tdo_i(1'b0)     // from Mbist Chain
485
);
486
`elsif FPGA_TAP
487
`ifdef ALTERA_FPGA
488
altera_virtual_jtag tap_top(
489
        .tck_o(jtag_tck),
490 26 rfajardo
        .debug_tdo_i(debug_tdo),
491 2 rfajardo
        .tdi_o(debug_tdi),
492
        .test_logic_reset_o(test_logic_reset),
493
        .run_test_idle_o(),
494
        .shift_dr_o(shift_dr),
495
        .capture_dr_o(capture_dr),
496
        .pause_dr_o(pause_dr),
497
        .update_dr_o(update_dr),
498
        .debug_select_o(debug_select)
499
);
500
`elsif XILINX_FPGA
501
minsoc_xilinx_internal_jtag tap_top(
502
        .tck_o( jtag_tck ),
503
        .debug_tdo_i( debug_tdo ),
504
        .tdi_o( debug_tdi ),
505
 
506
        .test_logic_reset_o( test_logic_reset ),
507
        .run_test_idle_o( ),
508
 
509
        .shift_dr_o( shift_dr ),
510
        .capture_dr_o( capture_dr ),
511
        .pause_dr_o( pause_dr ),
512
        .update_dr_o( update_dr ),
513
        .debug_select_o( debug_select )
514
);
515
`endif // !FPGA_TAP
516
 
517
`endif // !GENERIC_TAP
518
 
519
//
520
// Instantiation of the OR1200 RISC
521
//
522
or1200_top or1200_top (
523
 
524
        // Common
525
        .rst_i          ( wb_rst ),
526
        .clk_i          ( wb_clk ),
527
`ifdef OR1200_CLMODE_1TO2
528
        .clmode_i       ( 2'b01 ),
529
`else
530
`ifdef OR1200_CLMODE_1TO4
531
        .clmode_i       ( 2'b11 ),
532
`else
533
        .clmode_i       ( 2'b00 ),
534
`endif
535
`endif
536
 
537
        // WISHBONE Instruction Master
538
        .iwb_clk_i      ( wb_clk ),
539
        .iwb_rst_i      ( wb_rst ),
540
        .iwb_cyc_o      ( wb_rim_cyc_o ),
541
        .iwb_adr_o      ( wb_rim_adr_o ),
542
        .iwb_dat_i      ( wb_rif_dat_i ),
543
        .iwb_dat_o      ( wb_rim_dat_o ),
544
        .iwb_sel_o      ( wb_rim_sel_o ),
545
        .iwb_ack_i      ( wb_rif_ack_i ),
546
        .iwb_err_i      ( wb_rim_err_i ),
547
        .iwb_rty_i      ( wb_rim_rty_i ),
548
        .iwb_we_o       ( wb_rim_we_o  ),
549
        .iwb_stb_o      ( wb_rim_stb_o ),
550
 
551
        // WISHBONE Data Master
552
        .dwb_clk_i      ( wb_clk ),
553
        .dwb_rst_i      ( wb_rst ),
554
        .dwb_cyc_o      ( wb_rdm_cyc_o ),
555
        .dwb_adr_o      ( wb_rdm_adr_o ),
556
        .dwb_dat_i      ( wb_rdm_dat_i ),
557
        .dwb_dat_o      ( wb_rdm_dat_o ),
558
        .dwb_sel_o      ( wb_rdm_sel_o ),
559
        .dwb_ack_i      ( wb_rdm_ack_i ),
560
        .dwb_err_i      ( wb_rdm_err_i ),
561
        .dwb_rty_i      ( wb_rdm_rty_i ),
562
        .dwb_we_o       ( wb_rdm_we_o  ),
563
        .dwb_stb_o      ( wb_rdm_stb_o ),
564
 
565
        // Debug
566
        .dbg_stall_i    ( dbg_stall ),
567
        .dbg_dat_i      ( dbg_dat_dbg ),
568
        .dbg_adr_i      ( dbg_adr ),
569
        .dbg_ewt_i      ( 1'b0 ),
570
        .dbg_lss_o      ( dbg_lss ),
571
        .dbg_is_o       ( dbg_is ),
572
        .dbg_wp_o       ( dbg_wp ),
573
        .dbg_bp_o       ( dbg_bp ),
574
        .dbg_dat_o      ( dbg_dat_risc ),
575
        .dbg_ack_o      ( dbg_ack ),
576 20 rfajardo
        .dbg_stb_i      ( dbg_stb ),
577
        .dbg_we_i       ( dbg_we ),
578 2 rfajardo
 
579
        // Power Management
580
        .pm_clksd_o     ( ),
581
        .pm_cpustall_i  ( 1'b0 ),
582
        .pm_dc_gate_o   ( ),
583
        .pm_ic_gate_o   ( ),
584
        .pm_dmmu_gate_o ( ),
585
        .pm_immu_gate_o ( ),
586
        .pm_tt_gate_o   ( ),
587
        .pm_cpu_gate_o  ( ),
588
        .pm_wakeup_o    ( ),
589
        .pm_lvolt_o     ( ),
590
 
591
        // Interrupts
592
        .pic_ints_i     ( pic_ints )
593
);
594
 
595
//
596
// Startup OR1k
597
//
598
`ifdef START_UP
599
OR1K_startup OR1K_startup0
600
(
601
    .wb_adr_i(wb_fs_adr_i[6:2]),
602
    .wb_stb_i(wb_fs_stb_i),
603
    .wb_cyc_i(wb_fs_cyc_i),
604
    .wb_dat_o(wb_fs_dat_o),
605
    .wb_ack_o(wb_fs_ack_o),
606
    .wb_clk(wb_clk),
607
    .wb_rst(wb_rst)
608
);
609
 
610
spi_flash_top #
611
(
612
   .divider(0),
613
   .divider_len(2)
614
)
615
spi_flash_top0
616
(
617
   .wb_clk_i(wb_clk),
618
   .wb_rst_i(wb_rst),
619
   .wb_adr_i(wb_sp_adr_i[4:2]),
620
   .wb_dat_i(wb_sp_dat_i),
621
   .wb_dat_o(wb_sp_dat_o),
622
   .wb_sel_i(wb_sp_sel_i),
623
   .wb_we_i(wb_sp_we_i),
624
   .wb_stb_i(wb_sp_stb_i),
625
   .wb_cyc_i(wb_sp_cyc_i),
626
   .wb_ack_o(wb_sp_ack_o),
627
 
628
   .mosi_pad_o(spi_flash_mosi),
629
   .miso_pad_i(spi_flash_miso),
630
   .sclk_pad_o(spi_flash_sclk),
631
   .ss_pad_o(spi_flash_ss)
632
);
633
`else
634
assign wb_fs_dat_o = 32'h0000_0000;
635
assign wb_fs_ack_o = 1'b0;
636
assign wb_sp_dat_o = 32'h0000_0000;
637
assign wb_sp_ack_o = 1'b0;
638
`endif
639
 
640
//
641
// Instantiation of the SRAM controller
642
//
643 60 rfajardo
`ifdef MEMORY_MODEL
644
minsoc_memory_model #
645
`else
646 2 rfajardo
minsoc_onchip_ram_top #
647 60 rfajardo
`endif
648 2 rfajardo
(
649
    .adr_width(`MEMORY_ADR_WIDTH)     //16 blocks of 2048 bytes memory 32768
650
)
651
onchip_ram_top (
652
 
653
        // WISHBONE common
654
        .wb_clk_i       ( wb_clk ),
655
        .wb_rst_i       ( wb_rst ),
656
 
657
        // WISHBONE slave
658
        .wb_dat_i       ( wb_ss_dat_i ),
659
        .wb_dat_o       ( wb_ss_dat_o ),
660
        .wb_adr_i       ( wb_ss_adr_i ),
661
        .wb_sel_i       ( wb_ss_sel_i ),
662
        .wb_we_i        ( wb_ss_we_i  ),
663
        .wb_cyc_i       ( wb_ss_cyc_i ),
664
        .wb_stb_i       ( wb_ss_stb_i ),
665
        .wb_ack_o       ( wb_ss_ack_o ),
666
        .wb_err_o       ( wb_ss_err_o )
667
);
668
 
669
//
670
// Instantiation of the UART16550
671
//
672 140 rfajardo
`ifdef UART_DPI
673
uart_dpi
674
#( .tcp_port(5678),
675
    .port_name("UART DPI number 2"),
676
    .welcome_message( "--- Welcome to my second UART DPI port ---\n\r" )
677
)
678
uart_dpi_0_
679
(
680
    // WISHBONE common
681
    .wb_clk_i       ( wb_clk ),
682
    .wb_rst_i       ( wb_rst ),
683
 
684
    // WISHBONE slave
685
    .wb_adr_i       ( wb_us_adr_i[4:0] ),
686
    .wb_dat_i       ( wb_us_dat_i ),
687
    .wb_dat_o       ( wb_us_dat_o ),
688
    .wb_we_i        ( wb_us_we_i  ),
689
    .wb_stb_i       ( wb_us_stb_i ),
690
    .wb_cyc_i       ( wb_us_cyc_i ),
691
    .wb_ack_o       ( wb_us_ack_o ),
692
    .wb_sel_i       ( wb_us_sel_i ),
693
 
694
    // Interrupt request
695
    .int_o          ( pic_ints[`APP_INT_UART] )
696
);
697
`elsif UART
698 2 rfajardo
uart_top uart_top (
699
 
700
        // WISHBONE common
701
        .wb_clk_i       ( wb_clk ),
702
        .wb_rst_i       ( wb_rst ),
703
 
704
        // WISHBONE slave
705
        .wb_adr_i       ( wb_us_adr_i[4:0] ),
706
        .wb_dat_i       ( wb_us_dat_i ),
707
        .wb_dat_o       ( wb_us_dat_o ),
708
        .wb_we_i        ( wb_us_we_i  ),
709
        .wb_stb_i       ( wb_us_stb_i ),
710
        .wb_cyc_i       ( wb_us_cyc_i ),
711
        .wb_ack_o       ( wb_us_ack_o ),
712
        .wb_sel_i       ( wb_us_sel_i ),
713
 
714
        // Interrupt request
715
        .int_o          ( pic_ints[`APP_INT_UART] ),
716
 
717
        // UART signals
718
        // serial input/output
719
        .stx_pad_o      ( uart_stx ),
720
        .srx_pad_i      ( uart_srx ),
721
 
722
        // modem signals
723
        .rts_pad_o      ( ),
724
        .cts_pad_i      ( 1'b0 ),
725
        .dtr_pad_o      ( ),
726
        .dsr_pad_i      ( 1'b0 ),
727
        .ri_pad_i       ( 1'b0 ),
728
        .dcd_pad_i      ( 1'b0 )
729
);
730
`else
731 140 rfajardo
    assign wb_us_dat_o = 32'h0000_0000;
732
    assign wb_us_ack_o = 1'b0;
733 17 rfajardo
 
734 140 rfajardo
    assign pic_ints[`APP_INT_UART] = 1'b0;
735 2 rfajardo
`endif
736
 
737
//
738
// Instantiation of the Ethernet 10/100 MAC
739
//
740
`ifdef ETHERNET
741 75 rfajardo
ethmac ethmac (
742 2 rfajardo
 
743
        // WISHBONE common
744
        .wb_clk_i       ( wb_clk ),
745
        .wb_rst_i       ( wb_rst ),
746
 
747
        // WISHBONE slave
748
        .wb_dat_i       ( wb_es_dat_i ),
749
        .wb_dat_o       ( wb_es_dat_o ),
750
        .wb_adr_i       ( wb_es_adr_i[11:2] ),
751
        .wb_sel_i       ( wb_es_sel_i ),
752
        .wb_we_i        ( wb_es_we_i  ),
753
        .wb_cyc_i       ( wb_es_cyc_i ),
754
        .wb_stb_i       ( wb_es_stb_i ),
755
        .wb_ack_o       ( wb_es_ack_o ),
756
        .wb_err_o       ( wb_es_err_o ),
757
 
758
        // WISHBONE master
759
        .m_wb_adr_o     ( wb_em_adr_o ),
760
        .m_wb_sel_o     ( wb_em_sel_o ),
761
        .m_wb_we_o      ( wb_em_we_o  ),
762
        .m_wb_dat_o     ( wb_em_dat_o ),
763
        .m_wb_dat_i     ( wb_em_dat_i ),
764
        .m_wb_cyc_o     ( wb_em_cyc_o ),
765
        .m_wb_stb_o     ( wb_em_stb_o ),
766
        .m_wb_ack_i     ( wb_em_ack_i ),
767
        .m_wb_err_i     ( wb_em_err_i ),
768
 
769
        // TX
770
        .mtx_clk_pad_i  ( eth_tx_clk ),
771
        .mtxd_pad_o     ( eth_txd ),
772
        .mtxen_pad_o    ( eth_tx_en ),
773
        .mtxerr_pad_o   ( eth_tx_er ),
774
 
775
        // RX
776
        .mrx_clk_pad_i  ( eth_rx_clk ),
777
        .mrxd_pad_i     ( eth_rxd ),
778
        .mrxdv_pad_i    ( eth_rx_dv ),
779
        .mrxerr_pad_i   ( eth_rx_er ),
780
        .mcoll_pad_i    ( eth_col ),
781
        .mcrs_pad_i     ( eth_crs ),
782
 
783
        // MIIM
784
        .mdc_pad_o      ( eth_mdc ),
785
        .md_pad_i       ( eth_mdio ),
786
        .md_pad_o       ( eth_mdo ),
787
        .md_padoe_o     ( eth_mdoe ),
788
 
789
        // Interrupt
790
        .int_o          ( pic_ints[`APP_INT_ETH] )
791
);
792
`else
793
assign wb_es_dat_o = 32'h0000_0000;
794
assign wb_es_ack_o = 1'b0;
795 14 rfajardo
assign wb_es_err_o = 1'b0;
796 2 rfajardo
 
797
assign wb_em_adr_o = 32'h0000_0000;
798
assign wb_em_sel_o = 4'h0;
799
assign wb_em_we_o = 1'b0;
800
assign wb_em_dat_o = 32'h0000_0000;
801
assign wb_em_cyc_o = 1'b0;
802
assign wb_em_stb_o = 1'b0;
803 17 rfajardo
 
804 16 rfajardo
assign pic_ints[`APP_INT_ETH] = 1'b0;
805 2 rfajardo
`endif
806
 
807
//
808
// Instantiation of the Traffic COP
809
//
810
minsoc_tc_top #(`APP_ADDR_DEC_W,
811
         `APP_ADDR_SRAM,
812
         `APP_ADDR_DEC_W,
813
         `APP_ADDR_FLASH,
814
         `APP_ADDR_DECP_W,
815
         `APP_ADDR_PERIP,
816
         `APP_ADDR_DEC_W,
817
         `APP_ADDR_SPI,
818
         `APP_ADDR_ETH,
819
         `APP_ADDR_AUDIO,
820
         `APP_ADDR_UART,
821
         `APP_ADDR_PS2,
822
         `APP_ADDR_RES1,
823
         `APP_ADDR_RES2
824
        ) tc_top (
825
 
826
        // WISHBONE common
827
        .wb_clk_i       ( wb_clk ),
828
        .wb_rst_i       ( wb_rst ),
829
 
830
        // WISHBONE Initiator 0
831
        .i0_wb_cyc_i    ( 1'b0 ),
832
        .i0_wb_stb_i    ( 1'b0 ),
833
        .i0_wb_adr_i    ( 32'h0000_0000 ),
834
        .i0_wb_sel_i    ( 4'b0000 ),
835
        .i0_wb_we_i     ( 1'b0 ),
836
        .i0_wb_dat_i    ( 32'h0000_0000 ),
837
        .i0_wb_dat_o    ( ),
838
        .i0_wb_ack_o    ( ),
839
        .i0_wb_err_o    ( ),
840
 
841
        // WISHBONE Initiator 1
842
        .i1_wb_cyc_i    ( wb_em_cyc_o ),
843
        .i1_wb_stb_i    ( wb_em_stb_o ),
844
        .i1_wb_adr_i    ( wb_em_adr_o ),
845
        .i1_wb_sel_i    ( wb_em_sel_o ),
846
        .i1_wb_we_i     ( wb_em_we_o  ),
847
        .i1_wb_dat_i    ( wb_em_dat_o ),
848
        .i1_wb_dat_o    ( wb_em_dat_i ),
849
        .i1_wb_ack_o    ( wb_em_ack_i ),
850
        .i1_wb_err_o    ( wb_em_err_i ),
851
 
852
        // WISHBONE Initiator 2
853
        .i2_wb_cyc_i    ( 1'b0 ),
854
        .i2_wb_stb_i    ( 1'b0 ),
855
        .i2_wb_adr_i    ( 32'h0000_0000 ),
856
        .i2_wb_sel_i    ( 4'b0000 ),
857
        .i2_wb_we_i     ( 1'b0 ),
858
        .i2_wb_dat_i    ( 32'h0000_0000 ),
859
        .i2_wb_dat_o    ( ),
860
        .i2_wb_ack_o    ( ),
861
        .i2_wb_err_o    ( ),
862
 
863
        // WISHBONE Initiator 3
864
        .i3_wb_cyc_i    ( wb_dm_cyc_o ),
865
        .i3_wb_stb_i    ( wb_dm_stb_o ),
866
        .i3_wb_adr_i    ( wb_dm_adr_o ),
867
        .i3_wb_sel_i    ( wb_dm_sel_o ),
868
        .i3_wb_we_i     ( wb_dm_we_o  ),
869
        .i3_wb_dat_i    ( wb_dm_dat_o ),
870
        .i3_wb_dat_o    ( wb_dm_dat_i ),
871
        .i3_wb_ack_o    ( wb_dm_ack_i ),
872
        .i3_wb_err_o    ( wb_dm_err_i ),
873
 
874
        // WISHBONE Initiator 4
875
        .i4_wb_cyc_i    ( wb_rdm_cyc_o ),
876
        .i4_wb_stb_i    ( wb_rdm_stb_o ),
877
        .i4_wb_adr_i    ( wb_rdm_adr_o ),
878
        .i4_wb_sel_i    ( wb_rdm_sel_o ),
879
        .i4_wb_we_i     ( wb_rdm_we_o  ),
880
        .i4_wb_dat_i    ( wb_rdm_dat_o ),
881
        .i4_wb_dat_o    ( wb_rdm_dat_i ),
882
        .i4_wb_ack_o    ( wb_rdm_ack_i ),
883
        .i4_wb_err_o    ( wb_rdm_err_i ),
884
 
885
        // WISHBONE Initiator 5
886
        .i5_wb_cyc_i    ( wb_rim_cyc_o ),
887
        .i5_wb_stb_i    ( wb_rim_stb_o ),
888
        .i5_wb_adr_i    ( wb_rim_adr_o ),
889
        .i5_wb_sel_i    ( wb_rim_sel_o ),
890
        .i5_wb_we_i     ( wb_rim_we_o  ),
891
        .i5_wb_dat_i    ( wb_rim_dat_o ),
892
        .i5_wb_dat_o    ( wb_rim_dat_i ),
893
        .i5_wb_ack_o    ( wb_rim_ack_i ),
894
        .i5_wb_err_o    ( wb_rim_err_i ),
895
 
896
        // WISHBONE Initiator 6
897
        .i6_wb_cyc_i    ( 1'b0 ),
898
        .i6_wb_stb_i    ( 1'b0 ),
899
        .i6_wb_adr_i    ( 32'h0000_0000 ),
900
        .i6_wb_sel_i    ( 4'b0000 ),
901
        .i6_wb_we_i     ( 1'b0 ),
902
        .i6_wb_dat_i    ( 32'h0000_0000 ),
903
        .i6_wb_dat_o    ( ),
904
        .i6_wb_ack_o    ( ),
905
        .i6_wb_err_o    ( ),
906
 
907
        // WISHBONE Initiator 7
908
        .i7_wb_cyc_i    ( 1'b0 ),
909
        .i7_wb_stb_i    ( 1'b0 ),
910
        .i7_wb_adr_i    ( 32'h0000_0000 ),
911
        .i7_wb_sel_i    ( 4'b0000 ),
912
        .i7_wb_we_i     ( 1'b0 ),
913
        .i7_wb_dat_i    ( 32'h0000_0000 ),
914
        .i7_wb_dat_o    ( ),
915
        .i7_wb_ack_o    ( ),
916
        .i7_wb_err_o    ( ),
917
 
918
        // WISHBONE Target 0
919
        .t0_wb_cyc_o    ( wb_ss_cyc_i ),
920
        .t0_wb_stb_o    ( wb_ss_stb_i ),
921
        .t0_wb_adr_o    ( wb_ss_adr_i ),
922
        .t0_wb_sel_o    ( wb_ss_sel_i ),
923
        .t0_wb_we_o     ( wb_ss_we_i  ),
924
        .t0_wb_dat_o    ( wb_ss_dat_i ),
925
        .t0_wb_dat_i    ( wb_ss_dat_o ),
926
        .t0_wb_ack_i    ( wb_ss_ack_o ),
927
        .t0_wb_err_i    ( wb_ss_err_o ),
928
 
929
        // WISHBONE Target 1
930
        .t1_wb_cyc_o    ( wb_fs_cyc_i ),
931
        .t1_wb_stb_o    ( wb_fs_stb_i ),
932
        .t1_wb_adr_o    ( wb_fs_adr_i ),
933
        .t1_wb_sel_o    ( wb_fs_sel_i ),
934
        .t1_wb_we_o     ( wb_fs_we_i  ),
935
        .t1_wb_dat_o    ( wb_fs_dat_i ),
936
        .t1_wb_dat_i    ( wb_fs_dat_o ),
937
        .t1_wb_ack_i    ( wb_fs_ack_o ),
938
        .t1_wb_err_i    ( wb_fs_err_o ),
939
 
940
        // WISHBONE Target 2
941
        .t2_wb_cyc_o    ( wb_sp_cyc_i ),
942
        .t2_wb_stb_o    ( wb_sp_stb_i ),
943
        .t2_wb_adr_o    ( wb_sp_adr_i ),
944
        .t2_wb_sel_o    ( wb_sp_sel_i ),
945
        .t2_wb_we_o     ( wb_sp_we_i  ),
946
        .t2_wb_dat_o    ( wb_sp_dat_i ),
947
        .t2_wb_dat_i    ( wb_sp_dat_o ),
948
        .t2_wb_ack_i    ( wb_sp_ack_o ),
949
        .t2_wb_err_i    ( wb_sp_err_o ),
950
 
951
        // WISHBONE Target 3
952
        .t3_wb_cyc_o    ( wb_es_cyc_i ),
953
        .t3_wb_stb_o    ( wb_es_stb_i ),
954
        .t3_wb_adr_o    ( wb_es_adr_i ),
955
        .t3_wb_sel_o    ( wb_es_sel_i ),
956
        .t3_wb_we_o     ( wb_es_we_i  ),
957
        .t3_wb_dat_o    ( wb_es_dat_i ),
958
        .t3_wb_dat_i    ( wb_es_dat_o ),
959
        .t3_wb_ack_i    ( wb_es_ack_o ),
960
        .t3_wb_err_i    ( wb_es_err_o ),
961
 
962
        // WISHBONE Target 4
963
        .t4_wb_cyc_o    ( ),
964
        .t4_wb_stb_o    ( ),
965
        .t4_wb_adr_o    ( ),
966
        .t4_wb_sel_o    ( ),
967
        .t4_wb_we_o     ( ),
968
        .t4_wb_dat_o    ( ),
969
        .t4_wb_dat_i    ( 32'h0000_0000 ),
970
        .t4_wb_ack_i    ( 1'b0 ),
971
        .t4_wb_err_i    ( 1'b1 ),
972
 
973
        // WISHBONE Target 5
974
        .t5_wb_cyc_o    ( wb_us_cyc_i ),
975
        .t5_wb_stb_o    ( wb_us_stb_i ),
976
        .t5_wb_adr_o    ( wb_us_adr_i ),
977
        .t5_wb_sel_o    ( wb_us_sel_i ),
978
        .t5_wb_we_o     ( wb_us_we_i  ),
979
        .t5_wb_dat_o    ( wb_us_dat_i ),
980
        .t5_wb_dat_i    ( wb_us_dat_o ),
981
        .t5_wb_ack_i    ( wb_us_ack_o ),
982
        .t5_wb_err_i    ( wb_us_err_o ),
983
 
984
        // WISHBONE Target 6
985
        .t6_wb_cyc_o    ( ),
986
        .t6_wb_stb_o    ( ),
987
        .t6_wb_adr_o    ( ),
988
        .t6_wb_sel_o    ( ),
989
        .t6_wb_we_o     ( ),
990
        .t6_wb_dat_o    ( ),
991
        .t6_wb_dat_i    ( 32'h0000_0000 ),
992
        .t6_wb_ack_i    ( 1'b0 ),
993
        .t6_wb_err_i    ( 1'b1 ),
994
 
995
        // WISHBONE Target 7
996
        .t7_wb_cyc_o    ( ),
997
        .t7_wb_stb_o    ( ),
998
        .t7_wb_adr_o    ( ),
999
        .t7_wb_sel_o    ( ),
1000
        .t7_wb_we_o     ( ),
1001
        .t7_wb_dat_o    ( ),
1002
        .t7_wb_dat_i    ( 32'h0000_0000 ),
1003
        .t7_wb_ack_i    ( 1'b0 ),
1004
        .t7_wb_err_i    ( 1'b1 ),
1005
 
1006
        // WISHBONE Target 8
1007
        .t8_wb_cyc_o    ( ),
1008
        .t8_wb_stb_o    ( ),
1009
        .t8_wb_adr_o    ( ),
1010
        .t8_wb_sel_o    ( ),
1011
        .t8_wb_we_o     ( ),
1012
        .t8_wb_dat_o    ( ),
1013
        .t8_wb_dat_i    ( 32'h0000_0000 ),
1014
        .t8_wb_ack_i    ( 1'b0 ),
1015
        .t8_wb_err_i    ( 1'b1 )
1016
);
1017
 
1018
//initial begin
1019
//  $dumpvars(0);
1020
//  $dumpfile("dump.vcd");
1021
//end
1022
 
1023
endmodule

powered by: WebSVN 2.1.0

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