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

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [systemc/] [sc_testbench.h] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 antanguay
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "sc_testbench.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 TESTBENCH_H
39
#define TESTBENCH_H
40
 
41
#include "systemc.h"            // SystemC global header
42
 
43
#include "sc_cpu_if.h"
44
#include "sc_pkt_if.h"
45
#include "sc_xgmii_if.h"
46
#include "sc_pkt_generator.h"
47
#include "sc_scoreboard.h"
48
 
49
SC_MODULE(testbench) {
50
 
51
  public:
52
 
53
    //---
54
    // Ports
55
 
56
    sc_in<bool> clk_156m25;
57
    sc_in<bool> clk_xgmii;
58
    sc_in<bool> wb_clk_i;
59
 
60
    sc_in<bool> reset_156m25_n;
61
    sc_in<bool> reset_xgmii_n;
62
    sc_in<bool> wb_rst_i;
63
 
64
    sc_in<bool> wb_ack_o;
65
    sc_in<unsigned int> wb_dat_o;
66
    sc_in<bool> wb_int_o;
67
 
68
    sc_out<unsigned int> wb_adr_i;
69
    sc_out<bool> wb_cyc_i;
70
    sc_out<unsigned int> wb_dat_i;
71
    sc_out<bool> wb_stb_i;
72
    sc_out<bool> wb_we_i;
73
 
74
    sc_out<unsigned int> xgmii_rxc;
75
    sc_out<sc_bv<64> > xgmii_rxd;
76
 
77
    sc_in<unsigned int> xgmii_txc;
78
    sc_in<sc_bv<64> > xgmii_txd;
79
 
80
    sc_out<sc_bv<64> > pkt_tx_data;
81
    sc_out<unsigned int> pkt_tx_eop;
82
    sc_out<bool> pkt_tx_sop;
83
    sc_out<bool> pkt_tx_val;
84
 
85
    sc_in<bool> pkt_tx_full;
86
 
87
    sc_in<bool> pkt_rx_avail;
88
    sc_in<sc_bv<64> > pkt_rx_data;
89
    sc_in<unsigned int> pkt_rx_eop;
90
    sc_in<bool> pkt_rx_err;
91
    sc_in<bool> pkt_rx_sop;
92
    sc_in<bool> pkt_rx_val;
93
 
94
    sc_out<bool> pkt_rx_ren;
95
 
96
    //---
97
    // Instances
98
 
99
    cpu_if cpu_if0;
100
 
101
    pkt_if pkt_if0;
102
    xgmii_if xgm_if0;
103
 
104
    pkt_generator pif_gen0;
105
    pkt_generator xgm_gen0;
106
 
107
    scoreboard sb;
108
 
109
    //---
110
    // Functions
111
 
112
    SC_CTOR(testbench) :
113
        cpu_if0("cpu_if0"),
114
        pkt_if0("pkt_if0"),
115
        xgm_if0("xgm_if0"),
116
        pif_gen0("pif_gen0"),
117
        xgm_gen0("xgm_gen0"),
118
        sb("sb") {
119
 
120
        //--
121
        // CPU Interface
122
 
123
        cpu_if0.wb_clk_i (wb_clk_i);
124
 
125
        cpu_if0.wb_rst_i (wb_rst_i);
126
 
127
        cpu_if0.wb_ack_o (wb_ack_o);
128
        cpu_if0.wb_dat_o (wb_dat_o);
129
        cpu_if0.wb_int_o (wb_int_o);
130
 
131
        cpu_if0.wb_adr_i (wb_adr_i);
132
        cpu_if0.wb_cyc_i (wb_cyc_i);
133
        cpu_if0.wb_dat_i (wb_dat_i);
134
        cpu_if0.wb_stb_i (wb_stb_i);
135
        cpu_if0.wb_we_i (wb_we_i);
136
 
137
        //---
138
        // Packet Interface
139
 
140
        pkt_if0.clk_156m25 (clk_156m25);
141
 
142
        pkt_if0.reset_156m25_n (reset_156m25_n);
143
 
144
        pkt_if0.pkt_tx_data (pkt_tx_data);
145
        pkt_if0.pkt_tx_eop (pkt_tx_eop);
146
        pkt_if0.pkt_tx_sop (pkt_tx_sop);
147
        pkt_if0.pkt_tx_val (pkt_tx_val);
148
 
149
        pkt_if0.pkt_tx_full (pkt_tx_full);
150
 
151
        pkt_if0.pkt_rx_avail (pkt_rx_avail);
152
        pkt_if0.pkt_rx_data (pkt_rx_data);
153
        pkt_if0.pkt_rx_eop (pkt_rx_eop);
154
        pkt_if0.pkt_rx_err (pkt_rx_err);
155
        pkt_if0.pkt_rx_sop (pkt_rx_sop);
156
        pkt_if0.pkt_rx_val (pkt_rx_val);
157
 
158
        pkt_if0.pkt_rx_ren (pkt_rx_ren);
159
 
160
        //---
161
        // XGMII Interface
162
 
163
        xgm_if0.clk_xgmii (clk_xgmii);
164
 
165
        xgm_if0.reset_xgmii_n (reset_xgmii_n);
166
 
167
        xgm_if0.xgmii_rxc (xgmii_rxc);
168
        xgm_if0.xgmii_rxd (xgmii_rxd);
169
 
170
        xgm_if0.xgmii_txc (xgmii_txc);
171
        xgm_if0.xgmii_txd (xgmii_txd);
172
 
173
        //---
174
        // Connect packet generators to physical interfaces
175
 
176
        pif_gen0.connect_fifo(pkt_if0.get_tx_fifo_ptr());
177
        xgm_gen0.connect_fifo(xgm_if0.get_tx_fifo_ptr());
178
 
179
        //---
180
        // Connector scoreboard to components
181
 
182
        pkt_if0.connect_scoreboard(&sb, scoreboard::SB_PIF_ID);
183
        xgm_if0.connect_scoreboard(&sb, scoreboard::SB_XGM_ID);
184
        cpu_if0.connect_scoreboard(&sb, scoreboard::SB_CPU_ID);
185
 
186
    }
187
 
188
};
189
 
190
#endif

powered by: WebSVN 2.1.0

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