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

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [tags/] [START/] [bench/] [link_l2/] [link_frame_tx_l3_tb/] [main.cpp] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//main.cpp
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is HyperTransport Tunnel IP Core.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * Ecole Polytechnique de Montreal.
19
 * Portions created by the Initial Developer are Copyright (C) 2005
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Ami Castonguay <acastong@grm.polymtl.ca>
24
 *
25
 * Alternatively, the contents of this file may be used under the terms
26
 * of the Polytechnique HyperTransport Tunnel IP Core Source Code License
27
 * (the  "PHTICSCL License", see the file PHTICSCL.txt), in which case the
28
 * provisions of PHTICSCL License are applicable instead of those
29
 * above. If you wish to allow use of your version of this file only
30
 * under the terms of the PHTICSCL License and not to allow others to use
31
 * your version of this file under the MPL, indicate your decision by
32
 * deleting the provisions above and replace them with the notice and
33
 * other provisions required by the PHTICSCL License. If you do not delete
34
 * the provisions above, a recipient may use your version of this file
35
 * under either the MPL or the PHTICSCL License."
36
 *
37
 * ***** END LICENSE BLOCK ***** */
38
//Main for link_frame_rx_l3 testbench
39
 
40
#ifndef SC_USER_DEFINED_MAX_NUMBER_OF_PROCESSES
41
#define SC_USER_DEFINED_MAX_NUMBER_OF_PROCESSES
42
#define SC_VC6_MAX_NUMBER_OF_PROCESSES 20
43
#endif
44
#include <systemc.h>
45
 
46
#include "../../../rtl/systemc/core_synth/synth_datatypes.h"
47
#include "../../../rtl/systemc/core_synth/constants.h"
48
 
49
#include "../../../rtl/systemc/link_l2/link_frame_tx_l3.h"
50
#include "link_frame_tx_l3_tb.h"
51
 
52
#include <iostream>
53
#include <string>
54
#include <sstream>
55
#include <iomanip>
56
 
57
using namespace std;
58
 
59
int sc_main( int argc, char* argv[] ){
60
 
61
 
62
        //The Design Under Test
63
        link_frame_tx_l3* dut = new link_frame_tx_l3("link_frame_tx_l3");
64
        //The TestBench
65
        link_frame_tx_l3_tb* tb = new link_frame_tx_l3_tb("link_frame_tx_l3_tb");
66
 
67
 
68
        //Signals used to link the design to the testbench
69
        sc_clock clk("clk", 1);  // system clk
70
 
71
        sc_signal<sc_bv<CAD_OUT_DEPTH> >        lk_ctl_phy;
72
        sc_signal<sc_bv<CAD_OUT_DEPTH> >                lk_cad_phy[CAD_OUT_WIDTH];
73
        sc_signal<bool>                                                 phy_consume_lk;
74
        sc_signal<bool >        disable_drivers;
75
        sc_signal<sc_bv<32> >   cad_to_frame;
76
        sc_signal<bool> lctl_to_frame;
77
        sc_signal<bool >        hctl_to_frame;
78
        sc_signal<bool>         tx_consume_data;
79
 
80
        sc_signal<bool>                 resetx;
81
        sc_signal<bool>                 pwrok;
82
        sc_signal<bool>                 ldtstopx;
83
 
84
        sc_signal<sc_bv<3> >    csr_tx_link_width_lk;
85
        sc_signal<bool >                csr_end_of_chain;
86
        sc_signal<bool> csr_transmitter_off_lk;
87
        sc_signal<bool> csr_ldtstop_tristate_enable_lk;
88
 
89
        sc_signal<bool>                 ldtstop_disconnect_tx;
90
        sc_signal<bool>                 rx_waiting_for_ctl_tx;
91
#ifdef RETRY_MODE_ENABLED
92
        sc_signal<bool>                 fc_disconnect_lk;
93
#endif
94
        sc_signal<bool>                 csr_extented_ctl_lk;
95
 
96
        //Connect the design
97
        dut->clk(clk);
98
        dut->lk_ctl_phy(lk_ctl_phy);
99
        for(int n = 0; n < CAD_OUT_WIDTH; n++)
100
                dut->lk_cad_phy[n](lk_cad_phy[n]);
101
        dut->phy_consume_lk(phy_consume_lk);
102
        dut->disable_drivers(disable_drivers);
103
        dut->cad_to_frame(cad_to_frame);
104
        dut->lctl_to_frame(lctl_to_frame);
105
        dut->hctl_to_frame(hctl_to_frame);
106
        dut->tx_consume_data(tx_consume_data);
107
 
108
        dut->resetx(resetx);
109
        dut->ldtstopx(ldtstopx);
110
 
111
        dut->csr_tx_link_width_lk(csr_tx_link_width_lk);
112
        dut->csr_end_of_chain(csr_end_of_chain);
113
        dut->csr_transmitter_off_lk(csr_transmitter_off_lk);
114
        dut->csr_ldtstop_tristate_enable_lk(csr_ldtstop_tristate_enable_lk);
115
 
116
        dut->ldtstop_disconnect_tx(ldtstop_disconnect_tx);
117
        dut->rx_waiting_for_ctl_tx(rx_waiting_for_ctl_tx);
118
#ifdef RETRY_MODE_ENABLED
119
        dut->tx_retry_disconnect(fc_disconnect_lk);
120
#endif
121
        dut->csr_extented_ctl_lk(csr_extented_ctl_lk);
122
 
123
        //Connect the testbench
124
        tb->clk(clk);
125
        tb->lk_ctl_phy(lk_ctl_phy);
126
        for(int n = 0; n < CAD_OUT_WIDTH; n++)
127
                tb->lk_cad_phy[n](lk_cad_phy[n]);
128
        tb->phy_consume_lk(phy_consume_lk);
129
        tb->disable_drivers(disable_drivers);
130
        tb->cad_to_frame(cad_to_frame);
131
        tb->lctl_to_frame(lctl_to_frame);
132
        tb->hctl_to_frame(hctl_to_frame);
133
        tb->tx_consume_data(tx_consume_data);
134
 
135
        tb->resetx(resetx);
136
        tb->pwrok(pwrok);
137
        tb->ldtstopx(ldtstopx);
138
 
139
        tb->csr_tx_link_width_lk(csr_tx_link_width_lk);
140
        tb->csr_end_of_chain(csr_end_of_chain);
141
        tb->ldtstop_disconnect_tx(ldtstop_disconnect_tx);
142
        tb->rx_waiting_for_ctl_tx(rx_waiting_for_ctl_tx);
143
#ifdef RETRY_MODE_ENABLED
144
        tb->fc_disconnect_lk(fc_disconnect_lk);
145
#endif
146
 
147
        // tracing:
148
        // trace file creation
149
        sc_trace_file *tf = sc_create_vcd_trace_file("sim_link_frame_tx_l3");
150
        // External Signals
151
        sc_trace(tf, clk, "clk");
152
 
153
        sc_trace(tf,lk_ctl_phy,"lk_ctl_phy");
154
        for(int n = 0; n < CAD_OUT_WIDTH; n++){
155
                ostringstream s;
156
                s << "lk_cad_phy(" << n << ")";
157
                sc_trace(tf,lk_cad_phy[n], s.str().c_str());
158
        }
159
        sc_trace(tf,phy_consume_lk,"phy_consume_lk");
160
        sc_trace(tf,disable_drivers,"disable_drivers");
161
        sc_trace(tf,cad_to_frame,"cad_to_frame");
162
        sc_trace(tf,lctl_to_frame,"lctl_to_frame");
163
        sc_trace(tf,hctl_to_frame,"hctl_to_frame");
164
        sc_trace(tf,tx_consume_data,"tx_consume_data");
165
 
166
        sc_trace(tf,resetx,"resetx");
167
        sc_trace(tf,pwrok,"pwrok");
168
        sc_trace(tf,ldtstopx,"ldtstopx");
169
 
170
        sc_trace(tf,csr_tx_link_width_lk,"csr_tx_link_width_lk");
171
        sc_trace(tf,csr_end_of_chain,"csr_end_of_chain");
172
        sc_trace(tf,ldtstop_disconnect_tx,"ldtstop_disconnect_tx");
173
        sc_trace(tf,rx_waiting_for_ctl_tx,"rx_waiting_for_ctl_tx");
174
#ifdef RETRY_MODE_ENABLED
175
        sc_trace(tf,fc_disconnect_lk,"fc_disconnect_lk");
176
#endif
177
 
178
 
179
        //------------------------------------------
180
        // Start simulation
181
        //------------------------------------------
182
        cout << "Debut de la simulation" << endl;
183
        sc_start(14000/CAD_OUT_DEPTH);
184
 
185
 
186
        sc_close_vcd_trace_file(tf);
187
        cout << "fin de la simulation" << endl;
188
 
189
        delete dut;
190
        delete tb;
191
        return 0;
192
}

powered by: WebSVN 2.1.0

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