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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [vlog/] [system/] [system.v] - Blame information for rev 76

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

Line No. Rev Author Line
1 2 csantifort
//////////////////////////////////////////////////////////////////
2
//                                                              //
3
//  Top-level module instantiating the entire Amber 2 system.   //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  This is the highest level synthesizable module in the       //
10
//  project. The ports in this module represent pins on the     //
11
//  FPGA.                                                       //
12
//                                                              //
13
//  Author(s):                                                  //
14
//      - Conor Santifort, csantifort.amber@gmail.com           //
15
//                                                              //
16
//////////////////////////////////////////////////////////////////
17
//                                                              //
18
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
19
//                                                              //
20
// This source file may be used and distributed without         //
21
// restriction provided that this copyright statement is not    //
22
// removed from the file and that any derivative work contains  //
23
// the original copyright notice and the associated disclaimer. //
24
//                                                              //
25
// This source file is free software; you can redistribute it   //
26
// and/or modify it under the terms of the GNU Lesser General   //
27
// Public License as published by the Free Software Foundation; //
28
// either version 2.1 of the License, or (at your option) any   //
29
// later version.                                               //
30
//                                                              //
31
// This source is distributed in the hope that it will be       //
32
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
33
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
34
// PURPOSE.  See the GNU Lesser General Public License for more //
35
// details.                                                     //
36
//                                                              //
37
// You should have received a copy of the GNU Lesser General    //
38
// Public License along with this source; if not, download it   //
39
// from http://www.opencores.org/lgpl.shtml                     //
40
//                                                              //
41
//////////////////////////////////////////////////////////////////
42
 
43
 
44
module system
45
(
46
input                       brd_rst,
47
input                       brd_clk_n,
48
input                       brd_clk_p,
49
 
50
 
51
// UART 0 Interface
52
input                       i_uart0_rts,
53
output                      o_uart0_rx,
54
output                      o_uart0_cts,
55
input                       i_uart0_tx,
56
 
57
// Xilinx Spartan 6 MCB DDR3 Interface
58
inout  [15:0]               ddr3_dq,
59
output [12:0]               ddr3_addr,
60
output [2:0]                ddr3_ba,
61
output                      ddr3_ras_n,
62
output                      ddr3_cas_n,
63
output                      ddr3_we_n,
64
output                      ddr3_odt,
65
output                      ddr3_reset_n,
66
output                      ddr3_cke,
67
output [1:0]                ddr3_dm,
68
inout  [1:0]                ddr3_dqs_p,
69
inout  [1:0]                ddr3_dqs_n,
70
output                      ddr3_ck_p,
71
output                      ddr3_ck_n,
72 64 csantifort
 
73 2 csantifort
`ifdef XILINX_SPARTAN6_FPGA
74
inout                       mcb3_rzq,
75 64 csantifort
//inout                       mcb3_zio,
76 2 csantifort
`endif
77
 
78
 
79
// Ethmac B100 MAC to PHY Interface
80
input                       mtx_clk_pad_i,
81
output  [3:0]               mtxd_pad_o,
82
output                      mtxen_pad_o,
83
output                      mtxerr_pad_o,
84
input                       mrx_clk_pad_i,
85
input   [3:0]               mrxd_pad_i,
86
input                       mrxdv_pad_i,
87
input                       mrxerr_pad_i,
88
input                       mcoll_pad_i,
89
input                       mcrs_pad_i,
90
inout                       md_pad_io,
91
output                      mdc_pad_o,
92 61 csantifort
output                      phy_reset_n,
93
 
94
output  [3:0]               led
95 2 csantifort
);
96
 
97
 
98
wire            sys_clk;    // System clock
99
wire            sys_rst;    // Active low reset, synchronous to sys_clk
100
wire            clk_200;    // 200MHz from board
101
 
102
 
103
// ======================================
104
// Xilinx MCB DDR3 Controller connections
105
// ======================================
106
`ifdef XILINX_SPARTAN6_FPGA
107
wire            c3_p0_cmd_en;
108
wire  [2:0]     c3_p0_cmd_instr;
109
wire  [29:0]    c3_p0_cmd_byte_addr;
110
wire            c3_p0_wr_en;
111
wire  [15:0]    c3_p0_wr_mask;
112
wire  [127:0]   c3_p0_wr_data;
113
wire  [127:0]   c3_p0_rd_data;
114
wire            c3_p0_rd_empty;
115
wire            c3_p0_cmd_full;
116
wire            c3_p0_wr_full;
117
`endif
118
 
119
wire            phy_init_done;
120 11 csantifort
wire            test_mem_ctrl;
121 15 csantifort
wire            system_rdy;
122 2 csantifort
 
123
 
124
// ======================================
125
// Ethmac MII
126
// ======================================
127
wire            md_pad_i;
128
wire            md_pad_o;
129
wire            md_padoe_o;
130
 
131
// ======================================
132
// Wishbone Buses
133
// ======================================
134
 
135
localparam WB_MASTERS = 2;
136
localparam WB_SLAVES  = 9;
137
 
138 35 csantifort
`ifdef AMBER_A25_CORE
139
localparam WB_DWIDTH  = 128;
140
localparam WB_SWIDTH  = 16;
141
`else
142
localparam WB_DWIDTH  = 32;
143
localparam WB_SWIDTH  = 4;
144
`endif
145 2 csantifort
 
146 35 csantifort
 
147 2 csantifort
// Wishbone Master Buses
148
wire      [31:0]            m_wb_adr      [WB_MASTERS-1:0];
149 35 csantifort
wire      [WB_SWIDTH-1:0]   m_wb_sel      [WB_MASTERS-1:0];
150 2 csantifort
wire      [WB_MASTERS-1:0]  m_wb_we                       ;
151 35 csantifort
wire      [WB_DWIDTH-1:0]   m_wb_dat_w    [WB_MASTERS-1:0];
152
wire      [WB_DWIDTH-1:0]   m_wb_dat_r    [WB_MASTERS-1:0];
153 2 csantifort
wire      [WB_MASTERS-1:0]  m_wb_cyc                      ;
154
wire      [WB_MASTERS-1:0]  m_wb_stb                      ;
155
wire      [WB_MASTERS-1:0]  m_wb_ack                      ;
156
wire      [WB_MASTERS-1:0]  m_wb_err                      ;
157
 
158
 
159
// Wishbone Slave Buses
160
wire      [31:0]            s_wb_adr      [WB_SLAVES-1:0];
161 35 csantifort
wire      [WB_SWIDTH-1:0]   s_wb_sel      [WB_SLAVES-1:0];
162 2 csantifort
wire      [WB_SLAVES-1:0]   s_wb_we                      ;
163 35 csantifort
wire      [WB_DWIDTH-1:0]   s_wb_dat_w    [WB_SLAVES-1:0];
164
wire      [WB_DWIDTH-1:0]   s_wb_dat_r    [WB_SLAVES-1:0];
165 2 csantifort
wire      [WB_SLAVES-1:0]   s_wb_cyc                     ;
166
wire      [WB_SLAVES-1:0]   s_wb_stb                     ;
167
wire      [WB_SLAVES-1:0]   s_wb_ack                     ;
168
wire      [WB_SLAVES-1:0]   s_wb_err                     ;
169
 
170 35 csantifort
wire      [31:0]            emm_wb_adr;
171
wire      [3:0]             emm_wb_sel;
172
wire                        emm_wb_we;
173
wire      [31:0]            emm_wb_rdat;
174
wire      [31:0]            emm_wb_wdat;
175
wire                        emm_wb_cyc;
176
wire                        emm_wb_stb;
177
wire                        emm_wb_ack;
178
wire                        emm_wb_err;
179 2 csantifort
 
180 35 csantifort
wire      [31:0]            ems_wb_adr;
181
wire      [3:0]             ems_wb_sel;
182
wire                        ems_wb_we;
183
wire      [31:0]            ems_wb_rdat;
184
wire      [31:0]            ems_wb_wdat;
185
wire                        ems_wb_cyc;
186
wire                        ems_wb_stb;
187
wire                        ems_wb_ack;
188
wire                        ems_wb_err;
189
 
190
 
191 2 csantifort
// ======================================
192
// Interrupts
193
// ======================================
194
wire                        amber_irq;
195
wire                        amber_firq;
196
wire                        ethmac_int;
197
wire                        test_reg_irq;
198
wire                        test_reg_firq;
199
wire                        uart0_int;
200
wire                        uart1_int;
201
wire      [2:0]             timer_int;
202
 
203
 
204
// ======================================
205
// Clocks and Resets Module
206
// ======================================
207
clocks_resets u_clocks_resets (
208
    .i_brd_rst          ( brd_rst           ),
209
    .i_brd_clk_n        ( brd_clk_n         ),
210
    .i_brd_clk_p        ( brd_clk_p         ),
211
    .i_ddr_calib_done   ( phy_init_done     ),
212
    .o_sys_rst          ( sys_rst           ),
213
    .o_sys_clk          ( sys_clk           ),
214
    .o_clk_200          ( clk_200           )
215
);
216
 
217
 
218
// -------------------------------------------------------------
219
// Instantiate Amber Processor Core
220
// -------------------------------------------------------------
221 15 csantifort
`ifdef AMBER_A25_CORE
222
a25_core u_amber (
223
`else
224
a23_core u_amber (
225
`endif
226 2 csantifort
    .i_clk          ( sys_clk         ),
227
 
228
    .i_irq          ( amber_irq       ),
229
    .i_firq         ( amber_firq      ),
230
 
231 15 csantifort
    .i_system_rdy   ( system_rdy      ),
232 2 csantifort
 
233
    .o_wb_adr       ( m_wb_adr  [1]   ),
234
    .o_wb_sel       ( m_wb_sel  [1]   ),
235
    .o_wb_we        ( m_wb_we   [1]   ),
236
    .i_wb_dat       ( m_wb_dat_r[1]   ),
237
    .o_wb_dat       ( m_wb_dat_w[1]   ),
238
    .o_wb_cyc       ( m_wb_cyc  [1]   ),
239
    .o_wb_stb       ( m_wb_stb  [1]   ),
240
    .i_wb_ack       ( m_wb_ack  [1]   ),
241
    .i_wb_err       ( m_wb_err  [1]   )
242
);
243
 
244
 
245
// -------------------------------------------------------------
246
// Instantiate B100 Ethernet MAC
247
// -------------------------------------------------------------
248 35 csantifort
 
249 2 csantifort
eth_top u_eth_top (
250
    .wb_clk_i                   ( sys_clk                ),
251
    .wb_rst_i                   ( sys_rst                ),
252
 
253
    // WISHBONE slave
254 35 csantifort
    .wb_adr_i                   ( ems_wb_adr [11:2]      ),
255
    .wb_sel_i                   ( ems_wb_sel             ),
256
    .wb_we_i                    ( ems_wb_we              ),
257
    .wb_cyc_i                   ( ems_wb_cyc             ),
258
    .wb_stb_i                   ( ems_wb_stb             ),
259
    .wb_ack_o                   ( ems_wb_ack             ),
260
    .wb_dat_i                   ( ems_wb_wdat            ),
261
    .wb_dat_o                   ( ems_wb_rdat            ),
262
    .wb_err_o                   ( ems_wb_err             ),
263 2 csantifort
 
264
    // WISHBONE master
265 35 csantifort
    .m_wb_adr_o                 ( emm_wb_adr             ),
266
    .m_wb_sel_o                 ( emm_wb_sel             ),
267
    .m_wb_we_o                  ( emm_wb_we              ),
268
    .m_wb_dat_i                 ( emm_wb_rdat            ),
269
    .m_wb_dat_o                 ( emm_wb_wdat            ),
270
    .m_wb_cyc_o                 ( emm_wb_cyc             ),
271
    .m_wb_stb_o                 ( emm_wb_stb             ),
272
    .m_wb_ack_i                 ( emm_wb_ack             ),
273
    .m_wb_err_i                 ( emm_wb_err             ),
274 2 csantifort
 
275
    // MAC to PHY I/F
276
    .mtx_clk_pad_i              ( mtx_clk_pad_i          ),
277
    .mtxd_pad_o                 ( mtxd_pad_o             ),
278
    .mtxen_pad_o                ( mtxen_pad_o            ),
279
    .mtxerr_pad_o               ( mtxerr_pad_o           ),
280
    .mrx_clk_pad_i              ( mrx_clk_pad_i          ),
281
    .mrxd_pad_i                 ( mrxd_pad_i             ),
282
    .mrxdv_pad_i                ( mrxdv_pad_i            ),
283
    .mrxerr_pad_i               ( mrxerr_pad_i           ),
284
    .mcoll_pad_i                ( mcoll_pad_i            ),
285
    .mcrs_pad_i                 ( mcrs_pad_i             ),
286
    .md_pad_i                   ( md_pad_i               ),
287
    .mdc_pad_o                  ( mdc_pad_o              ),
288
    .md_pad_o                   ( md_pad_o               ),
289
    .md_padoe_o                 ( md_padoe_o             ),
290
 
291
    // Interrupt
292
    .int_o                      ( ethmac_int             )
293
);
294
 
295
 
296
// -------------------------------------------------------------
297
// Instantiate Ethernet Control Interface tri-state buffer
298
// -------------------------------------------------------------
299
`ifdef XILINX_FPGA
300
IOBUF u_iobuf (
301
`else
302
generic_iobuf u_iobuf (
303
`endif
304
    .O                          ( md_pad_i              ),
305
    .IO                         ( md_pad_io             ),
306
    .I                          ( md_pad_o              ),
307
    // T is high for tri-state output
308
    .T                          ( ~md_padoe_o           )
309
);
310
 
311
// Ethernet MII PHY reset
312 61 csantifort
//assign phy_reset_n = !sys_rst;
313 2 csantifort
 
314 15 csantifort
// Halt core until system is ready
315
assign system_rdy = phy_init_done && !sys_rst;
316 2 csantifort
 
317
// -------------------------------------------------------------
318
// Instantiate Boot Memory - 8KBytes of Embedded SRAM
319
// -------------------------------------------------------------
320
 
321 36 csantifort
generate
322
if (WB_DWIDTH == 32) begin : boot_mem32
323
    boot_mem32 u_boot_mem (
324
        .i_wb_clk               ( sys_clk         ),
325
        .i_wb_adr               ( s_wb_adr  [1]   ),
326
        .i_wb_sel               ( s_wb_sel  [1]   ),
327
        .i_wb_we                ( s_wb_we   [1]   ),
328
        .o_wb_dat               ( s_wb_dat_r[1]   ),
329
        .i_wb_dat               ( s_wb_dat_w[1]   ),
330
        .i_wb_cyc               ( s_wb_cyc  [1]   ),
331
        .i_wb_stb               ( s_wb_stb  [1]   ),
332
        .o_wb_ack               ( s_wb_ack  [1]   ),
333
        .o_wb_err               ( s_wb_err  [1]   )
334
    );
335
end
336
else begin : boot_mem128
337
    boot_mem128 u_boot_mem (
338
        .i_wb_clk               ( sys_clk         ),
339
        .i_wb_adr               ( s_wb_adr  [1]   ),
340
        .i_wb_sel               ( s_wb_sel  [1]   ),
341
        .i_wb_we                ( s_wb_we   [1]   ),
342
        .o_wb_dat               ( s_wb_dat_r[1]   ),
343
        .i_wb_dat               ( s_wb_dat_w[1]   ),
344
        .i_wb_cyc               ( s_wb_cyc  [1]   ),
345
        .i_wb_stb               ( s_wb_stb  [1]   ),
346
        .o_wb_ack               ( s_wb_ack  [1]   ),
347
        .o_wb_err               ( s_wb_err  [1]   )
348
    );
349
end
350
endgenerate
351 2 csantifort
 
352
 
353
// -------------------------------------------------------------
354
// Instantiate UART0
355
// -------------------------------------------------------------
356 35 csantifort
uart  #(
357
    .WB_DWIDTH              ( WB_DWIDTH       ),
358
    .WB_SWIDTH              ( WB_SWIDTH       )
359
    )
360
u_uart0 (
361 2 csantifort
    .i_clk                  ( sys_clk        ),
362
 
363
    .o_uart_int             ( uart0_int      ),
364
 
365
    .i_uart_cts_n           ( i_uart0_rts    ),
366
    .o_uart_txd             ( o_uart0_rx     ),
367
    .o_uart_rts_n           ( o_uart0_cts    ),
368
    .i_uart_rxd             ( i_uart0_tx     ),
369
 
370
    .i_wb_adr               ( s_wb_adr  [3]  ),
371
    .i_wb_sel               ( s_wb_sel  [3]  ),
372
    .i_wb_we                ( s_wb_we   [3]  ),
373
    .o_wb_dat               ( s_wb_dat_r[3]  ),
374
    .i_wb_dat               ( s_wb_dat_w[3]  ),
375
    .i_wb_cyc               ( s_wb_cyc  [3]  ),
376
    .i_wb_stb               ( s_wb_stb  [3]  ),
377
    .o_wb_ack               ( s_wb_ack  [3]  ),
378
    .o_wb_err               ( s_wb_err  [3]  )
379
);
380
 
381
 
382
// -------------------------------------------------------------
383
// Instantiate UART1
384
// -------------------------------------------------------------
385 35 csantifort
uart  #(
386
    .WB_DWIDTH              ( WB_DWIDTH       ),
387
    .WB_SWIDTH              ( WB_SWIDTH       )
388
    )
389
u_uart1 (
390 2 csantifort
    .i_clk                  ( sys_clk        ),
391
 
392
    .o_uart_int             ( uart1_int      ),
393
 
394
    // These are not connected. ONly pins for 1 UART
395
    // on my development board
396
    .i_uart_cts_n           ( 1'd1           ),
397
    .o_uart_txd             (                ),
398
    .o_uart_rts_n           (                ),
399
    .i_uart_rxd             ( 1'd1           ),
400
 
401
    .i_wb_adr               ( s_wb_adr  [4]  ),
402
    .i_wb_sel               ( s_wb_sel  [4]  ),
403
    .i_wb_we                ( s_wb_we   [4]  ),
404
    .o_wb_dat               ( s_wb_dat_r[4]  ),
405
    .i_wb_dat               ( s_wb_dat_w[4]  ),
406
    .i_wb_cyc               ( s_wb_cyc  [4]  ),
407
    .i_wb_stb               ( s_wb_stb  [4]  ),
408
    .o_wb_ack               ( s_wb_ack  [4]  ),
409
    .o_wb_err               ( s_wb_err  [4]  )
410
);
411
 
412
 
413
// -------------------------------------------------------------
414
// Instantiate Test Module
415
//   - includes register used to terminate tests
416
// -------------------------------------------------------------
417 35 csantifort
test_module #(
418
    .WB_DWIDTH              ( WB_DWIDTH      ),
419
    .WB_SWIDTH              ( WB_SWIDTH      )
420
    )
421
u_test_module (
422 2 csantifort
    .i_clk                  ( sys_clk        ),
423
 
424
    .o_irq                  ( test_reg_irq   ),
425
    .o_firq                 ( test_reg_firq  ),
426 11 csantifort
    .o_mem_ctrl             ( test_mem_ctrl  ),
427 2 csantifort
    .i_wb_adr               ( s_wb_adr  [5]  ),
428
    .i_wb_sel               ( s_wb_sel  [5]  ),
429
    .i_wb_we                ( s_wb_we   [5]  ),
430
    .o_wb_dat               ( s_wb_dat_r[5]  ),
431
    .i_wb_dat               ( s_wb_dat_w[5]  ),
432
    .i_wb_cyc               ( s_wb_cyc  [5]  ),
433
    .i_wb_stb               ( s_wb_stb  [5]  ),
434
    .o_wb_ack               ( s_wb_ack  [5]  ),
435 61 csantifort
    .o_wb_err               ( s_wb_err  [5]  ),
436
    .o_led                  ( led            ),
437
    .o_phy_rst_n            ( phy_reset_n    )
438 2 csantifort
);
439
 
440
 
441
// -------------------------------------------------------------
442
// Instantiate Timer Module
443
// -------------------------------------------------------------
444 35 csantifort
timer_module  #(
445
    .WB_DWIDTH              ( WB_DWIDTH      ),
446
    .WB_SWIDTH              ( WB_SWIDTH      )
447
    )
448
u_timer_module (
449 2 csantifort
    .i_clk                  ( sys_clk        ),
450
 
451
    // Interrupt outputs
452
    .o_timer_int            ( timer_int      ),
453
 
454
    // Wishbone interface
455
    .i_wb_adr               ( s_wb_adr  [6]  ),
456
    .i_wb_sel               ( s_wb_sel  [6]  ),
457
    .i_wb_we                ( s_wb_we   [6]  ),
458
    .o_wb_dat               ( s_wb_dat_r[6]  ),
459
    .i_wb_dat               ( s_wb_dat_w[6]  ),
460
    .i_wb_cyc               ( s_wb_cyc  [6]  ),
461
    .i_wb_stb               ( s_wb_stb  [6]  ),
462
    .o_wb_ack               ( s_wb_ack  [6]  ),
463
    .o_wb_err               ( s_wb_err  [6]  )
464
);
465
 
466
 
467
// -------------------------------------------------------------
468
// Instantiate Interrupt Controller Module
469
// -------------------------------------------------------------
470 35 csantifort
interrupt_controller  #(
471
    .WB_DWIDTH              ( WB_DWIDTH      ),
472
    .WB_SWIDTH              ( WB_SWIDTH      )
473
    )
474
u_interrupt_controller (
475 2 csantifort
    .i_clk                  ( sys_clk        ),
476
 
477
    // Interrupt outputs
478
    .o_irq                  ( amber_irq      ),
479
    .o_firq                 ( amber_firq     ),
480
 
481
    // Interrupt inputs
482
    .i_uart0_int            ( uart0_int      ),
483
    .i_uart1_int            ( uart1_int      ),
484
    .i_ethmac_int           ( ethmac_int     ),
485
    .i_test_reg_irq         ( test_reg_irq   ),
486
    .i_test_reg_firq        ( test_reg_firq  ),
487
    .i_tm_timer_int         ( timer_int      ),
488
 
489
    // Wishbone interface
490
    .i_wb_adr               ( s_wb_adr  [7]  ),
491
    .i_wb_sel               ( s_wb_sel  [7]  ),
492
    .i_wb_we                ( s_wb_we   [7]  ),
493
    .o_wb_dat               ( s_wb_dat_r[7]  ),
494
    .i_wb_dat               ( s_wb_dat_w[7]  ),
495
    .i_wb_cyc               ( s_wb_cyc  [7]  ),
496
    .i_wb_stb               ( s_wb_stb  [7]  ),
497
    .o_wb_ack               ( s_wb_ack  [7]  ),
498
    .o_wb_err               ( s_wb_err  [7]  )
499
);
500
 
501
 
502
 
503
 
504
`ifndef XILINX_FPGA
505
    // ======================================
506
    // Instantiate non-synthesizable main memory model
507
    // ======================================
508
 
509
    assign phy_init_done = 1'd1;
510
 
511 35 csantifort
    main_mem #(
512
                .WB_DWIDTH             ( WB_DWIDTH             ),
513
                .WB_SWIDTH             ( WB_SWIDTH             )
514
                )
515
    u_main_mem (
516 2 csantifort
               .i_clk                  ( sys_clk               ),
517 11 csantifort
               .i_mem_ctrl             ( test_mem_ctrl         ),
518 2 csantifort
               .i_wb_adr               ( s_wb_adr  [2]         ),
519
               .i_wb_sel               ( s_wb_sel  [2]         ),
520
               .i_wb_we                ( s_wb_we   [2]         ),
521
               .o_wb_dat               ( s_wb_dat_r[2]         ),
522
               .i_wb_dat               ( s_wb_dat_w[2]         ),
523
               .i_wb_cyc               ( s_wb_cyc  [2]         ),
524
               .i_wb_stb               ( s_wb_stb  [2]         ),
525
               .o_wb_ack               ( s_wb_ack  [2]         ),
526
               .o_wb_err               ( s_wb_err  [2]         )
527
            );
528
 
529
`endif
530
 
531
 
532
`ifdef XILINX_SPARTAN6_FPGA
533
    // -------------------------------------------------------------
534
    // Instantiate Wishbone to Xilinx Spartan-6 DDR3 Bridge
535
    // -------------------------------------------------------------
536
    // The clock crossing fifo for spartan-6 is build into the mcb
537 36 csantifort
    wb_xs6_ddr3_bridge   #(
538
        .WB_DWIDTH              ( WB_DWIDTH             ),
539
        .WB_SWIDTH              ( WB_SWIDTH             )
540
        )
541
    u_wb_xs6_ddr3_bridge(
542 2 csantifort
        .i_clk                  ( sys_clk               ),
543
 
544
        .o_cmd_en               ( c3_p0_cmd_en          ),
545
        .o_cmd_instr            ( c3_p0_cmd_instr       ),
546
        .o_cmd_byte_addr        ( c3_p0_cmd_byte_addr   ),
547
        .i_cmd_full             ( c3_p0_cmd_full        ),
548
        .i_wr_full              ( c3_p0_wr_full         ),
549
        .o_wr_en                ( c3_p0_wr_en           ),
550
        .o_wr_mask              ( c3_p0_wr_mask         ),
551
        .o_wr_data              ( c3_p0_wr_data         ),
552
        .i_rd_data              ( c3_p0_rd_data         ),
553
        .i_rd_empty             ( c3_p0_rd_empty        ),
554
 
555 11 csantifort
        .i_mem_ctrl             ( test_mem_ctrl         ),
556 2 csantifort
        .i_wb_adr               ( s_wb_adr  [2]         ),
557
        .i_wb_sel               ( s_wb_sel  [2]         ),
558
        .i_wb_we                ( s_wb_we   [2]         ),
559
        .o_wb_dat               ( s_wb_dat_r[2]         ),
560
        .i_wb_dat               ( s_wb_dat_w[2]         ),
561
        .i_wb_cyc               ( s_wb_cyc  [2]         ),
562
        .i_wb_stb               ( s_wb_stb  [2]         ),
563
        .o_wb_ack               ( s_wb_ack  [2]         ),
564
        .o_wb_err               ( s_wb_err  [2]         )
565
    );
566
 
567
 
568
    // -------------------------------------------------------------
569
    // Instantiate Xilinx Spartan-6 FPGA MCB-DDR3 Controller
570
    // -------------------------------------------------------------
571 64 csantifort
    ddr3 u_ddr3  (
572 2 csantifort
 
573
                // DDR3 signals
574
               .mcb3_dram_dq            ( ddr3_dq               ),
575
               .mcb3_dram_a             ( ddr3_addr             ),
576
               .mcb3_dram_ba            ( ddr3_ba               ),
577
               .mcb3_dram_ras_n         ( ddr3_ras_n            ),
578
               .mcb3_dram_cas_n         ( ddr3_cas_n            ),
579
               .mcb3_dram_we_n          ( ddr3_we_n             ),
580
               .mcb3_dram_odt           ( ddr3_odt              ),
581
               .mcb3_dram_reset_n       ( ddr3_reset_n          ),
582
               .mcb3_dram_cke           ( ddr3_cke              ),
583
               .mcb3_dram_udm           ( ddr3_dm[1]            ),
584
               .mcb3_dram_dm            ( ddr3_dm[0]            ),
585
               .mcb3_rzq                ( mcb3_rzq              ),
586 64 csantifort
//               .mcb3_zio                ( mcb3_zio              ),
587 2 csantifort
               .mcb3_dram_udqs          ( ddr3_dqs_p[1]         ),
588
               .mcb3_dram_dqs           ( ddr3_dqs_p[0]         ),
589
               .mcb3_dram_udqs_n        ( ddr3_dqs_n[1]         ),
590
               .mcb3_dram_dqs_n         ( ddr3_dqs_n[0]         ),
591
               .mcb3_dram_ck            ( ddr3_ck_p             ),
592
               .mcb3_dram_ck_n          ( ddr3_ck_n             ),
593
 
594 64 csantifort
               .c3_sys_clk              ( clk_200               ),
595
               .c3_sys_rst_i            ( brd_rst               ), // active-high
596
               .c3_clk0                 (                       ),
597
               .c3_rst0                 (                       ),
598 2 csantifort
               .c3_calib_done           ( phy_init_done         ),
599
 
600
               .c3_p0_cmd_clk           ( sys_clk               ),
601
 
602
               .c3_p0_cmd_en            ( c3_p0_cmd_en          ),
603
               .c3_p0_cmd_instr         ( c3_p0_cmd_instr       ),
604
               .c3_p0_cmd_bl            ( 6'd0                  ),
605
               .c3_p0_cmd_byte_addr     ( c3_p0_cmd_byte_addr   ),
606
               .c3_p0_cmd_empty         (                       ),
607
               .c3_p0_cmd_full          ( c3_p0_cmd_full        ),
608
 
609
               .c3_p0_wr_clk            ( sys_clk               ),
610
 
611
               .c3_p0_wr_en             ( c3_p0_wr_en           ),
612
               .c3_p0_wr_mask           ( c3_p0_wr_mask         ),
613
               .c3_p0_wr_data           ( c3_p0_wr_data         ),
614
               .c3_p0_wr_full           ( c3_p0_wr_full         ),
615
               .c3_p0_wr_empty          (                       ),
616
               .c3_p0_wr_count          (                       ),
617
               .c3_p0_wr_underrun       (                       ),
618
               .c3_p0_wr_error          (                       ),
619
 
620
               .c3_p0_rd_clk            ( sys_clk               ),
621
 
622
               .c3_p0_rd_en             ( 1'd1                  ),
623
               .c3_p0_rd_data           ( c3_p0_rd_data         ),
624
               .c3_p0_rd_full           (                       ),
625
               .c3_p0_rd_empty          ( c3_p0_rd_empty        ),
626
               .c3_p0_rd_count          (                       ),
627
               .c3_p0_rd_overflow       (                       ),
628
               .c3_p0_rd_error          (                       )
629
       );
630
`endif
631
 
632
 
633
 
634
// -------------------------------------------------------------
635
// Instantiate Wishbone Arbiter
636
// -------------------------------------------------------------
637 35 csantifort
wishbone_arbiter #(
638
    .WB_DWIDTH              ( WB_DWIDTH         ),
639
    .WB_SWIDTH              ( WB_SWIDTH         )
640
    )
641
u_wishbone_arbiter (
642 2 csantifort
    .i_wb_clk               ( sys_clk           ),
643
 
644
    // WISHBONE master 0 - Ethmac
645
    .i_m0_wb_adr            ( m_wb_adr   [0]    ),
646
    .i_m0_wb_sel            ( m_wb_sel   [0]    ),
647
    .i_m0_wb_we             ( m_wb_we    [0]    ),
648
    .o_m0_wb_dat            ( m_wb_dat_r [0]    ),
649
    .i_m0_wb_dat            ( m_wb_dat_w [0]    ),
650
    .i_m0_wb_cyc            ( m_wb_cyc   [0]    ),
651
    .i_m0_wb_stb            ( m_wb_stb   [0]    ),
652
    .o_m0_wb_ack            ( m_wb_ack   [0]    ),
653
    .o_m0_wb_err            ( m_wb_err   [0]    ),
654
 
655
 
656
    // WISHBONE master 1 - Amber Process or
657
    .i_m1_wb_adr            ( m_wb_adr   [1]    ),
658
    .i_m1_wb_sel            ( m_wb_sel   [1]    ),
659
    .i_m1_wb_we             ( m_wb_we    [1]    ),
660
    .o_m1_wb_dat            ( m_wb_dat_r [1]    ),
661
    .i_m1_wb_dat            ( m_wb_dat_w [1]    ),
662
    .i_m1_wb_cyc            ( m_wb_cyc   [1]    ),
663
    .i_m1_wb_stb            ( m_wb_stb   [1]    ),
664
    .o_m1_wb_ack            ( m_wb_ack   [1]    ),
665
    .o_m1_wb_err            ( m_wb_err   [1]    ),
666
 
667
 
668
    // WISHBONE slave 0 - Ethmac
669
    .o_s0_wb_adr            ( s_wb_adr   [0]    ),
670
    .o_s0_wb_sel            ( s_wb_sel   [0]    ),
671
    .o_s0_wb_we             ( s_wb_we    [0]    ),
672
    .i_s0_wb_dat            ( s_wb_dat_r [0]    ),
673
    .o_s0_wb_dat            ( s_wb_dat_w [0]    ),
674
    .o_s0_wb_cyc            ( s_wb_cyc   [0]    ),
675
    .o_s0_wb_stb            ( s_wb_stb   [0]    ),
676
    .i_s0_wb_ack            ( s_wb_ack   [0]    ),
677
    .i_s0_wb_err            ( s_wb_err   [0]    ),
678
 
679
 
680
    // WISHBONE slave 1 - Boot Memory
681
    .o_s1_wb_adr            ( s_wb_adr   [1]    ),
682
    .o_s1_wb_sel            ( s_wb_sel   [1]    ),
683
    .o_s1_wb_we             ( s_wb_we    [1]    ),
684
    .i_s1_wb_dat            ( s_wb_dat_r [1]    ),
685
    .o_s1_wb_dat            ( s_wb_dat_w [1]    ),
686
    .o_s1_wb_cyc            ( s_wb_cyc   [1]    ),
687
    .o_s1_wb_stb            ( s_wb_stb   [1]    ),
688
    .i_s1_wb_ack            ( s_wb_ack   [1]    ),
689
    .i_s1_wb_err            ( s_wb_err   [1]    ),
690
 
691
 
692
    // WISHBONE slave 2 - Main Memory
693
    .o_s2_wb_adr            ( s_wb_adr   [2]    ),
694
    .o_s2_wb_sel            ( s_wb_sel   [2]    ),
695
    .o_s2_wb_we             ( s_wb_we    [2]    ),
696
    .i_s2_wb_dat            ( s_wb_dat_r [2]    ),
697
    .o_s2_wb_dat            ( s_wb_dat_w [2]    ),
698
    .o_s2_wb_cyc            ( s_wb_cyc   [2]    ),
699
    .o_s2_wb_stb            ( s_wb_stb   [2]    ),
700
    .i_s2_wb_ack            ( s_wb_ack   [2]    ),
701
    .i_s2_wb_err            ( s_wb_err   [2]    ),
702
 
703
 
704
    // WISHBONE slave 3 - UART 0
705
    .o_s3_wb_adr            ( s_wb_adr   [3]    ),
706
    .o_s3_wb_sel            ( s_wb_sel   [3]    ),
707
    .o_s3_wb_we             ( s_wb_we    [3]    ),
708
    .i_s3_wb_dat            ( s_wb_dat_r [3]    ),
709
    .o_s3_wb_dat            ( s_wb_dat_w [3]    ),
710
    .o_s3_wb_cyc            ( s_wb_cyc   [3]    ),
711
    .o_s3_wb_stb            ( s_wb_stb   [3]    ),
712
    .i_s3_wb_ack            ( s_wb_ack   [3]    ),
713
    .i_s3_wb_err            ( s_wb_err   [3]    ),
714
 
715
 
716
    // WISHBONE slave 4 - UART 1
717
    .o_s4_wb_adr            ( s_wb_adr   [4]    ),
718
    .o_s4_wb_sel            ( s_wb_sel   [4]    ),
719
    .o_s4_wb_we             ( s_wb_we    [4]    ),
720
    .i_s4_wb_dat            ( s_wb_dat_r [4]    ),
721
    .o_s4_wb_dat            ( s_wb_dat_w [4]    ),
722
    .o_s4_wb_cyc            ( s_wb_cyc   [4]    ),
723
    .o_s4_wb_stb            ( s_wb_stb   [4]    ),
724
    .i_s4_wb_ack            ( s_wb_ack   [4]    ),
725
    .i_s4_wb_err            ( s_wb_err   [4]    ),
726
 
727
 
728
    // WISHBONE slave 5 - Test Module
729
    .o_s5_wb_adr            ( s_wb_adr   [5]    ),
730
    .o_s5_wb_sel            ( s_wb_sel   [5]    ),
731
    .o_s5_wb_we             ( s_wb_we    [5]    ),
732
    .i_s5_wb_dat            ( s_wb_dat_r [5]    ),
733
    .o_s5_wb_dat            ( s_wb_dat_w [5]    ),
734
    .o_s5_wb_cyc            ( s_wb_cyc   [5]    ),
735
    .o_s5_wb_stb            ( s_wb_stb   [5]    ),
736
    .i_s5_wb_ack            ( s_wb_ack   [5]    ),
737
    .i_s5_wb_err            ( s_wb_err   [5]    ),
738
 
739
 
740
    // WISHBONE slave 6 - Timer Module
741
    .o_s6_wb_adr            ( s_wb_adr   [6]    ),
742
    .o_s6_wb_sel            ( s_wb_sel   [6]    ),
743
    .o_s6_wb_we             ( s_wb_we    [6]    ),
744
    .i_s6_wb_dat            ( s_wb_dat_r [6]    ),
745
    .o_s6_wb_dat            ( s_wb_dat_w [6]    ),
746
    .o_s6_wb_cyc            ( s_wb_cyc   [6]    ),
747
    .o_s6_wb_stb            ( s_wb_stb   [6]    ),
748
    .i_s6_wb_ack            ( s_wb_ack   [6]    ),
749
    .i_s6_wb_err            ( s_wb_err   [6]    ),
750
 
751
 
752
    // WISHBONE slave 7 - Interrupt Controller
753
    .o_s7_wb_adr            ( s_wb_adr   [7]    ),
754
    .o_s7_wb_sel            ( s_wb_sel   [7]    ),
755
    .o_s7_wb_we             ( s_wb_we    [7]    ),
756
    .i_s7_wb_dat            ( s_wb_dat_r [7]    ),
757
    .o_s7_wb_dat            ( s_wb_dat_w [7]    ),
758
    .o_s7_wb_cyc            ( s_wb_cyc   [7]    ),
759
    .o_s7_wb_stb            ( s_wb_stb   [7]    ),
760
    .i_s7_wb_ack            ( s_wb_ack   [7]    ),
761
    .i_s7_wb_err            ( s_wb_err   [7]    )
762
    );
763
 
764
 
765 35 csantifort
ethmac_wb #(
766
    .WB_DWIDTH              ( WB_DWIDTH         ),
767
    .WB_SWIDTH              ( WB_SWIDTH         )
768
    )
769
u_ethmac_wb (
770
    // Wishbone arbiter side
771
    .o_m_wb_adr             ( m_wb_adr   [0]    ),
772
    .o_m_wb_sel             ( m_wb_sel   [0]    ),
773
    .o_m_wb_we              ( m_wb_we    [0]    ),
774
    .i_m_wb_rdat            ( m_wb_dat_r [0]    ),
775
    .o_m_wb_wdat            ( m_wb_dat_w [0]    ),
776
    .o_m_wb_cyc             ( m_wb_cyc   [0]    ),
777
    .o_m_wb_stb             ( m_wb_stb   [0]    ),
778
    .i_m_wb_ack             ( m_wb_ack   [0]    ),
779
    .i_m_wb_err             ( m_wb_err   [0]    ),
780 2 csantifort
 
781 35 csantifort
    // Wishbone arbiter side
782
    .i_s_wb_adr             ( s_wb_adr   [0]    ),
783
    .i_s_wb_sel             ( s_wb_sel   [0]    ),
784
    .i_s_wb_we              ( s_wb_we    [0]    ),
785
    .i_s_wb_cyc             ( s_wb_cyc   [0]    ),
786
    .i_s_wb_stb             ( s_wb_stb   [0]    ),
787
    .o_s_wb_ack             ( s_wb_ack   [0]    ),
788
    .i_s_wb_wdat            ( s_wb_dat_w [0]    ),
789
    .o_s_wb_rdat            ( s_wb_dat_r [0]    ),
790
    .o_s_wb_err             ( s_wb_err   [0]    ),
791
 
792
    // Ethmac side
793
    .i_m_wb_adr             ( emm_wb_adr        ),
794
    .i_m_wb_sel             ( emm_wb_sel        ),
795
    .i_m_wb_we              ( emm_wb_we         ),
796
    .o_m_wb_rdat            ( emm_wb_rdat       ),
797
    .i_m_wb_wdat            ( emm_wb_wdat       ),
798
    .i_m_wb_cyc             ( emm_wb_cyc        ),
799
    .i_m_wb_stb             ( emm_wb_stb        ),
800
    .o_m_wb_ack             ( emm_wb_ack        ),
801
    .o_m_wb_err             ( emm_wb_err        ),
802
 
803
    // Ethmac side
804
    .o_s_wb_adr             ( ems_wb_adr        ),
805
    .o_s_wb_sel             ( ems_wb_sel        ),
806
    .o_s_wb_we              ( ems_wb_we         ),
807
    .i_s_wb_rdat            ( ems_wb_rdat       ),
808
    .o_s_wb_wdat            ( ems_wb_wdat       ),
809
    .o_s_wb_cyc             ( ems_wb_cyc        ),
810
    .o_s_wb_stb             ( ems_wb_stb        ),
811
    .i_s_wb_ack             ( ems_wb_ack        ),
812
    .i_s_wb_err             ( ems_wb_err        )
813
);
814
 
815
 
816
 
817
 
818 2 csantifort
endmodule
819
 
820 35 csantifort
 

powered by: WebSVN 2.1.0

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