1 |
2 |
acastong |
//errorhandler_tb.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 |
|
|
|
39 |
|
|
#ifndef HT_ERROR_HANDLER_H
|
40 |
|
|
#include "../../rtl/systemc/errorhandler_l2/errorhandler_l2.h"
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
#ifndef HT_ERROR_HANDLER_SIM_H
|
44 |
|
|
#include "errorhandler_sim.h"
|
45 |
|
|
#endif
|
46 |
|
|
|
47 |
|
|
int sc_main( int argc, char* argv[] )
|
48 |
|
|
{
|
49 |
|
|
// Create a trace file
|
50 |
|
|
sc_trace_file* trace_file = sc_create_vcd_trace_file("errorHandler_testbench");
|
51 |
|
|
|
52 |
|
|
// Define signals to plug on ports
|
53 |
|
|
|
54 |
|
|
sc_signal< bool > resetx;
|
55 |
|
|
sc_signal< bool > pwrok;
|
56 |
|
|
|
57 |
|
|
// Reordering signals
|
58 |
|
|
sc_signal< syn_ControlPacketComplete > ro_command_eh;
|
59 |
|
|
sc_signal< bool > ro_available_eh;
|
60 |
|
|
sc_signal< bool > eh_consume_ro;
|
61 |
|
|
|
62 |
|
|
// Flow Control signals
|
63 |
|
|
sc_signal< bool > fc_consume_eh;
|
64 |
|
|
sc_signal< sc_bv<32> > eh_datacommand_fc;
|
65 |
|
|
sc_signal< bool > eh_available_fc;
|
66 |
|
|
|
67 |
|
|
// Data Buffer signals
|
68 |
|
|
sc_signal< sc_uint<BUFFERS_ADDRESS_WIDTH> > eh_address_db;
|
69 |
|
|
sc_signal< bool > eh_drop_db;
|
70 |
|
|
sc_signal< VirtualChannel > eh_vctype_db;
|
71 |
|
|
|
72 |
|
|
// CSR registries for EOC error
|
73 |
|
|
sc_signal<bool> csr_eoc;
|
74 |
|
|
sc_signal<bool> csr_initcomplete;
|
75 |
|
|
sc_signal<bool> csr_drop_uninit_link;
|
76 |
|
|
|
77 |
|
|
sc_signal<sc_bv<5> > csr_unitid;
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
sc_clock clk("clock",10,SC_NS);
|
81 |
|
|
|
82 |
|
|
// Instantiate the Data Buffer
|
83 |
|
|
errorhandler_l2 the_EH("error_handler");
|
84 |
|
|
ht_errorHandler_sim the_sim("sim");
|
85 |
|
|
|
86 |
|
|
//------------------------------------------
|
87 |
|
|
// Connect signals on ports
|
88 |
|
|
//------------------------------------------
|
89 |
|
|
|
90 |
|
|
the_EH.resetx(resetx);
|
91 |
|
|
the_EH.clk(clk);
|
92 |
|
|
|
93 |
|
|
the_EH.ro_packet_fwd(ro_command_eh);
|
94 |
|
|
the_EH.ro_available_fwd(ro_available_eh);
|
95 |
|
|
the_EH.eh_ack_ro(eh_consume_ro);
|
96 |
|
|
|
97 |
|
|
the_EH.fc_ack_eh(fc_consume_eh);
|
98 |
|
|
the_EH.eh_cmd_data_fc(eh_datacommand_fc);
|
99 |
|
|
the_EH.eh_available_fc(eh_available_fc);
|
100 |
|
|
|
101 |
|
|
the_EH.eh_address_db(eh_address_db);
|
102 |
|
|
the_EH.eh_erase_db(eh_drop_db);
|
103 |
|
|
the_EH.eh_vctype_db(eh_vctype_db);
|
104 |
|
|
|
105 |
|
|
the_EH.csr_end_of_chain(csr_eoc);
|
106 |
|
|
the_EH.csr_initcomplete(csr_initcomplete);
|
107 |
|
|
the_EH.csr_drop_uninit_link(csr_drop_uninit_link);
|
108 |
|
|
the_EH.csr_unit_id(csr_unitid);
|
109 |
|
|
|
110 |
|
|
the_sim.resetx(resetx);
|
111 |
|
|
the_sim.pwrok(pwrok);
|
112 |
|
|
|
113 |
|
|
the_sim.ro_command_eh(ro_command_eh);
|
114 |
|
|
the_sim.ro_available_eh(ro_available_eh);
|
115 |
|
|
|
116 |
|
|
the_sim.fc_consume_eh(fc_consume_eh);
|
117 |
|
|
|
118 |
|
|
the_sim.csr_eoc(csr_eoc);
|
119 |
|
|
the_sim.csr_initcomplete(csr_initcomplete);
|
120 |
|
|
the_sim.csr_drop_uninit_link(csr_drop_uninit_link);
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
// Trace internal signals of the Error Handler
|
124 |
|
|
//sc_trace(trace_file,the_EH,"the_EH");
|
125 |
|
|
sc_trace(trace_file,the_EH.resetx,"resetx");
|
126 |
|
|
sc_trace(trace_file,the_EH.clk,"clk");
|
127 |
|
|
sc_trace(trace_file,the_EH.csr_unit_id,"csr_unit_id");
|
128 |
|
|
sc_trace(trace_file,the_EH.ro_packet_fwd,"ro_packet_fwd");
|
129 |
|
|
sc_trace(trace_file,the_EH.ro_available_fwd,"ro_available_fwd");
|
130 |
|
|
sc_trace(trace_file,the_EH.eh_ack_ro,"eh_ack_ro");
|
131 |
|
|
sc_trace(trace_file,the_EH.fc_ack_eh,"fc_ack_eh");
|
132 |
|
|
sc_trace(trace_file,the_EH.eh_cmd_data_fc,"eh_cmd_data_fc");
|
133 |
|
|
sc_trace(trace_file,the_EH.eh_available_fc,"eh_available_fc");
|
134 |
|
|
sc_trace(trace_file,the_EH.eh_address_db,"eh_address_db");
|
135 |
|
|
sc_trace(trace_file,the_EH.eh_erase_db,"eh_erase_db");
|
136 |
|
|
sc_trace(trace_file,the_EH.eh_vctype_db,"eh_vctype_db");
|
137 |
|
|
sc_trace(trace_file,the_EH.csr_end_of_chain,"csr_end_of_chain");
|
138 |
|
|
sc_trace(trace_file,the_EH.csr_initcomplete,"csr_initcomplete");
|
139 |
|
|
sc_trace(trace_file,the_EH.csr_drop_uninit_link,"csr_drop_uninit_link");
|
140 |
|
|
|
141 |
|
|
//------------------------------------------
|
142 |
|
|
// Start simulation
|
143 |
|
|
//------------------------------------------
|
144 |
|
|
|
145 |
|
|
sc_start(400,SC_NS);
|
146 |
|
|
|
147 |
|
|
// Close trace file
|
148 |
|
|
sc_close_vcd_trace_file(trace_file);
|
149 |
|
|
|
150 |
|
|
printf("end of simulation\n");
|
151 |
|
|
|
152 |
|
|
return 0;
|
153 |
|
|
}
|