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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [rtl/] [gmac/] [top/] [g_mac_top.v] - Blame information for rev 17

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

Line No. Rev Author Line
1 12 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Tubo 8051 cores MAC Interface Module                        ////
4
////                                                              ////
5
////  This file is part of the Turbo 8051 cores project           ////
6
////  http://www.opencores.org/cores/turbo8051/                   ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Turbo 8051 definitions.                                     ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////    nothing                                                   ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Dinesh Annayya, dinesha@opencores.org                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
 
44
// ------------------------------------------------------------------------
45
// Description      : 
46
//   This module instantiates the MAC block and the FIFO interface
47
//
48
// ------------------------------------------------------------------------
49
module  g_mac_top (
50
                    scan_mode,
51
                    s_reset_n,
52
                    tx_reset_n,
53
                    rx_reset_n,
54
                    reset_mdio_clk_n,
55
                    app_reset_n,
56
 
57
                    app_clk,
58
                    app_send_pause_i,
59
                    app_send_pause_active_o,
60
                    app_send_jam_i,
61
 
62
                    // Application RX FIFO Interface
63
                    app_txfifo_wren_i,
64
                    app_txfifo_wrdata_i,
65
                    app_txfifo_full_o,
66
                    app_txfifo_space_o,
67
 
68
                    // Application TX FIFO Interface
69
                    app_rxfifo_rden_i,
70
                    app_rxfifo_empty_o,
71
                    app_rxfifo_cnt_o,
72
                    app_rxfifo_rdata_o,
73
 
74
                    // Conntrol Bus Sync with Application Clock
75
                    reg_cs,
76
                    reg_wr,
77
                    reg_addr,
78
                    reg_wdata,
79
                    reg_be,
80
 
81
                     // Outputs
82
                    reg_rdata,
83
                    reg_ack,
84
 
85
 
86
                    // Phy Signals 
87
 
88
                    // Line Side Interface TX Path
89
                    phy_tx_en,
90
                    phy_tx_er,
91
                    phy_txd,
92
                    phy_tx_clk,
93
 
94
                    // Line Side Interface RX Path
95
                    phy_rx_clk,
96
                    phy_rx_er,
97
                    phy_rx_dv,
98
                    phy_rxd,
99
                    phy_crs,
100
 
101
                    //MDIO interface
102
                    mdio_clk,
103
                    mdio_in,
104
                    mdio_out_en,
105
                    mdio_out
106
       );
107
 
108
parameter W  = 8'd9;
109
parameter DP = 8'd32;
110
parameter AW = (DP == 2)   ? 1 :
111
               (DP == 4)   ? 2 :
112
               (DP == 8)   ? 3 :
113
               (DP == 16)  ? 4 :
114
               (DP == 32)  ? 5 :
115
               (DP == 64)  ? 6 :
116
               (DP == 128) ? 7 :
117
               (DP == 256) ? 8 : 0;
118
 
119
 
120
//-----------------------------------------------------------------------
121
// INPUT/OUTPUT DECLARATIONS
122
//-----------------------------------------------------------------------
123
input                    scan_mode;
124
input                    s_reset_n;
125
input                    tx_reset_n;
126
input                    rx_reset_n;
127
input                    reset_mdio_clk_n;
128
input                    app_reset_n;
129
 
130
//-----------------------------------------------------------------------
131
// Application Clock Related Declaration
132
//-----------------------------------------------------------------------
133
input                    app_clk;
134
input                    app_send_pause_i;
135
output                   app_send_pause_active_o;
136
input                    app_send_jam_i;
137
 
138
 
139
// Application RX FIFO Interface
140
input                    app_txfifo_wren_i;
141
input  [8:0]             app_txfifo_wrdata_i;
142
output                   app_txfifo_full_o;
143
output [AW:0]            app_txfifo_space_o;
144
 
145
// Application TX FIFO Interface
146
input                    app_rxfifo_rden_i;
147
output                   app_rxfifo_empty_o;
148
output [AW:0]            app_rxfifo_cnt_o;
149
output [8:0]             app_rxfifo_rdata_o;
150
 
151
// Conntrol Bus Sync with Application Clock
152
//---------------------------------
153
// Reg Bus Interface Signal
154
//---------------------------------
155
input             reg_cs         ;
156
input             reg_wr         ;
157
input [3:0]       reg_addr       ;
158
input [31:0]      reg_wdata      ;
159
input [3:0]       reg_be         ;
160
 
161
   // Outputs
162
output [31:0]     reg_rdata      ;
163
output            reg_ack        ;
164
 
165
//-----------------------------------------------------------------------
166
// Line-Tx Signal
167
//-----------------------------------------------------------------------
168
output            phy_tx_en;
169
output            phy_tx_er;
170
output [7:0]      phy_txd;
171
input             phy_tx_clk;
172
 
173
//-----------------------------------------------------------------------
174
// Line-Rx Signal
175
//-----------------------------------------------------------------------
176
input             phy_rx_clk;
177
input             phy_rx_er;
178
input             phy_rx_dv;
179
input [7:0]       phy_rxd;
180
input             phy_crs;
181
 
182
 
183
//-----------------------------------------------------------------------
184
// MDIO Signal
185
//-----------------------------------------------------------------------
186
  input        mdio_clk;
187
  input        mdio_in;
188
  output       mdio_out_en;
189
  output       mdio_out;
190
 
191
//---------------------
192
// RX FIFO Interface Signal
193
  wire         clr_rx_error_from_rx_fsm_o;
194
  wire         rx_fifo_full_i;
195
  wire         rx_fifo_wr_o;
196
  wire  [8:0]  rx_fifo_data_o;
197
  wire         rx_commit_wr_o;
198
  wire         rx_commit_write_done_o;
199
  wire         rx_rewind_wr_o;
200
  wire         rx_fifo_error = 1'b0;
201
 
202
//-----------------------------------------------------------------------
203
// TX-Clock Domain Status Signal
204
//-----------------------------------------------------------------------
205
  wire        tx_commit_read;
206
  wire        tx_fifo_rd;
207
 
208
  wire [8:0]  tx_fifo_data;
209
  wire        tx_fifo_empty;
210
  wire        tx_fifo_rdy;
211
  wire [AW:0]  tx_fifo_aval;
212
 
213
g_mac_core u_mac_core  (
214
                    .scan_mode               (scan_mode),
215
                    .s_reset_n               (s_reset_n) ,
216
                    .tx_reset_n              (tx_reset_n) ,
217
                    .rx_reset_n              (rx_reset_n) ,
218
                    .reset_mdio_clk_n        (reset_mdio_clk_n) ,
219
                    .app_reset_n             (app_reset_n) ,
220
 
221
                 // Reg Bus Interface Signal
222
                    . reg_cs                 (reg_cs),
223
                    . reg_wr                 (reg_wr),
224
                    . reg_addr               (reg_addr),
225
                    . reg_wdata              (reg_wdata),
226
                    . reg_be                 (reg_be),
227
 
228
                     // Outputs
229
                     . reg_rdata             (reg_rdata),
230
                     . reg_ack               (reg_ack),
231
 
232
                    .app_clk                 (app_clk) ,
233
                    .app_send_pause_i        (app_send_pause_i) ,
234
                    .app_send_pause_active_o (app_send_pause_active_o) ,
235
                    .app_send_jam_i          (app_send_jam_i) ,
236
 
237
                    // Conntrol Bus Sync with Application Clock
238
 
239
 
240
 
241
                  // RX FIFO Interface Signal
242
                    .rx_fifo_full_i          (rx_fifo_full_i) ,
243
                    .rx_fifo_wr_o            (rx_fifo_wr_o) ,
244
                    .rx_fifo_data_o          (rx_fifo_data_o) ,
245
                    .rx_commit_wr_o          (rx_commit_wr_o) ,
246
                    .rx_rewind_wr_o          (rx_rewind_wr_o) ,
247
                    .rx_commit_write_done_o  (rx_commit_write_done_o) ,
248
                    .clr_rx_error_from_rx_fsm_o(clr_rx_error_from_rx_fsm_o) ,
249
                    .rx_fifo_error_i         (rx_fifo_error) ,
250
 
251
                  // TX FIFO Interface Signal
252
                    .tx_fifo_data_i          (tx_fifo_data) ,
253
                    .tx_fifo_empty_i         (tx_fifo_empty) ,
254
                    .tx_fifo_rdy_i           (tx_fifo_rdy) , // See to connect to config
255
                    .tx_fifo_rd_o            (tx_fifo_rd) ,
256
                    .tx_commit_read_o        (tx_commit_read) ,
257
 
258
                    // Phy Signals 
259
 
260
                    // Line Side Interface TX Path
261
                    .phy_tx_en               (phy_tx_en) ,
262
                    .phy_tx_er               (phy_tx_er) ,
263
                    .phy_txd                 (phy_txd) ,
264
                    .phy_tx_clk              (phy_tx_clk) ,
265
 
266
                    // Line Side Interface RX Path
267
                    .phy_rx_clk              (phy_rx_clk) ,
268
                    .phy_rx_er               (phy_rx_er) ,
269
                    .phy_rx_dv               (phy_rx_dv) ,
270
                    .phy_rxd                 (phy_rxd) ,
271
                    .phy_crs                 (phy_crs) ,
272
 
273
                    //MDIO interface
274
                    .mdio_clk                (mdio_clk) ,
275
                    .mdio_in                 (mdio_in) ,
276
                    .mdio_out_en             (mdio_out_en) ,
277
                    .mdio_out                (mdio_out)
278
       );
279
 
280
assign tx_fifo_rdy = (tx_fifo_aval > 8) ; // Dinesh-A Change it to config
281
 
282
async_fifo #(W,DP,0,0) u_mac_txfifo  (
283
                   .wr_clk                   (app_clk),
284
                   .wr_reset_n               (app_reset_n),
285
                   .wr_en                    (app_txfifo_wren_i),
286
                   .wr_data                  (app_txfifo_wrdata_i),
287
                   .full                     (app_txfifo_full_o), // sync'ed to wr_clk
288
                   .wr_total_free_space      (app_txfifo_space_o),
289
 
290
                   .rd_clk                   (phy_tx_clk),
291
                   .rd_reset_n               (tx_reset_n),
292
                   .rd_en                    (tx_fifo_rd),
293
                   .empty                    (tx_fifo_empty),  // sync'ed to rd_clk
294
                   .rd_total_aval            (tx_fifo_aval),
295
                   .rd_data                  (tx_fifo_data)
296
                   );
297
 
298
async_fifo #(W,DP,0,0) u_mac_rxfifo (
299
                   .wr_clk                   (phy_rx_clk),
300
                   .wr_reset_n               (rx_reset_n),
301
                   .wr_en                    (rx_fifo_wr_o),
302
                   .wr_data                  (rx_fifo_data_o),
303
                   .full                     (rx_fifo_full_i), // sync'ed to wr_clk
304
                   .wr_total_free_space      (),
305
 
306
                   .rd_clk                   (app_clk),
307
                   .rd_reset_n               (app_reset_n),
308
                   .rd_en                    (app_rxfifo_rden_i),
309
                   .empty                    (app_rxfifo_empty_o),  // sync'ed to rd_clk
310
                   .rd_total_aval            (app_rxfifo_cnt_o),
311
                   .rd_data                  (app_rxfifo_rdata_o)
312
                   );
313
 
314
 
315
 
316
endmodule
317
 

powered by: WebSVN 2.1.0

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