1 |
5 |
maverickis |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// MAC_rx.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 |
|
|
module MAC_rx (
|
43 |
|
|
input Reset ,
|
44 |
|
|
input Clk_user,
|
45 |
|
|
input Clk ,
|
46 |
|
|
//RMII interface
|
47 |
|
|
input MCrs_dv ,
|
48 |
|
|
input [7:0] MRxD ,
|
49 |
|
|
input MRxErr ,
|
50 |
|
|
//flow_control signals
|
51 |
|
|
output [15:0] pause_quanta ,
|
52 |
|
|
output pause_quanta_val ,
|
53 |
|
|
//user interface
|
54 |
|
|
output Rx_mac_ra ,
|
55 |
|
|
input Rx_mac_rd ,
|
56 |
|
|
output[31:0] Rx_mac_data ,
|
57 |
|
|
output[1:0] Rx_mac_BE ,
|
58 |
|
|
output Rx_mac_pa ,
|
59 |
|
|
output Rx_mac_sop ,
|
60 |
|
|
output Rx_mac_eop ,
|
61 |
|
|
//CPU
|
62 |
|
|
input MAC_rx_add_chk_en ,
|
63 |
|
|
input [7:0] MAC_add_prom_data ,
|
64 |
|
|
input [2:0] MAC_add_prom_add ,
|
65 |
|
|
input MAC_add_prom_wr ,
|
66 |
|
|
input broadcast_filter_en ,
|
67 |
|
|
input [15:0] broadcast_MAX ,
|
68 |
|
|
input RX_APPEND_CRC,
|
69 |
|
|
input CRC_chk_en ,
|
70 |
|
|
input [5:0] RX_IFG_SET ,
|
71 |
|
|
input [15:0] RX_MAX_LENGTH ,// 1518
|
72 |
|
|
input [6:0] RX_MIN_LENGTH ,// 64
|
73 |
|
|
//RMON interface
|
74 |
|
|
output [15:0] Rx_pkt_length_rmon ,
|
75 |
|
|
output Rx_apply_rmon ,
|
76 |
|
|
output [2:0] Rx_pkt_err_type_rmon ,
|
77 |
|
|
output [2:0] Rx_pkt_type_rmon
|
78 |
|
|
);
|
79 |
|
|
//******************************************************************************
|
80 |
|
|
//internal signals
|
81 |
|
|
//******************************************************************************
|
82 |
|
|
//CRC_chk interface
|
83 |
|
|
wire CRC_en ;
|
84 |
|
|
wire CRC_init;
|
85 |
|
|
wire CRC_err ;
|
86 |
|
|
//MAC_rx_add_chk interface
|
87 |
|
|
wire MAC_add_en ;
|
88 |
|
|
wire MAC_rx_add_chk_err ;
|
89 |
|
|
//broadcast_filter
|
90 |
|
|
wire broadcast_ptr ;
|
91 |
|
|
wire broadcast_drop ;
|
92 |
|
|
//flow_control signals
|
93 |
|
|
wire [15:0] pause_quanta ;
|
94 |
|
|
wire pause_quanta_val ;
|
95 |
|
|
//MAC_rx_ctrl interface
|
96 |
|
|
wire [7:0] Fifo_data ;
|
97 |
|
|
wire Fifo_data_en ;
|
98 |
|
|
wire Fifo_full ;
|
99 |
|
|
wire Fifo_data_err ;
|
100 |
|
|
wire Fifo_data_end ;
|
101 |
|
|
//******************************************************************************
|
102 |
|
|
//instantiation
|
103 |
|
|
//******************************************************************************
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
MAC_rx_ctrl U_MAC_rx_ctrl(
|
107 |
|
|
.Reset (Reset ),
|
108 |
|
|
.Clk (Clk ),
|
109 |
|
|
//RMII interface ( //RMII interface ),
|
110 |
|
|
.MCrs_dv (MCrs_dv ),
|
111 |
|
|
.MRxD (MRxD ),
|
112 |
|
|
.MRxErr (MRxErr ),
|
113 |
|
|
//CRC_chk interface (//CRC_chk interface ),
|
114 |
|
|
.CRC_en (CRC_en ),
|
115 |
|
|
.CRC_init (CRC_init ),
|
116 |
|
|
.CRC_err (CRC_err ),
|
117 |
|
|
//MAC_rx_add_chk interface (//MAC_rx_add_chk interface),
|
118 |
|
|
.MAC_add_en (MAC_add_en ),
|
119 |
|
|
.MAC_rx_add_chk_err (MAC_rx_add_chk_err ),
|
120 |
|
|
//broadcast_filter (//broadcast_filter ),
|
121 |
|
|
.broadcast_ptr (broadcast_ptr ),
|
122 |
|
|
.broadcast_drop (broadcast_drop ),
|
123 |
|
|
//flow_control signals (//flow_control signals ),
|
124 |
|
|
.pause_quanta (pause_quanta ),
|
125 |
|
|
.pause_quanta_val (pause_quanta_val ),
|
126 |
|
|
//MAC_rx_FF interface (//MAC_rx_FF interface ),
|
127 |
|
|
.Fifo_data (Fifo_data ),
|
128 |
|
|
.Fifo_data_en (Fifo_data_en ),
|
129 |
|
|
.Fifo_data_err (Fifo_data_err ),
|
130 |
|
|
.Fifo_data_end (Fifo_data_end ),
|
131 |
|
|
.Fifo_full (Fifo_full ),
|
132 |
|
|
//RMON interface (//RMON interface ),
|
133 |
|
|
.Rx_pkt_type_rmon (Rx_pkt_type_rmon ),
|
134 |
|
|
.Rx_pkt_length_rmon (Rx_pkt_length_rmon ),
|
135 |
|
|
.Rx_apply_rmon (Rx_apply_rmon ),
|
136 |
|
|
.Rx_pkt_err_type_rmon (Rx_pkt_err_type_rmon ),
|
137 |
|
|
//CPU (//CPU ),
|
138 |
|
|
.RX_IFG_SET (RX_IFG_SET ),
|
139 |
|
|
.RX_MAX_LENGTH (RX_MAX_LENGTH ),
|
140 |
|
|
.RX_MIN_LENGTH (RX_MIN_LENGTH )
|
141 |
|
|
);
|
142 |
|
|
|
143 |
|
|
MAC_rx_FF U_MAC_rx_FF (
|
144 |
|
|
.Reset (Reset ),
|
145 |
|
|
.Clk_MAC (Clk ),
|
146 |
|
|
.Clk_SYS (Clk_user ),
|
147 |
|
|
//MAC_rx_ctrl interface (//MAC_rx_ctrl interface ),
|
148 |
|
|
.Fifo_data (Fifo_data ),
|
149 |
|
|
.Fifo_data_en (Fifo_data_en ),
|
150 |
|
|
.Fifo_full (Fifo_full ),
|
151 |
|
|
.Fifo_data_err (Fifo_data_err ),
|
152 |
|
|
.Fifo_data_end (Fifo_data_end ),
|
153 |
|
|
//CPU (//CPU ),
|
154 |
|
|
.RX_APPEND_CRC (RX_APPEND_CRC ),
|
155 |
|
|
//user interface (//user interface ),
|
156 |
|
|
.Rx_mac_ra (Rx_mac_ra ),
|
157 |
|
|
.Rx_mac_rd (Rx_mac_rd ),
|
158 |
|
|
.Rx_mac_data (Rx_mac_data ),
|
159 |
|
|
.Rx_mac_BE (Rx_mac_BE ),
|
160 |
|
|
.Rx_mac_sop (Rx_mac_sop ),
|
161 |
|
|
.Rx_mac_pa (Rx_mac_pa ),
|
162 |
|
|
.Rx_mac_eop (Rx_mac_eop )
|
163 |
|
|
);
|
164 |
|
|
|
165 |
|
|
Broadcast_filter U_Broadcast_filter(
|
166 |
|
|
.Reset (Reset ),
|
167 |
|
|
.Clk (Clk ),
|
168 |
|
|
//MAC_rx_ctrl (//MAC_rx_ctrl ),
|
169 |
|
|
.broadcast_ptr (broadcast_ptr ),
|
170 |
|
|
.broadcast_drop (broadcast_drop ),
|
171 |
|
|
//FromCPU (//FromCPU ),
|
172 |
|
|
.broadcast_filter_en (broadcast_filter_en ),
|
173 |
|
|
.broadcast_MAX (broadcast_MAX )
|
174 |
|
|
);
|
175 |
|
|
|
176 |
|
|
CRC_chk U_CRC_chk(
|
177 |
|
|
.Reset (Reset ),
|
178 |
|
|
.Clk (Clk ),
|
179 |
|
|
.CRC_data (Fifo_data ),
|
180 |
|
|
.CRC_init (CRC_init ),
|
181 |
|
|
.CRC_en (CRC_en ),
|
182 |
|
|
//From CPU (//From CPU ),
|
183 |
|
|
.CRC_chk_en (CRC_chk_en ),
|
184 |
|
|
.CRC_err (CRC_err )
|
185 |
|
|
);
|
186 |
|
|
|
187 |
|
|
MAC_rx_add_chk U_MAC_rx_add_chk(
|
188 |
|
|
.Reset (Reset ),
|
189 |
|
|
.Clk (Clk ),
|
190 |
|
|
.Init (CRC_init ),
|
191 |
|
|
.data (Fifo_data ),
|
192 |
|
|
.MAC_add_en (MAC_add_en ),
|
193 |
|
|
.MAC_rx_add_chk_err (MAC_rx_add_chk_err ),
|
194 |
|
|
//From CPU (//From CPU ),
|
195 |
|
|
.MAC_rx_add_chk_en (MAC_rx_add_chk_en ),
|
196 |
|
|
.MAC_add_prom_data (MAC_add_prom_data ),
|
197 |
|
|
.MAC_add_prom_add (MAC_add_prom_add ),
|
198 |
|
|
.MAC_add_prom_wr (MAC_add_prom_wr )
|
199 |
|
|
);
|
200 |
|
|
|
201 |
|
|
endmodule
|