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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [verilog/] [minsoc/] [minsoc_top_dsp.v] - Blame information for rev 7

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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