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 14

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 6 antanguay
    sc_out<bool> pkt_tx_eop;
82
    sc_out<unsigned int> pkt_tx_mod;
83 2 antanguay
    sc_out<bool> pkt_tx_sop;
84
    sc_out<bool> pkt_tx_val;
85
 
86
    sc_in<bool> pkt_tx_full;
87
 
88
    sc_in<bool> pkt_rx_avail;
89
    sc_in<sc_bv<64> > pkt_rx_data;
90 6 antanguay
    sc_in<bool> pkt_rx_eop;
91
    sc_in<unsigned int> pkt_rx_mod;
92 2 antanguay
    sc_in<bool> pkt_rx_err;
93
    sc_in<bool> pkt_rx_sop;
94
    sc_in<bool> pkt_rx_val;
95
 
96
    sc_out<bool> pkt_rx_ren;
97
 
98
    //---
99
    // Instances
100
 
101
    cpu_if cpu_if0;
102
 
103
    pkt_if pkt_if0;
104
    xgmii_if xgm_if0;
105
 
106
    pkt_generator pif_gen0;
107
    pkt_generator xgm_gen0;
108
 
109
    scoreboard sb;
110
 
111
    //---
112
    // Functions
113
 
114
    SC_CTOR(testbench) :
115
        cpu_if0("cpu_if0"),
116
        pkt_if0("pkt_if0"),
117
        xgm_if0("xgm_if0"),
118
        pif_gen0("pif_gen0"),
119
        xgm_gen0("xgm_gen0"),
120
        sb("sb") {
121
 
122
        //--
123
        // CPU Interface
124
 
125
        cpu_if0.wb_clk_i (wb_clk_i);
126
 
127
        cpu_if0.wb_rst_i (wb_rst_i);
128
 
129
        cpu_if0.wb_ack_o (wb_ack_o);
130
        cpu_if0.wb_dat_o (wb_dat_o);
131
        cpu_if0.wb_int_o (wb_int_o);
132
 
133
        cpu_if0.wb_adr_i (wb_adr_i);
134
        cpu_if0.wb_cyc_i (wb_cyc_i);
135
        cpu_if0.wb_dat_i (wb_dat_i);
136
        cpu_if0.wb_stb_i (wb_stb_i);
137
        cpu_if0.wb_we_i (wb_we_i);
138
 
139
        //---
140
        // Packet Interface
141
 
142
        pkt_if0.clk_156m25 (clk_156m25);
143
 
144
        pkt_if0.reset_156m25_n (reset_156m25_n);
145
 
146
        pkt_if0.pkt_tx_data (pkt_tx_data);
147
        pkt_if0.pkt_tx_eop (pkt_tx_eop);
148 6 antanguay
        pkt_if0.pkt_tx_mod (pkt_tx_mod);
149 2 antanguay
        pkt_if0.pkt_tx_sop (pkt_tx_sop);
150
        pkt_if0.pkt_tx_val (pkt_tx_val);
151
 
152
        pkt_if0.pkt_tx_full (pkt_tx_full);
153
 
154
        pkt_if0.pkt_rx_avail (pkt_rx_avail);
155
        pkt_if0.pkt_rx_data (pkt_rx_data);
156
        pkt_if0.pkt_rx_eop (pkt_rx_eop);
157 6 antanguay
        pkt_if0.pkt_rx_mod (pkt_rx_mod);
158 2 antanguay
        pkt_if0.pkt_rx_err (pkt_rx_err);
159
        pkt_if0.pkt_rx_sop (pkt_rx_sop);
160
        pkt_if0.pkt_rx_val (pkt_rx_val);
161
 
162
        pkt_if0.pkt_rx_ren (pkt_rx_ren);
163
 
164
        //---
165
        // XGMII Interface
166
 
167
        xgm_if0.clk_xgmii (clk_xgmii);
168
 
169
        xgm_if0.reset_xgmii_n (reset_xgmii_n);
170
 
171
        xgm_if0.xgmii_rxc (xgmii_rxc);
172
        xgm_if0.xgmii_rxd (xgmii_rxd);
173
 
174
        xgm_if0.xgmii_txc (xgmii_txc);
175
        xgm_if0.xgmii_txd (xgmii_txd);
176
 
177
        //---
178
        // Connect packet generators to physical interfaces
179
 
180
        pif_gen0.connect_fifo(pkt_if0.get_tx_fifo_ptr());
181
        xgm_gen0.connect_fifo(xgm_if0.get_tx_fifo_ptr());
182
 
183
        //---
184
        // Connector scoreboard to components
185
 
186
        pkt_if0.connect_scoreboard(&sb, scoreboard::SB_PIF_ID);
187
        xgm_if0.connect_scoreboard(&sb, scoreboard::SB_XGM_ID);
188
        cpu_if0.connect_scoreboard(&sb, scoreboard::SB_CPU_ID);
189
 
190
    }
191
 
192
};
193
 
194
#endif

powered by: WebSVN 2.1.0

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