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