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

Subversion Repositories sgmii

[/] [sgmii/] [trunk/] [build/] [OpenCore_MAC/] [MAC_tx.v] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 jefflieu
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  MAC_tx.v                                                    ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/projects.cgi/web/ethernet_tri_mode/////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Jon Gao (gaojon@yahoo.com)                            ////
10
////                                                              ////
11
////                                                              ////
12
//////////////////////////////////////////////////////////////////////
13
////                                                              ////
14
//// Copyright (C) 2001 Authors                                   ////
15
////                                                              ////
16
//// This source file may be used and distributed without         ////
17
//// restriction provided that this copyright statement is not    ////
18
//// removed from the file and that any derivative work contains  ////
19
//// the original copyright notice and the associated disclaimer. ////
20
////                                                              ////
21
//// This source file is free software; you can redistribute it   ////
22
//// and/or modify it under the terms of the GNU Lesser General   ////
23
//// Public License as published by the Free Software Foundation; ////
24
//// either version 2.1 of the License, or (at your option) any   ////
25
//// later version.                                               ////
26
////                                                              ////
27
//// This source is distributed in the hope that it will be       ////
28
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
29
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
30
//// PURPOSE.  See the GNU Lesser General Public License for more ////
31
//// details.                                                     ////
32
////                                                              ////
33
//// You should have received a copy of the GNU Lesser General    ////
34
//// Public License along with this source; if not, download it   ////
35
//// from http://www.opencores.org/lgpl.shtml                     ////
36
////                                                              ////
37
//////////////////////////////////////////////////////////////////////
38
//                                                                    
39
// CVS Revision History                                               
40
//                                                                    
41
// $Log: not supported by cvs2svn $
42
// Revision 1.3  2006/01/19 14:07:53  maverickist
43
// verification is complete.
44
//
45
// Revision 1.2  2005/12/16 06:44:14  Administrator
46
// replaced tab with space.
47
// passed 9.6k length frame test.
48
//
49
// Revision 1.1.1.1  2005/12/13 01:51:44  Administrator
50
// no message
51
//
52
`include "header.v"
53
module MAC_tx(
54
input           Reset               ,
55
input           Clk                 ,
56
input           Clk_user            ,
57
                //PHY interface
58
output  [7:0]   TxD                 ,
59
output          TxEn                ,
60
input           CRS                 ,
61
                //RMON
62
output  [2:0]   Tx_pkt_type_rmon    ,
63
output  [15:0]  Tx_pkt_length_rmon  ,
64
output          Tx_apply_rmon       ,
65
output  [2:0]   Tx_pkt_err_type_rmon,
66
                //user interface 
67
output          Tx_mac_wa           ,
68
input           Tx_mac_wr           ,
69
input   [31:0]  Tx_mac_data         ,
70
input   [1:0]   Tx_mac_BE           ,//big endian
71
input           Tx_mac_sop          ,
72
input           Tx_mac_eop          ,
73
                //host interface 
74
input   [4:0]   Tx_Hwmark           ,
75
input   [4:0]   Tx_Lwmark           ,
76
input           pause_frame_send_en ,
77
input   [15:0]  pause_quanta_set    ,
78
input           MAC_tx_add_en       ,
79
input           FullDuplex          ,
80
input   [3:0]   MaxRetry            ,
81
input   [5:0]   IFGset              ,
82
input   [7:0]   MAC_add_prom_data   ,
83
input   [2:0]   MAC_add_prom_add    ,
84
input           MAC_add_prom_wr     ,
85
input           tx_pause_en         ,
86
input           xoff_cpu            ,
87
input           xon_cpu             ,
88
                //MAC_rx_flow       ,
89
input   [15:0]  pause_quanta        ,
90
input           pause_quanta_val
91
);
92
//******************************************************************************        
93
//internal signals                                                              
94
//******************************************************************************   
95
                //CRC_gen Interface 
96
wire            CRC_init            ;
97
wire[7:0]       Frame_data          ;
98
wire            Data_en             ;
99
wire            CRC_rd              ;
100
wire            CRC_end             ;
101
wire[7:0]       CRC_out             ;
102
                //Ramdon_gen interface
103
wire            Random_init         ;
104
wire[3:0]       RetryCnt            ;
105
wire            Random_time_meet    ;//levle hight indicate random time passed away
106
                //flow control
107
wire            pause_apply         ;
108
wire            pause_quanta_sub    ;
109
wire            xoff_gen            ;
110
wire            xoff_gen_complete   ;
111
wire            xon_gen             ;
112
wire            xon_gen_complete    ;
113
                //MAC_rx_FF
114
wire[7:0]       Fifo_data           ;
115
wire            Fifo_rd             ;
116
wire            Fifo_eop            ;
117
wire            Fifo_da             ;
118
wire            Fifo_rd_finish      ;
119
wire            Fifo_rd_retry       ;
120
wire            Fifo_ra             ;
121
wire            Fifo_data_err_empty ;
122
wire            Fifo_data_err_full  ;
123
                //MAC_tx_addr_add
124
wire            MAC_tx_addr_init    ;
125
wire            MAC_tx_addr_rd      ;
126
wire[7:0]       MAC_tx_addr_data    ;
127
 
128
//******************************************************************************        
129
//instantiation                                                              
130
//****************************************************************************** 
131
MAC_tx_ctrl U_MAC_tx_ctrl(
132
.Reset                    (Reset                  ),
133
.Clk                      (Clk                    ),
134
 //CRC_gen Interface      (//CRC_gen Interface    ),           
135
.CRC_init                 (CRC_init               ),
136
.Frame_data               (Frame_data             ),
137
.Data_en                  (Data_en                ),
138
.CRC_rd                   (CRC_rd                 ),
139
.CRC_end                  (CRC_end                ),
140
.CRC_out                  (CRC_out                ),
141
 //Ramdon_gen interfac    (//Ramdon_gen interfac  ),           
142
.Random_init              (Random_init            ),
143
.RetryCnt                 (RetryCnt               ),
144
.Random_time_meet         (Random_time_meet       ),
145
 //flow control           (//flow control         ),           
146
.pause_apply              (pause_apply            ),
147
.pause_quanta_sub         (pause_quanta_sub       ),
148
.xoff_gen                 (xoff_gen               ),
149
.xoff_gen_complete        (xoff_gen_complete      ),
150
.xon_gen                  (xon_gen                ),
151
.xon_gen_complete         (xon_gen_complete       ),
152
 //MAC_tx_FF              (//MAC_tx_FF            ),           
153
.Fifo_data                (Fifo_data              ),
154
.Fifo_rd                  (Fifo_rd                ),
155
.Fifo_eop                 (Fifo_eop               ),
156
.Fifo_da                  (Fifo_da                ),
157
.Fifo_rd_finish           (Fifo_rd_finish         ),
158
.Fifo_rd_retry            (Fifo_rd_retry          ),
159
.Fifo_ra                  (Fifo_ra                ),
160
.Fifo_data_err_empty      (Fifo_data_err_empty    ),
161
.Fifo_data_err_full       (Fifo_data_err_full     ),
162
 //RMII                   (//RMII                 ),           
163
.TxD                      (TxD                    ),
164
.TxEn                     (TxEn                   ),
165
.CRS                      (CRS                    ),
166
 //MAC_tx_addr_add        (//MAC_tx_addr_add      ),           
167
.MAC_tx_addr_rd           (MAC_tx_addr_rd         ),
168
.MAC_tx_addr_data         (MAC_tx_addr_data       ),
169
.MAC_tx_addr_init         (MAC_tx_addr_init       ),
170
 //RMON                   (//RMON                 ),           
171
.Tx_pkt_type_rmon         (Tx_pkt_type_rmon       ),
172
.Tx_pkt_length_rmon       (Tx_pkt_length_rmon     ),
173
.Tx_apply_rmon            (Tx_apply_rmon          ),
174
.Tx_pkt_err_type_rmon     (Tx_pkt_err_type_rmon   ),
175
 //CPU                    (//CPU                  ),           
176
.pause_frame_send_en      (pause_frame_send_en    ),
177
.pause_quanta_set         (pause_quanta_set       ),
178
.MAC_tx_add_en            (MAC_tx_add_en          ),
179
.FullDuplex               (FullDuplex             ),
180
.MaxRetry                 (MaxRetry               ),
181
.IFGset                   (IFGset                 )
182
);
183
 
184
CRC_gen U_CRC_gen(
185
.Reset                    (Reset                  ),
186
.Clk                      (Clk                    ),
187
.Init                     (CRC_init               ),
188
.Frame_data               (Frame_data             ),
189
.Data_en                  (Data_en                ),
190
.CRC_rd                   (CRC_rd                 ),
191
.CRC_out                  (CRC_out                ),
192
.CRC_end                  (CRC_end                )
193
);
194
 
195
flow_ctrl U_flow_ctrl(
196
.Reset                    (Reset                  ),
197
.Clk                      (Clk                    ),
198
 //host processor         (//host processor       ),
199
.tx_pause_en              (tx_pause_en            ),
200
.xoff_cpu                 (xoff_cpu               ),
201
.xon_cpu                  (xon_cpu                ),
202
 //MAC_rx_flow            (//MAC_rx_flow          ),
203
.pause_quanta             (pause_quanta           ),
204
.pause_quanta_val         (pause_quanta_val       ),
205
 //MAC_tx_ctrl            (//MAC_tx_ctrl          ),
206
.pause_apply              (pause_apply            ),
207
.pause_quanta_sub         (pause_quanta_sub       ),
208
.xoff_gen                 (xoff_gen               ),
209
.xoff_gen_complete        (xoff_gen_complete      ),
210
.xon_gen                  (xon_gen                ),
211
.xon_gen_complete         (xon_gen_complete       )
212
);
213
 
214
`ifdef MAC_SOURCE_REPLACE_EN
215
MAC_tx_addr_add U_MAC_tx_addr_add(
216
.Reset                    (Reset                  ),
217
.Clk                      (Clk                    ),
218
.MAC_tx_addr_rd           (MAC_tx_addr_rd         ),
219
.MAC_tx_addr_init         (MAC_tx_addr_init       ),
220
.MAC_tx_addr_data         (MAC_tx_addr_data       ),
221
 //CPU                    (//CPU                  ),
222
.MAC_add_prom_data        (MAC_add_prom_data      ),
223
.MAC_add_prom_add         (MAC_add_prom_add       ),
224
.MAC_add_prom_wr          (MAC_add_prom_wr        )
225
);
226
`else
227
assign MAC_tx_addr_data=0;
228
`endif
229
MAC_tx_FF U_MAC_tx_FF(
230
.Reset                    (Reset                  ),
231
.Clk_MAC                  (Clk                    ),
232
.Clk_SYS                  (Clk_user               ),
233
 //MAC_rx_ctrl interf     (//MAC_rx_ctrl interf   ),
234
.Fifo_data                (Fifo_data              ),
235
.Fifo_rd                  (Fifo_rd                ),
236
.Fifo_rd_finish           (Fifo_rd_finish         ),
237
.Fifo_rd_retry            (Fifo_rd_retry          ),
238
.Fifo_eop                 (Fifo_eop               ),
239
.Fifo_da                  (Fifo_da                ),
240
.Fifo_ra                  (Fifo_ra                ),
241
.Fifo_data_err_empty      (Fifo_data_err_empty    ),
242
.Fifo_data_err_full       (Fifo_data_err_full     ),
243
 //user interface         (//user interface       ),
244
.Tx_mac_wa                (Tx_mac_wa              ),
245
.Tx_mac_wr                (Tx_mac_wr              ),
246
.Tx_mac_data              (Tx_mac_data            ),
247
.Tx_mac_BE                (Tx_mac_BE              ),
248
.Tx_mac_sop               (Tx_mac_sop             ),
249
.Tx_mac_eop               (Tx_mac_eop             ),
250
 //host interface         (//host interface       ),
251
.FullDuplex               (FullDuplex             ),
252
.Tx_Hwmark                (Tx_Hwmark              ),
253
.Tx_Lwmark                (Tx_Lwmark              )
254
);
255
 
256
Ramdon_gen U_Ramdon_gen(
257
.Reset                    (Reset                  ),
258
.Clk                      (Clk                    ),
259
.Init                     (Random_init            ),
260
.RetryCnt                 (RetryCnt               ),
261
.Random_time_meet         (Random_time_meet       )
262
);
263
 
264
endmodule

powered by: WebSVN 2.1.0

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