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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [rtl/] [verilog/] [stats.v] - Blame information for rev 23

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

Line No. Rev Author Line
1 23 antanguay
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "wishbone.v"                                      ////
4
////                                                              ////
5
////  This file is part of the "10GE MAC" project                 ////
6
////  http://www.opencores.org/cores/xge_mac/                     ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - A. Tanguay (antanguay@opencores.org)                  ////
10
////                                                              ////
11
//////////////////////////////////////////////////////////////////////
12
////                                                              ////
13
//// Copyright (C) 2008 AUTHORS. All rights reserved.             ////
14
////                                                              ////
15
//// This source file may be used and distributed without         ////
16
//// restriction provided that this copyright statement is not    ////
17
//// removed from the file and that any derivative work contains  ////
18
//// the original copyright notice and the associated disclaimer. ////
19
////                                                              ////
20
//// This source file is free software; you can redistribute it   ////
21
//// and/or modify it under the terms of the GNU Lesser General   ////
22
//// Public License as published by the Free Software Foundation; ////
23
//// either version 2.1 of the License, or (at your option) any   ////
24
//// later version.                                               ////
25
////                                                              ////
26
//// This source is distributed in the hope that it will be       ////
27
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
28
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
29
//// PURPOSE.  See the GNU Lesser General Public License for more ////
30
//// details.                                                     ////
31
////                                                              ////
32
//// You should have received a copy of the GNU Lesser General    ////
33
//// Public License along with this source; if not, download it   ////
34
//// from http://www.opencores.org/lgpl.shtml                     ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
 
38
 
39
`include "defines.v"
40
 
41
module stats(/*AUTOARG*/
42
  // Outputs
43
  stats_tx_pkts, stats_rx_pkts,
44
  // Inputs
45
  wb_clk_i, wb_rst_i, status_good_frame_tx_tog,
46
  status_good_frame_tx_size, status_good_frame_rx_tog,
47
  status_good_frame_rx_size
48
  );
49
 
50
 
51
input         wb_clk_i;
52
input         wb_rst_i;
53
 
54
input         status_good_frame_tx_tog;
55
input  [13:0] status_good_frame_tx_size;
56
 
57
input         status_good_frame_rx_tog;
58
input  [13:0] status_good_frame_rx_size;
59
 
60
output [31:0] stats_tx_pkts;
61
 
62
output [31:0] stats_rx_pkts;
63
 
64
/*AUTOREG*/
65
// Beginning of automatic regs (for this module's undeclared outputs)
66
reg [31:0]              stats_rx_pkts;
67
reg [31:0]              stats_tx_pkts;
68
// End of automatics
69
 
70
 
71
/*AUTOWIRE*/
72
 
73
reg           status_good_frame_tx_tog_d1;
74
reg           status_good_frame_rx_tog_d1;
75
 
76
reg [31:0]    next_stats_rx_pkts;
77
reg [31:0]    next_stats_tx_pkts;
78
 
79
always @(posedge wb_clk_i or posedge wb_rst_i) begin
80
 
81
    if (wb_rst_i == 1'b1) begin
82
 
83
        status_good_frame_tx_tog_d1 <= status_good_frame_tx_tog;
84
        status_good_frame_rx_tog_d1 <= status_good_frame_rx_tog;
85
 
86
        stats_tx_pkts <= 32'b0;
87
        stats_rx_pkts <= 32'b0;
88
 
89
    end
90
    else begin
91
 
92
        status_good_frame_tx_tog_d1 <= status_good_frame_tx_tog;
93
        status_good_frame_rx_tog_d1 <= status_good_frame_rx_tog;
94
 
95
        stats_tx_pkts <= next_stats_tx_pkts;
96
        stats_rx_pkts <= next_stats_rx_pkts;
97
 
98
    end
99
 
100
end
101
 
102
always @(/*AS*/stats_rx_pkts or stats_tx_pkts
103
         or status_good_frame_rx_tog or status_good_frame_rx_tog_d1
104
         or status_good_frame_tx_tog or status_good_frame_tx_tog_d1) begin
105
 
106
    next_stats_tx_pkts = stats_tx_pkts;
107
    next_stats_rx_pkts = stats_rx_pkts;
108
 
109
    if (status_good_frame_tx_tog_d1 != status_good_frame_tx_tog) begin
110
        next_stats_tx_pkts = stats_tx_pkts + 32'b1;
111
    end
112
 
113
    if (status_good_frame_rx_tog_d1 != status_good_frame_rx_tog) begin
114
        next_stats_rx_pkts = stats_rx_pkts + 32'b1;
115
    end
116
 
117
end
118
 
119
endmodule

powered by: WebSVN 2.1.0

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