1 |
39 |
fisher5090 |
//////////////////////////////////////////////////////////////////////
|
2 |
70 |
fisher5090 |
//// ////
|
3 |
|
|
//// MODULE NAME: rxStatModule ////
|
4 |
|
|
//// ////
|
5 |
39 |
fisher5090 |
//// DESCRIPTION: Generate signals for statistics. These signals ////
|
6 |
|
|
//// will be used in Management Module. ////
|
7 |
|
|
//// ////
|
8 |
70 |
fisher5090 |
//// ////
|
9 |
39 |
fisher5090 |
//// This file is part of the 10 Gigabit Ethernet IP core project ////
|
10 |
70 |
fisher5090 |
//// http://www.opencores.org/projects/ethmac10g/ ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// AUTHOR(S): ////
|
13 |
|
|
//// Zheng Cao ////
|
14 |
|
|
//// ////
|
15 |
39 |
fisher5090 |
//////////////////////////////////////////////////////////////////////
|
16 |
70 |
fisher5090 |
//// ////
|
17 |
|
|
//// Copyright (c) 2005 AUTHORS. All rights reserved. ////
|
18 |
|
|
//// ////
|
19 |
39 |
fisher5090 |
//// 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 |
70 |
fisher5090 |
//// from http://www.opencores.org/lgpl.shtml ////
|
39 |
|
|
//// ////
|
40 |
39 |
fisher5090 |
//////////////////////////////////////////////////////////////////////
|
41 |
|
|
//
|
42 |
|
|
// CVS REVISION HISTORY:
|
43 |
|
|
//
|
44 |
|
|
// $Log: not supported by cvs2svn $
|
45 |
70 |
fisher5090 |
// Revision 1.3 2006/06/11 12:15:23 Zheng Cao
|
46 |
|
|
// no message
|
47 |
|
|
//
|
48 |
39 |
fisher5090 |
// Revision 1.1 2005/12/25 16:43:10 Zheng Cao
|
49 |
|
|
//
|
50 |
|
|
//
|
51 |
|
|
//
|
52 |
|
|
//////////////////////////////////////////////////////////////////////
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
`include "timescale.v"
|
56 |
|
|
`include "xgiga_define.v"
|
57 |
|
|
|
58 |
|
|
module rxStatModule(rxclk, reset, good_frame_get,crc_check_invalid, large_error, small_error,
|
59 |
|
|
receiving, padded_frame, pause_frame, broad_valid, multi_valid,
|
60 |
70 |
fisher5090 |
length_65_127, length_128_255, length_256_511, length_512_1023, length_1024_max,
|
61 |
|
|
jumbo_frame, get_error_code, rxStatRegPlus);
|
62 |
39 |
fisher5090 |
|
63 |
70 |
fisher5090 |
input rxclk;
|
64 |
|
|
input reset;
|
65 |
|
|
input good_frame_get;
|
66 |
|
|
input large_error;
|
67 |
|
|
input small_error;
|
68 |
|
|
input crc_check_invalid;
|
69 |
|
|
input receiving;
|
70 |
|
|
input padded_frame;
|
71 |
|
|
input pause_frame;
|
72 |
|
|
input broad_valid;
|
73 |
|
|
input multi_valid;
|
74 |
|
|
input length_65_127;
|
75 |
|
|
input length_128_255;
|
76 |
|
|
input length_256_511;
|
77 |
|
|
input length_512_1023;
|
78 |
|
|
input length_1024_max;
|
79 |
|
|
input jumbo_frame;
|
80 |
|
|
input get_error_code;
|
81 |
|
|
output [17:0] rxStatRegPlus;
|
82 |
39 |
fisher5090 |
|
83 |
70 |
fisher5090 |
parameter TP =1;
|
84 |
39 |
fisher5090 |
|
85 |
70 |
fisher5090 |
wire[17:0] rxStatRegPlus_tmp;
|
86 |
39 |
fisher5090 |
|
87 |
70 |
fisher5090 |
////////////////////////////////////////////
|
88 |
|
|
// Count for Frames Received OK
|
89 |
|
|
////////////////////////////////////////////
|
90 |
|
|
assign rxStatRegPlus_tmp[0] = good_frame_get;
|
91 |
39 |
fisher5090 |
|
92 |
70 |
fisher5090 |
////////////////////////////////////////////
|
93 |
|
|
// Count for FCS check error
|
94 |
|
|
////////////////////////////////////////////
|
95 |
|
|
assign rxStatRegPlus_tmp[1] = crc_check_invalid;
|
96 |
39 |
fisher5090 |
|
97 |
70 |
fisher5090 |
////////////////////////////////////////////
|
98 |
|
|
// Count for BroadCast Frame Received OK
|
99 |
|
|
////////////////////////////////////////////
|
100 |
|
|
assign rxStatRegPlus_tmp[2] = broad_valid & good_frame_get;
|
101 |
39 |
fisher5090 |
|
102 |
70 |
fisher5090 |
/////////////////////////////////////////////
|
103 |
|
|
// Count for Multicast Frame Received OK
|
104 |
|
|
/////////////////////////////////////////////
|
105 |
|
|
assign rxStatRegPlus_tmp[3] = multi_valid & good_frame_get;
|
106 |
39 |
fisher5090 |
|
107 |
70 |
fisher5090 |
////////////////////////////////////////////
|
108 |
|
|
// Count for 64 byte Frame Received OK
|
109 |
|
|
////////////////////////////////////////////
|
110 |
|
|
assign rxStatRegPlus_tmp[4] = padded_frame & good_frame_get;
|
111 |
39 |
fisher5090 |
|
112 |
70 |
fisher5090 |
////////////////////////////////////////////
|
113 |
|
|
// Count for 65-127 byte Frames Received OK
|
114 |
|
|
////////////////////////////////////////////
|
115 |
|
|
assign rxStatRegPlus_tmp[5] = length_65_127 & good_frame_get;
|
116 |
39 |
fisher5090 |
|
117 |
70 |
fisher5090 |
////////////////////////////////////////////
|
118 |
|
|
// Count for 128-255 byte Frames Received OK
|
119 |
|
|
////////////////////////////////////////////
|
120 |
|
|
assign rxStatRegPlus_tmp[6] = length_128_255 & good_frame_get;
|
121 |
39 |
fisher5090 |
|
122 |
70 |
fisher5090 |
////////////////////////////////////////////
|
123 |
|
|
// Count for 256-511 byte Frames Received OK
|
124 |
|
|
////////////////////////////////////////////
|
125 |
|
|
assign rxStatRegPlus_tmp[7] = length_256_511 & good_frame_get;
|
126 |
39 |
fisher5090 |
|
127 |
70 |
fisher5090 |
//////////////////////////////////////////////
|
128 |
|
|
// Count for 512-1023 byte Frames Received OK
|
129 |
|
|
//////////////////////////////////////////////
|
130 |
|
|
assign rxStatRegPlus_tmp[8] = length_512_1023 & good_frame_get;
|
131 |
39 |
fisher5090 |
|
132 |
70 |
fisher5090 |
//////////////////////////////////////////////
|
133 |
|
|
// Count for 1024-1518 byte Frames Received OK
|
134 |
|
|
//////////////////////////////////////////////
|
135 |
|
|
assign rxStatRegPlus_tmp[9] = length_1024_max & good_frame_get;
|
136 |
39 |
fisher5090 |
|
137 |
70 |
fisher5090 |
//////////////////////////////////////////////
|
138 |
|
|
// Count for Control Frames Received OK
|
139 |
|
|
//////////////////////////////////////////////
|
140 |
|
|
assign rxStatRegPlus_tmp[10] = pause_frame & good_frame_get;
|
141 |
39 |
fisher5090 |
|
142 |
70 |
fisher5090 |
//////////////////////////////////////////////
|
143 |
|
|
// Count for Length/Type Out of Range
|
144 |
|
|
//////////////////////////////////////////////
|
145 |
|
|
assign rxStatRegPlus_tmp[11] = large_error;
|
146 |
39 |
fisher5090 |
|
147 |
70 |
fisher5090 |
//////////////////////////////////////////////
|
148 |
|
|
// Count for Pause Frames Received OK
|
149 |
|
|
//////////////////////////////////////////////
|
150 |
|
|
assign rxStatRegPlus_tmp[12] = pause_frame & good_frame_get;
|
151 |
39 |
fisher5090 |
|
152 |
70 |
fisher5090 |
/////////////////////////////////////////////////////////////
|
153 |
|
|
// Count for Control Frames Received with Unsupported Opcode.
|
154 |
|
|
/////////////////////////////////////////////////////////////
|
155 |
56 |
fisher5090 |
assign rxStatRegPlus_tmp[13] = 0;//pause_frame & good_frame_get;
|
156 |
39 |
fisher5090 |
|
157 |
70 |
fisher5090 |
///////////////////////////////////////////////
|
158 |
|
|
// Count for Oversize Frames Received OK
|
159 |
|
|
///////////////////////////////////////////////
|
160 |
|
|
assign rxStatRegPlus_tmp[14] = jumbo_frame & good_frame_get;
|
161 |
39 |
fisher5090 |
|
162 |
70 |
fisher5090 |
///////////////////////////////////////////////
|
163 |
|
|
// Count for Undersized Frames Received
|
164 |
|
|
///////////////////////////////////////////////
|
165 |
|
|
assign rxStatRegPlus_tmp[15] = small_error;
|
166 |
39 |
fisher5090 |
|
167 |
70 |
fisher5090 |
///////////////////////////////////////////////
|
168 |
|
|
// Count for Fragment Frames Received
|
169 |
|
|
///////////////////////////////////////////////
|
170 |
|
|
assign rxStatRegPlus_tmp[16] = receiving & get_error_code;
|
171 |
39 |
fisher5090 |
|
172 |
70 |
fisher5090 |
///////////////////////////////////////////////
|
173 |
|
|
// Count for Number of Bytes Received
|
174 |
|
|
///////////////////////////////////////////////
|
175 |
|
|
assign rxStatRegPlus_tmp[17] = receiving;
|
176 |
39 |
fisher5090 |
|
177 |
70 |
fisher5090 |
reg[17:0] rxStatRegPlus;
|
178 |
|
|
always@(posedge rxclk or posedge reset) begin
|
179 |
|
|
if(reset)
|
180 |
|
|
rxStatRegPlus <=#TP 0;
|
181 |
|
|
else
|
182 |
|
|
rxStatRegPlus <=#TP rxStatRegPlus_tmp;
|
183 |
|
|
end
|
184 |
39 |
fisher5090 |
|
185 |
|
|
endmodule
|