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

Subversion Repositories ethernet_tri_mode

[/] [ethernet_tri_mode/] [trunk/] [rtl/] [verilog/] [MAC_tx.v] - Blame information for rev 35

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

Line No. Rev Author Line
1 5 maverickis
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3 7 maverickis
////  MAC_tx.v                                                    ////
4 5 maverickis
////                                                              ////
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 7 maverickis
////      - Jon Gao (gaojon@yahoo.com)                            ////
10 5 maverickis
////                                                              ////
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 6 maverickis
// $Log: not supported by cvs2svn $
42 23 maverickis
// Revision 1.3  2006/01/19 14:07:53  maverickist
43
// verification is complete.
44
//
45 7 maverickis
// Revision 1.2  2005/12/16 06:44:14  Administrator
46
// replaced tab with space.
47
// passed 9.6k length frame test.
48
//
49 6 maverickis
// Revision 1.1.1.1  2005/12/13 01:51:44  Administrator
50
// no message
51
//   
52 5 maverickis
module MAC_tx(
53 7 maverickis
input           Reset               ,
54
input           Clk                 ,
55
input           Clk_user            ,
56
                //PHY interface
57
output  [7:0]   TxD                 ,
58
output          TxEn                ,
59
input           CRS                 ,
60
                //RMON
61
output  [2:0]   Tx_pkt_type_rmon    ,
62
output  [15:0]  Tx_pkt_length_rmon  ,
63
output          Tx_apply_rmon       ,
64
output  [2:0]   Tx_pkt_err_type_rmon,
65
                //user interface 
66
output          Tx_mac_wa           ,
67
input           Tx_mac_wr           ,
68
input   [31:0]  Tx_mac_data         ,
69
input   [1:0]   Tx_mac_BE           ,//big endian
70
input           Tx_mac_sop          ,
71
input           Tx_mac_eop          ,
72
                //host interface 
73
input   [4:0]   Tx_Hwmark           ,
74
input   [4:0]   Tx_Lwmark           ,
75
input           pause_frame_send_en ,
76
input   [15:0]  pause_quanta_set    ,
77
input           MAC_tx_add_en       ,
78
input           FullDuplex          ,
79
input   [3:0]   MaxRetry            ,
80
input   [5:0]   IFGset              ,
81
input   [7:0]   MAC_add_prom_data   ,
82
input   [2:0]   MAC_add_prom_add    ,
83
input           MAC_add_prom_wr     ,
84
input           tx_pause_en         ,
85
input           xoff_cpu            ,
86
input           xon_cpu             ,
87
                //MAC_rx_flow       ,
88
input   [15:0]  pause_quanta        ,
89 23 maverickis
input           pause_quanta_val
90 5 maverickis
);
91 7 maverickis
//******************************************************************************        
92 5 maverickis
//internal signals                                                              
93
//******************************************************************************   
94 7 maverickis
                //CRC_gen Interface 
95
wire            CRC_init            ;
96
wire[7:0]       Frame_data          ;
97
wire            Data_en             ;
98
wire            CRC_rd              ;
99
wire            CRC_end             ;
100
wire[7:0]       CRC_out             ;
101
                //Ramdon_gen interface
102
wire            Random_init         ;
103
wire[3:0]       RetryCnt            ;
104
wire            Random_time_meet    ;//levle hight indicate random time passed away
105
                //flow control
106
wire            pause_apply         ;
107
wire            pause_quanta_sub    ;
108
wire            xoff_gen            ;
109
wire            xoff_gen_complete   ;
110
wire            xon_gen             ;
111
wire            xon_gen_complete    ;
112
                //MAC_rx_FF
113
wire[7:0]       Fifo_data           ;
114
wire            Fifo_rd             ;
115
wire            Fifo_eop            ;
116
wire            Fifo_da             ;
117
wire            Fifo_rd_finish      ;
118
wire            Fifo_rd_retry       ;
119
wire            Fifo_ra             ;
120
wire            Fifo_data_err_empty ;
121
wire            Fifo_data_err_full  ;
122
                //MAC_tx_addr_add
123
wire            MAC_tx_addr_init    ;
124
wire            MAC_tx_addr_rd      ;
125
wire[7:0]       MAC_tx_addr_data    ;
126 5 maverickis
 
127 7 maverickis
//******************************************************************************        
128 5 maverickis
//instantiation                                                              
129
//****************************************************************************** 
130
MAC_tx_ctrl U_MAC_tx_ctrl(
131 7 maverickis
.Reset                    (Reset                  ),
132
.Clk                      (Clk                    ),
133 5 maverickis
 //CRC_gen Interface      (//CRC_gen Interface    ),           
134 7 maverickis
.CRC_init                 (CRC_init               ),
135
.Frame_data               (Frame_data             ),
136
.Data_en                  (Data_en                ),
137
.CRC_rd                   (CRC_rd                 ),
138
.CRC_end                  (CRC_end                ),
139
.CRC_out                  (CRC_out                ),
140 5 maverickis
 //Ramdon_gen interfac    (//Ramdon_gen interfac  ),           
141 7 maverickis
.Random_init              (Random_init            ),
142
.RetryCnt                 (RetryCnt               ),
143
.Random_time_meet         (Random_time_meet       ),
144 5 maverickis
 //flow control           (//flow control         ),           
145 7 maverickis
.pause_apply              (pause_apply            ),
146
.pause_quanta_sub         (pause_quanta_sub       ),
147
.xoff_gen                 (xoff_gen               ),
148
.xoff_gen_complete        (xoff_gen_complete      ),
149
.xon_gen                  (xon_gen                ),
150
.xon_gen_complete         (xon_gen_complete       ),
151 5 maverickis
 //MAC_tx_FF              (//MAC_tx_FF            ),           
152 7 maverickis
.Fifo_data                (Fifo_data              ),
153
.Fifo_rd                  (Fifo_rd                ),
154
.Fifo_eop                 (Fifo_eop               ),
155
.Fifo_da                  (Fifo_da                ),
156
.Fifo_rd_finish           (Fifo_rd_finish         ),
157
.Fifo_rd_retry            (Fifo_rd_retry          ),
158
.Fifo_ra                  (Fifo_ra                ),
159
.Fifo_data_err_empty      (Fifo_data_err_empty    ),
160
.Fifo_data_err_full       (Fifo_data_err_full     ),
161 5 maverickis
 //RMII                   (//RMII                 ),           
162 7 maverickis
.TxD                      (TxD                    ),
163
.TxEn                     (TxEn                   ),
164
.CRS                      (CRS                    ),
165 5 maverickis
 //MAC_tx_addr_add        (//MAC_tx_addr_add      ),           
166 7 maverickis
.MAC_tx_addr_rd           (MAC_tx_addr_rd         ),
167
.MAC_tx_addr_data         (MAC_tx_addr_data       ),
168 5 maverickis
.MAC_tx_addr_init         (MAC_tx_addr_init       ),
169
 //RMON                   (//RMON                 ),           
170 7 maverickis
.Tx_pkt_type_rmon         (Tx_pkt_type_rmon       ),
171
.Tx_pkt_length_rmon       (Tx_pkt_length_rmon     ),
172
.Tx_apply_rmon            (Tx_apply_rmon          ),
173 5 maverickis
.Tx_pkt_err_type_rmon     (Tx_pkt_err_type_rmon   ),
174
 //CPU                    (//CPU                  ),           
175 7 maverickis
.pause_frame_send_en      (pause_frame_send_en    ),
176
.pause_quanta_set         (pause_quanta_set       ),
177
.MAC_tx_add_en            (MAC_tx_add_en          ),
178
.FullDuplex               (FullDuplex             ),
179
.MaxRetry                 (MaxRetry               ),
180
.IFGset                   (IFGset                 )
181 5 maverickis
);
182
 
183
CRC_gen U_CRC_gen(
184 7 maverickis
.Reset                    (Reset                  ),
185
.Clk                      (Clk                    ),
186
.Init                     (CRC_init               ),
187
.Frame_data               (Frame_data             ),
188
.Data_en                  (Data_en                ),
189
.CRC_rd                   (CRC_rd                 ),
190
.CRC_out                  (CRC_out                ),
191
.CRC_end                  (CRC_end                )
192 5 maverickis
);
193
 
194
flow_ctrl U_flow_ctrl(
195 7 maverickis
.Reset                    (Reset                  ),
196
.Clk                      (Clk                    ),
197
 //host processor         (//host processor       ),
198
.tx_pause_en              (tx_pause_en            ),
199
.xoff_cpu                 (xoff_cpu               ),
200
.xon_cpu                  (xon_cpu                ),
201
 //MAC_rx_flow            (//MAC_rx_flow          ),
202
.pause_quanta             (pause_quanta           ),
203
.pause_quanta_val         (pause_quanta_val       ),
204
 //MAC_tx_ctrl            (//MAC_tx_ctrl          ),
205
.pause_apply              (pause_apply            ),
206
.pause_quanta_sub         (pause_quanta_sub       ),
207
.xoff_gen                 (xoff_gen               ),
208
.xoff_gen_complete        (xoff_gen_complete      ),
209
.xon_gen                  (xon_gen                ),
210
.xon_gen_complete         (xon_gen_complete       )
211 5 maverickis
);
212
 
213 7 maverickis
`ifdef MAC_SOURCE_REPLACE_EN
214 5 maverickis
MAC_tx_addr_add U_MAC_tx_addr_add(
215 7 maverickis
.Reset                    (Reset                  ),
216
.Clk                      (Clk                    ),
217
.MAC_tx_addr_rd           (MAC_tx_addr_rd         ),
218 5 maverickis
.MAC_tx_addr_init         (MAC_tx_addr_init       ),
219 7 maverickis
.MAC_tx_addr_data         (MAC_tx_addr_data       ),
220 5 maverickis
 //CPU                    (//CPU                  ),
221 7 maverickis
.MAC_add_prom_data        (MAC_add_prom_data      ),
222
.MAC_add_prom_add         (MAC_add_prom_add       ),
223
.MAC_add_prom_wr          (MAC_add_prom_wr        )
224 5 maverickis
);
225 7 maverickis
`else
226
assign MAC_tx_addr_data=0;
227
`endif
228 5 maverickis
MAC_tx_FF U_MAC_tx_FF(
229 7 maverickis
.Reset                    (Reset                  ),
230
.Clk_MAC                  (Clk                    ),
231
.Clk_SYS                  (Clk_user               ),
232 5 maverickis
 //MAC_rx_ctrl interf     (//MAC_rx_ctrl interf   ),
233 7 maverickis
.Fifo_data                (Fifo_data              ),
234
.Fifo_rd                  (Fifo_rd                ),
235
.Fifo_rd_finish           (Fifo_rd_finish         ),
236
.Fifo_rd_retry            (Fifo_rd_retry          ),
237
.Fifo_eop                 (Fifo_eop               ),
238
.Fifo_da                  (Fifo_da                ),
239
.Fifo_ra                  (Fifo_ra                ),
240
.Fifo_data_err_empty      (Fifo_data_err_empty    ),
241
.Fifo_data_err_full       (Fifo_data_err_full     ),
242 5 maverickis
 //user interface         (//user interface       ),
243 7 maverickis
.Tx_mac_wa                (Tx_mac_wa              ),
244
.Tx_mac_wr                (Tx_mac_wr              ),
245
.Tx_mac_data              (Tx_mac_data            ),
246
.Tx_mac_BE                (Tx_mac_BE              ),
247
.Tx_mac_sop               (Tx_mac_sop             ),
248
.Tx_mac_eop               (Tx_mac_eop             ),
249 5 maverickis
 //host interface         (//host interface       ),
250 7 maverickis
.FullDuplex               (FullDuplex             ),
251
.Tx_Hwmark                (Tx_Hwmark              ),
252
.Tx_Lwmark                (Tx_Lwmark              )
253 5 maverickis
);
254
 
255
Ramdon_gen U_Ramdon_gen(
256 7 maverickis
.Reset                    (Reset                  ),
257
.Clk                      (Clk                    ),
258
.Init                     (Random_init            ),
259
.RetryCnt                 (RetryCnt               ),
260 5 maverickis
.Random_time_meet         (Random_time_meet       )
261
);
262
 
263
endmodule

powered by: WebSVN 2.1.0

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