1 |
39 |
fisher5090 |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// MODULE NAME: rxStatModule ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// DESCRIPTION: Generate signals for statistics. These signals ////
|
6 |
|
|
//// will be used in Management Module. ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// This file is part of the 10 Gigabit Ethernet IP core project ////
|
10 |
|
|
//// http://www.opencores.org/projects/ethmac10g/ ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// AUTHOR(S): ////
|
13 |
|
|
//// Zheng Cao ////
|
14 |
|
|
//// ////
|
15 |
|
|
//////////////////////////////////////////////////////////////////////
|
16 |
|
|
//// ////
|
17 |
|
|
//// Copyright (c) 2005 AUTHORS. All rights reserved. ////
|
18 |
|
|
//// ////
|
19 |
|
|
//// This source file may be used and distributed without ////
|
20 |
|
|
//// restriction provided that this copyright statement is not ////
|
21 |
|
|
//// removed from the file and that any derivative work contains ////
|
22 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
23 |
|
|
//// ////
|
24 |
|
|
//// This source file is free software; you can redistribute it ////
|
25 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
26 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
27 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
28 |
|
|
//// later version. ////
|
29 |
|
|
//// ////
|
30 |
|
|
//// This source is distributed in the hope that it will be ////
|
31 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
32 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
33 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
34 |
|
|
//// details. ////
|
35 |
|
|
//// ////
|
36 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
37 |
|
|
//// Public License along with this source; if not, download it ////
|
38 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
39 |
|
|
//// ////
|
40 |
|
|
//////////////////////////////////////////////////////////////////////
|
41 |
|
|
//
|
42 |
|
|
// CVS REVISION HISTORY:
|
43 |
|
|
//
|
44 |
|
|
// $Log: not supported by cvs2svn $
|
45 |
|
|
// Revision 1.1 2005/12/25 16:43:10 Zheng Cao
|
46 |
|
|
//
|
47 |
|
|
//
|
48 |
|
|
//
|
49 |
|
|
//////////////////////////////////////////////////////////////////////
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
`include "timescale.v"
|
53 |
|
|
`include "xgiga_define.v"
|
54 |
|
|
|
55 |
|
|
module rxStatModule(rxclk, reset, good_frame_get,crc_check_invalid, large_error, small_error,
|
56 |
|
|
receiving, padded_frame, pause_frame, broad_valid, multi_valid,
|
57 |
|
|
length_65_127, length_128_255, length_256_511, length_512_1023, length_1024_max,
|
58 |
|
|
jumbo_frame, get_error_code, rxStatRegPlus);
|
59 |
|
|
|
60 |
|
|
input rxclk;
|
61 |
|
|
input reset;
|
62 |
|
|
input good_frame_get;
|
63 |
|
|
input large_error;
|
64 |
|
|
input small_error;
|
65 |
|
|
input crc_check_invalid;
|
66 |
|
|
input receiving;
|
67 |
|
|
input padded_frame;
|
68 |
|
|
input pause_frame;
|
69 |
|
|
input broad_valid;
|
70 |
|
|
input multi_valid;
|
71 |
|
|
input length_65_127;
|
72 |
|
|
input length_128_255;
|
73 |
|
|
input length_256_511;
|
74 |
|
|
input length_512_1023;
|
75 |
|
|
input length_1024_max;
|
76 |
|
|
input jumbo_frame;
|
77 |
|
|
input get_error_code;
|
78 |
|
|
output [17:0] rxStatRegPlus;
|
79 |
|
|
|
80 |
|
|
parameter TP =1;
|
81 |
|
|
|
82 |
|
|
wire[17:0] rxStatRegPlus_tmp;
|
83 |
|
|
|
84 |
|
|
////////////////////////////////////////////
|
85 |
|
|
// Count for Frames Received OK
|
86 |
|
|
////////////////////////////////////////////
|
87 |
|
|
assign rxStatRegPlus_tmp[0] = good_frame_get;
|
88 |
|
|
|
89 |
|
|
////////////////////////////////////////////
|
90 |
|
|
// Count for FCS check error
|
91 |
|
|
////////////////////////////////////////////
|
92 |
|
|
assign rxStatRegPlus_tmp[1] = crc_check_invalid;
|
93 |
|
|
|
94 |
|
|
////////////////////////////////////////////
|
95 |
|
|
// Count for BroadCast Frame Received OK
|
96 |
|
|
////////////////////////////////////////////
|
97 |
|
|
assign rxStatRegPlus_tmp[2] = broad_valid & good_frame_get;
|
98 |
|
|
|
99 |
|
|
/////////////////////////////////////////////
|
100 |
|
|
// Count for Multicast Frame Received OK
|
101 |
|
|
/////////////////////////////////////////////
|
102 |
|
|
assign rxStatRegPlus_tmp[3] = multi_valid & good_frame_get;
|
103 |
|
|
|
104 |
|
|
////////////////////////////////////////////
|
105 |
|
|
// Count for 64 byte Frame Received OK
|
106 |
|
|
////////////////////////////////////////////
|
107 |
|
|
assign rxStatRegPlus_tmp[4] = padded_frame & good_frame_get;
|
108 |
|
|
|
109 |
|
|
////////////////////////////////////////////
|
110 |
|
|
// Count for 65-127 byte Frames Received OK
|
111 |
|
|
////////////////////////////////////////////
|
112 |
|
|
assign rxStatRegPlus_tmp[5] = length_65_127 & good_frame_get;
|
113 |
|
|
|
114 |
|
|
////////////////////////////////////////////
|
115 |
|
|
// Count for 128-255 byte Frames Received OK
|
116 |
|
|
////////////////////////////////////////////
|
117 |
|
|
assign rxStatRegPlus_tmp[6] = length_128_255 & good_frame_get;
|
118 |
|
|
|
119 |
|
|
////////////////////////////////////////////
|
120 |
|
|
// Count for 256-511 byte Frames Received OK
|
121 |
|
|
////////////////////////////////////////////
|
122 |
|
|
assign rxStatRegPlus_tmp[7] = length_256_511 & good_frame_get;
|
123 |
|
|
|
124 |
|
|
//////////////////////////////////////////////
|
125 |
|
|
// Count for 512-1023 byte Frames Received OK
|
126 |
|
|
//////////////////////////////////////////////
|
127 |
|
|
assign rxStatRegPlus_tmp[8] = length_512_1023 & good_frame_get;
|
128 |
|
|
|
129 |
|
|
//////////////////////////////////////////////
|
130 |
|
|
// Count for 1024-1518 byte Frames Received OK
|
131 |
|
|
//////////////////////////////////////////////
|
132 |
|
|
assign rxStatRegPlus_tmp[9] = length_1024_max & good_frame_get;
|
133 |
|
|
|
134 |
|
|
//////////////////////////////////////////////
|
135 |
|
|
// Count for Control Frames Received OK
|
136 |
|
|
//////////////////////////////////////////////
|
137 |
|
|
assign rxStatRegPlus_tmp[10] = pause_frame & good_frame_get;
|
138 |
|
|
|
139 |
|
|
//////////////////////////////////////////////
|
140 |
|
|
// Count for Length/Type Out of Range
|
141 |
|
|
//////////////////////////////////////////////
|
142 |
|
|
assign rxStatRegPlus_tmp[11] = large_error;
|
143 |
|
|
|
144 |
|
|
//////////////////////////////////////////////
|
145 |
|
|
// Count for Pause Frames Received OK
|
146 |
|
|
//////////////////////////////////////////////
|
147 |
|
|
assign rxStatRegPlus_tmp[12] = pause_frame & good_frame_get;
|
148 |
|
|
|
149 |
|
|
/////////////////////////////////////////////////////////////
|
150 |
|
|
// Count for Control Frames Received with Unsupported Opcode.
|
151 |
|
|
/////////////////////////////////////////////////////////////
|
152 |
|
|
// assign rxStatRegPlus_tmp[13] = pause_frame & good_frame_get;
|
153 |
|
|
|
154 |
|
|
///////////////////////////////////////////////
|
155 |
|
|
// Count for Oversize Frames Received OK
|
156 |
|
|
///////////////////////////////////////////////
|
157 |
|
|
assign rxStatRegPlus_tmp[14] = jumbo_frame & good_frame_get;
|
158 |
|
|
|
159 |
|
|
///////////////////////////////////////////////
|
160 |
|
|
// Count for Undersized Frames Received
|
161 |
|
|
///////////////////////////////////////////////
|
162 |
|
|
assign rxStatRegPlus_tmp[15] = small_error;
|
163 |
|
|
|
164 |
|
|
///////////////////////////////////////////////
|
165 |
|
|
// Count for Fragment Frames Received
|
166 |
|
|
///////////////////////////////////////////////
|
167 |
|
|
assign rxStatRegPlus_tmp[16] = receiving & get_error_code;
|
168 |
|
|
|
169 |
|
|
///////////////////////////////////////////////
|
170 |
|
|
// Count for Number of Bytes Received
|
171 |
|
|
///////////////////////////////////////////////
|
172 |
|
|
assign rxStatRegPlus_tmp[17] = receiving;
|
173 |
|
|
|
174 |
|
|
reg[17:0] rxStatRegPlus;
|
175 |
|
|
always@(posedge rxclk or posedge reset) begin
|
176 |
|
|
if(reset)
|
177 |
|
|
rxStatRegPlus <=#TP 0;
|
178 |
|
|
else
|
179 |
|
|
rxStatRegPlus <=#TP rxStatRegPlus_tmp;
|
180 |
|
|
end
|
181 |
|
|
|
182 |
|
|
endmodule
|