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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_scoreboard.h] - Blame information for rev 29

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 antanguay
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "sc_scoreboard.h"                                 ////
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
#ifndef SCOREBOARD_H
39
#define SCOREBOARD_H
40
 
41
#include "systemc.h"
42
 
43
#include "sc_packet.h"
44
 
45
 
46
struct sbStats_t {
47
    int tx_pkt_cnt;
48
    int rx_pkt_cnt;
49
 
50 29 antanguay
    int tx_octets_cnt;
51
    int rx_octets_cnt;
52
 
53 2 antanguay
    int crc_error_cnt;
54
    int fragment_error_cnt;
55 29 antanguay
    int lenght_error_cnt;
56 2 antanguay
    int coding_error_cnt;
57
    int flags_error_cnt;
58
 
59
    int inject_local_fault_cnt;
60
    int inject_remote_fault_cnt;
61
 
62
    int inject_pause_frame_cnt;
63
 
64
    int detect_local_fault_cnt;
65
    int detect_remote_fault_cnt;
66
 
67
    double timestamp_first_pkt;
68
    double timestamp_last_pkt;
69
 
70
    int next_ifg_length;
71
    int deficit_idle_count;
72
};
73
 
74
struct sbCpuStats_t {
75
    int crc_error_cnt;
76
    int fragment_error_cnt;
77 29 antanguay
    int lenght_error_cnt;
78 2 antanguay
 
79
    int rxd_fifo_ovflow_cnt;
80
    int rxd_fifo_udflow_cnt;
81
    int txd_fifo_ovflow_cnt;
82
    int txd_fifo_udflow_cnt;
83
 
84
    int rx_pause_frame_cnt;
85
 
86
    int local_fault_cnt;
87
    int remote_fault_cnt;
88
};
89
 
90
SC_MODULE(scoreboard) {
91
 
92
  public:
93
 
94
    //---
95
    // Types
96
 
97
    enum sbSourceId {
98
        SB_PIF_ID,
99
        SB_XGM_ID,
100
        SB_CPU_ID,
101
    };
102
 
103
    enum sbStatusId {
104
        CRC_ERROR,
105
        FRAGMENT_ERROR,
106 29 antanguay
        LENGHT_ERROR,
107 2 antanguay
        LOCAL_FAULT,
108
        REMOTE_FAULT,
109
        RXD_FIFO_OVFLOW,
110
        RXD_FIFO_UDFLOW,
111
        TXD_FIFO_OVFLOW,
112
        TXD_FIFO_UDFLOW,
113
        RX_GOOD_PAUSE_FRAME,
114
    };
115
 
116
  private:
117
 
118
    //---
119
    // Variables
120
 
121
    sc_fifo<packet_t*> pif_fifo;
122
    sc_fifo<packet_t*> xgm_fifo;
123
 
124
    sbStats_t pif_stats;
125
    sbStats_t xgm_stats;
126
    sbCpuStats_t cpu_stats;
127
 
128
  public:
129
 
130
    //---
131
    // Variables
132
 
133
    bool disable_padding;
134
    bool disable_crc_check;
135
    bool disable_packet_check;
136
    bool disable_flags_check;
137
    bool disable_signal_check;
138
 
139
    //---
140
    // Functions
141
 
142
    void init(void);
143
 
144
    void notify_packet_tx(sbSourceId sid, packet_t* pkt);
145
    void notify_packet_rx(sbSourceId sid, packet_t* pkt);
146
    void notify_status(sbSourceId sid, sbStatusId statusId);
147
 
148
    sbStats_t* get_pif_stats(void);
149
    sbStats_t* get_xgm_stats(void);
150
    sbCpuStats_t* get_cpu_stats(void);
151
 
152
    void clear_stats(void);
153
 
154 29 antanguay
    SC_CTOR(scoreboard):
155 2 antanguay
        pif_fifo (2000),
156
        xgm_fifo (2000) {
157
 
158
    }
159
 
160
};
161
 
162
 
163
#endif

powered by: WebSVN 2.1.0

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