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 22

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

powered by: WebSVN 2.1.0

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