1 |
2 |
acastong |
//UserInterfaceTest.h
|
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 USERINTERFACE_TB_H
|
40 |
|
|
#define USERINTERFACE_TB_H
|
41 |
|
|
|
42 |
|
|
#include <deque>
|
43 |
|
|
#include <iostream>
|
44 |
|
|
|
45 |
|
|
#ifndef SC_USER_DEFINED_MAX_NUMBER_OF_PROCESSES
|
46 |
|
|
#define SC_USER_DEFINED_MAX_NUMBER_OF_PROCESSES
|
47 |
|
|
#define SC_VC6_MAX_NUMBER_OF_PROCESSES 20
|
48 |
|
|
#endif
|
49 |
|
|
#include <systemc.h>
|
50 |
|
|
|
51 |
|
|
#include "../core/ht_datatypes.h"
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
///Module to test the user interface
|
55 |
|
|
/**
|
56 |
|
|
@class userinterface_tb
|
57 |
|
|
@author Ami Castonguay
|
58 |
|
|
*/
|
59 |
|
|
class userinterface_tb : public sc_module {
|
60 |
|
|
|
61 |
|
|
public :
|
62 |
|
|
|
63 |
|
|
/** Static compile time constant to know if we should output debug info*/
|
64 |
|
|
enum { outputRdMessages = true};
|
65 |
|
|
/** Static compile time constant to know if we should output debug info*/
|
66 |
|
|
enum { outputTxMessages = true};
|
67 |
|
|
/** Static compile time constant to know if we should output debug info*/
|
68 |
|
|
enum { outputSide0 = true};
|
69 |
|
|
/** Static compile time constant to know if we should output debug info*/
|
70 |
|
|
enum { outputSide1 = true};
|
71 |
|
|
|
72 |
|
|
//************************************
|
73 |
|
|
//Internal signals to keep internal
|
74 |
|
|
//integrity of the testing system to
|
75 |
|
|
//test the interface
|
76 |
|
|
//************************************
|
77 |
|
|
|
78 |
|
|
//****** Section for user that sends packets
|
79 |
|
|
|
80 |
|
|
///Keep track of all the VC's that are free in the send scheduler side 0
|
81 |
|
|
sc_bv<6> freeVirtualChannel0;
|
82 |
|
|
///Keep track of all the VC's that are free in the send scheduler side 1
|
83 |
|
|
sc_bv<6> freeVirtualChannel1;
|
84 |
|
|
|
85 |
|
|
///Queue of packet to send to the chain (simulated the user)
|
86 |
|
|
std::deque<PacketContainer> userPacketQueue;
|
87 |
|
|
|
88 |
|
|
//****** Section for the user that receives packets
|
89 |
|
|
|
90 |
|
|
///The returned data is a simple count
|
91 |
|
|
int rxDataValue;
|
92 |
|
|
/**The maximum address where the data can be : ex, if the address width
|
93 |
|
|
is 3, then maxDataAddresse will be 8 after initialization*/
|
94 |
|
|
int maxDataAddress;
|
95 |
|
|
|
96 |
|
|
/** To assert that the interface
|
97 |
|
|
is reading the right side*/
|
98 |
|
|
bool sideFromWhereSendData;
|
99 |
|
|
/** To assert that the interface
|
100 |
|
|
is reading the right vc*/
|
101 |
|
|
VirtualChannel channelToAccess;
|
102 |
|
|
/** To assert that the interface
|
103 |
|
|
is reading the right address*/
|
104 |
|
|
int dataAddress;
|
105 |
|
|
/** To assert that the interface
|
106 |
|
|
is reading the right amount of data*/
|
107 |
|
|
int dataLeftToSend;
|
108 |
|
|
|
109 |
|
|
/**An internal buffer of the packet to send to the user from side 0*/
|
110 |
|
|
ControlPacketComplete packetSendBuffer0;
|
111 |
|
|
/**An internal buffer of the packet to send to the user from side 0*/
|
112 |
|
|
ControlPacketComplete packetSendBuffer1;
|
113 |
|
|
|
114 |
|
|
/** Data to send is simply initially placed
|
115 |
|
|
in a queue
|
116 |
|
|
|
117 |
|
|
Index 0 is for side 0
|
118 |
|
|
Index 1 is for side 1
|
119 |
|
|
*/
|
120 |
|
|
std::deque<ControlPacketComplete> sendPackets[2];
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
//*******************************
|
124 |
|
|
// General signals
|
125 |
|
|
//*******************************
|
126 |
|
|
|
127 |
|
|
/**Clock to synchronize module*/
|
128 |
|
|
sc_in< bool > clk;
|
129 |
|
|
|
130 |
|
|
/**Reset to initialize module*/
|
131 |
|
|
sc_in< bool > resetx;
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
//*******************************
|
135 |
|
|
// Signals from CSR
|
136 |
|
|
//*******************************
|
137 |
|
|
|
138 |
|
|
/**If packet addresed to the DirectConnect address range should go
|
139 |
|
|
in the direction opposite to the default direction*/
|
140 |
|
|
sc_out< bool > csr_direct_route_oppposite_dir[DirectRoute_NumberDirectRouteSpaces];
|
141 |
|
|
/**The lower limits of the DirectConnect address ranges*/
|
142 |
|
|
sc_out<sc_bv<32> > csr_direct_route_base[DirectRoute_NumberDirectRouteSpaces];
|
143 |
|
|
/**The higher limits of the DirectConnect address ranges*/
|
144 |
|
|
sc_out<sc_bv<32> > csr_direct_route_limit[DirectRoute_NumberDirectRouteSpaces];
|
145 |
|
|
|
146 |
|
|
sc_out<sc_bv<32> > csr_direct_route_enable;
|
147 |
|
|
|
148 |
|
|
/**The direction (side) packets should take under normal conditions*/
|
149 |
|
|
sc_out< bool > csr_default_dir;
|
150 |
|
|
/** Which direction is the master (or only) host of the system*/
|
151 |
|
|
sc_out< bool > csr_masterhost;
|
152 |
|
|
/**Must be activated for this node to be able to issue requests*/
|
153 |
|
|
sc_out< bool > csr_bus_master_enable;
|
154 |
|
|
/**Side 0 is the end of chain*/
|
155 |
|
|
sc_out<bool> csr_end_of_chain0;
|
156 |
|
|
/**Side 1 is the end of chain*/
|
157 |
|
|
sc_out<bool> csr_end_of_chain1;
|
158 |
|
|
|
159 |
|
|
//******************************
|
160 |
|
|
//Signals from link 0
|
161 |
|
|
//******************************
|
162 |
|
|
|
163 |
|
|
//----------------------------
|
164 |
|
|
// Signal from data buffers 0
|
165 |
|
|
//----------------------------
|
166 |
|
|
|
167 |
|
|
/**The address of the buffer where to fetch the data*/
|
168 |
|
|
sc_in< sc_uint<BUFFERS_ADDRESS_WIDTH> > ui_address_db0;
|
169 |
|
|
|
170 |
|
|
/**If the data from the buffers was read and
|
171 |
|
|
can be deleted*/
|
172 |
|
|
sc_in<bool> ui_consume_db0;
|
173 |
|
|
|
174 |
|
|
/**In which virt channel to go fetch the data. This
|
175 |
|
|
could be seen as part of the adresse to the data*/
|
176 |
|
|
sc_in<VirtualChannel> ui_vctype_db0;
|
177 |
|
|
|
178 |
|
|
/**The actual data coming from the data buffers*/
|
179 |
|
|
sc_out< sc_bv<32> > db0_data_ui;
|
180 |
|
|
|
181 |
|
|
/**End of data transmission fro data buffer*/
|
182 |
|
|
sc_in< bool > ui_erase_db0;
|
183 |
|
|
|
184 |
|
|
//----------------------------
|
185 |
|
|
//Signals from ctl buffers 0
|
186 |
|
|
//----------------------------
|
187 |
|
|
|
188 |
|
|
/**The control packet from the link with the
|
189 |
|
|
user as a destination*/
|
190 |
|
|
sc_out<syn_ControlPacketComplete> ro0_packet_ui;
|
191 |
|
|
|
192 |
|
|
/**Allows to know when there is a valid packet*/
|
193 |
|
|
sc_out<bool> ro0_available_ui;
|
194 |
|
|
|
195 |
|
|
/**To consume the packet from the buffers so that
|
196 |
|
|
the register can be freed*/
|
197 |
|
|
sc_in< bool > ui_consume_ro0;
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
//--------------------------
|
201 |
|
|
//Signals to send scheduler
|
202 |
|
|
//--------------------------
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
/**To send a control packet to the link*/
|
206 |
|
|
sc_in<sc_bv<64> > ui_packet_fc0;
|
207 |
|
|
|
208 |
|
|
/**The control packet to send scheduler is valid*/
|
209 |
|
|
sc_in<bool> ui_available_fc0;
|
210 |
|
|
|
211 |
|
|
/** Which what type of ctl packets can be sent*/
|
212 |
|
|
sc_out<sc_bv<3> > fc0_user_fifo_ge2_ui;
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
/**Link to send data packets*/
|
216 |
|
|
sc_in<sc_bv<32> > ui_data_fc0;
|
217 |
|
|
|
218 |
|
|
/**Signal to know from which VC data was read*/
|
219 |
|
|
sc_out<VirtualChannel> fc0_datavc_ui;
|
220 |
|
|
|
221 |
|
|
/**To say the the data has been read*/
|
222 |
|
|
sc_out< bool > fc0_consume_data_ui;
|
223 |
|
|
|
224 |
|
|
//******************************
|
225 |
|
|
//Signals from link 1
|
226 |
|
|
//******************************
|
227 |
|
|
|
228 |
|
|
//----------------------------
|
229 |
|
|
// Signal from data buffers 1
|
230 |
|
|
//----------------------------
|
231 |
|
|
|
232 |
|
|
/**The address of the buffer where to fetch the data*/
|
233 |
|
|
sc_in< sc_uint<BUFFERS_ADDRESS_WIDTH> > ui_address_db1;
|
234 |
|
|
|
235 |
|
|
/**If the data from the buffers was read and
|
236 |
|
|
can be deleted*/
|
237 |
|
|
sc_in<bool> ui_consume_db1;
|
238 |
|
|
|
239 |
|
|
/**In which virt channel to go fetch the data. This
|
240 |
|
|
could be seen as part of the adresse to the data*/
|
241 |
|
|
sc_in<VirtualChannel> ui_vctype_db1;
|
242 |
|
|
|
243 |
|
|
/**The actual data coming from the data buffers*/
|
244 |
|
|
sc_out< sc_bv<32> > db1_data_ui;
|
245 |
|
|
|
246 |
|
|
/**End of data transmission fro data buffer*/
|
247 |
|
|
sc_in< bool > ui_erase_db1;
|
248 |
|
|
|
249 |
|
|
//----------------------------
|
250 |
|
|
//Signals from ctl buffers 1
|
251 |
|
|
//----------------------------
|
252 |
|
|
|
253 |
|
|
/**The control packet from the link with the
|
254 |
|
|
user as a destination*/
|
255 |
|
|
sc_out<syn_ControlPacketComplete> ro1_packet_ui;
|
256 |
|
|
|
257 |
|
|
/**Allows to know when there is a valid packet*/
|
258 |
|
|
sc_out<bool> ro1_available_ui;
|
259 |
|
|
|
260 |
|
|
/**To consume the packet from the buffers so that
|
261 |
|
|
the register can be freed*/
|
262 |
|
|
sc_in< bool > ui_consume_ro1;
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
//--------------------------
|
266 |
|
|
//Signals to send scheduler
|
267 |
|
|
//--------------------------
|
268 |
|
|
|
269 |
|
|
/**To send a control packet to the link*/
|
270 |
|
|
sc_in<sc_bv<64> > ui_packet_fc1;
|
271 |
|
|
|
272 |
|
|
/**The control packet to send scheduler is valid*/
|
273 |
|
|
sc_in<bool> ui_available_fc1;
|
274 |
|
|
|
275 |
|
|
/** Which what type of ctl packets can be sent*/
|
276 |
|
|
sc_out<sc_bv<3> > fc1_user_fifo_ge2_ui;
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
/**Link to send data packets*/
|
280 |
|
|
sc_in<sc_bv<32> > ui_data_fc1;
|
281 |
|
|
|
282 |
|
|
/**Signal to know from which VC data was read*/
|
283 |
|
|
sc_out<VirtualChannel> fc1_datavc_ui;
|
284 |
|
|
|
285 |
|
|
/**To say the the data has been read*/
|
286 |
|
|
sc_out< bool > fc1_consume_data_ui;
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
//******************************************
|
290 |
|
|
// Signals to User
|
291 |
|
|
//******************************************
|
292 |
|
|
|
293 |
|
|
//------------------------------------------
|
294 |
|
|
// Signals to send received packets to User
|
295 |
|
|
//------------------------------------------
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
/**The actual control/data packet to the user*/
|
299 |
|
|
sc_in<sc_bv<64> > ui_packet_usr;
|
300 |
|
|
|
301 |
|
|
/**The virtual channel of the ctl/data packet*/
|
302 |
|
|
sc_in<VirtualChannel> ui_vc_usr;
|
303 |
|
|
|
304 |
|
|
/**The side from which came the packet*/
|
305 |
|
|
sc_in< bool > ui_side_usr;
|
306 |
|
|
|
307 |
|
|
/**If the packet is a direct_route packet - only valid for
|
308 |
|
|
requests (posted and non-posted) */
|
309 |
|
|
sc_in<bool> ui_directroute_usr;
|
310 |
|
|
|
311 |
|
|
/**If this is the last part of the packet*/
|
312 |
|
|
sc_in< bool > ui_eop_usr;
|
313 |
|
|
|
314 |
|
|
/**If there is another packet available*/
|
315 |
|
|
sc_in< bool > ui_available_usr;
|
316 |
|
|
|
317 |
|
|
/**If what is read is 64 bits or 32 bits*/
|
318 |
|
|
sc_in< bool > ui_output_64bits_usr;
|
319 |
|
|
|
320 |
|
|
/**To allow the user to consume the packets*/
|
321 |
|
|
sc_out< bool > usr_consume_ui;
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
//------------------------------------------
|
325 |
|
|
// Signals to allow the User to send packets
|
326 |
|
|
//------------------------------------------
|
327 |
|
|
|
328 |
|
|
/**The actual control/data packet from the user*/
|
329 |
|
|
sc_out<sc_bv<64> > usr_packet_ui;
|
330 |
|
|
|
331 |
|
|
/**If there is another packet available*/
|
332 |
|
|
sc_out< bool > usr_available_ui;
|
333 |
|
|
|
334 |
|
|
/**
|
335 |
|
|
The side to send the packet if it is a response
|
336 |
|
|
This bit is ignored if the packet is not a response
|
337 |
|
|
since the side to send a request is determined automatically
|
338 |
|
|
taking in acount DirectRoute functionnality.
|
339 |
|
|
*/
|
340 |
|
|
sc_out< bool > usr_side_ui;
|
341 |
|
|
|
342 |
|
|
/**Which what type of ctl packets can be sent to side0*/
|
343 |
|
|
sc_in<sc_bv<6> > ui_freevc0_usr;
|
344 |
|
|
/**Which what type of ctl packets can be sent to side0*/
|
345 |
|
|
sc_in<sc_bv<6> > ui_freevc1_usr;
|
346 |
|
|
|
347 |
|
|
/**A posted packet with DataError bit set is being sent*/
|
348 |
|
|
sc_in<bool> ui_sendingPostedDataError_csr;
|
349 |
|
|
/**A response packet with TargetAbort bit set is being sent*/
|
350 |
|
|
sc_in<bool> ui_sendingTargetAbort_csr;
|
351 |
|
|
|
352 |
|
|
/**A response packet with DataError bit was received*/
|
353 |
|
|
sc_in<bool> ui_receivedResponseDataError_csr;
|
354 |
|
|
/**A posted packet with DataError bit was received*/
|
355 |
|
|
sc_in<bool> ui_receivedPostedDataError_csr;
|
356 |
|
|
/**A packet with TargetAbort bit was received*/
|
357 |
|
|
sc_in<bool> ui_receivedTargetAbort_csr;
|
358 |
|
|
/**A packet with MasterAbort bit was received*/
|
359 |
|
|
sc_in<bool> ui_receivedMasterAbort_csr;
|
360 |
|
|
|
361 |
|
|
/**CSR is requesting to have access to the databuffer on side 0
|
362 |
|
|
The access to the databuffer is shared between the UI and the CSR*/
|
363 |
|
|
sc_out<bool> csr_request_databuffer0_access_ui;
|
364 |
|
|
/**CSR is requesting to have access to the databuffer on side 1
|
365 |
|
|
The access to the databuffer is shared between the UI and the CSR*/
|
366 |
|
|
sc_out<bool> csr_request_databuffer1_access_ui;
|
367 |
|
|
/**We grant the CSR access to the requested databuffer*/
|
368 |
|
|
sc_in<bool> ui_databuffer_access_granted_csr;
|
369 |
|
|
/**Let the databuffer know that it is the CSR accessing it*/
|
370 |
|
|
sc_in<bool> ui_grant_csr_access_db0;
|
371 |
|
|
/**Let the databuffer know that it is the CSR accessing it*/
|
372 |
|
|
sc_in<bool> ui_grant_csr_access_db1;
|
373 |
|
|
|
374 |
|
|
/////////////////////////////////////
|
375 |
|
|
// Interface to memory - synchronous
|
376 |
|
|
/////////////////////////////////////
|
377 |
|
|
|
378 |
|
|
sc_in<bool> ui_memory_write0;///< To write to UI data packet memory 0
|
379 |
|
|
sc_in<bool> ui_memory_write1;///< To write to UI data packet memory 1
|
380 |
|
|
sc_in<sc_bv<USER_MEMORY_ADDRESS_WIDTH> > ui_memory_write_address;///< Write address for UI data packet memories
|
381 |
|
|
sc_in<sc_bv<32> > ui_memory_write_data;///< Write data for UI data packet memories
|
382 |
|
|
|
383 |
|
|
sc_in<sc_bv<USER_MEMORY_ADDRESS_WIDTH> > ui_memory_read_address0;///< Read address for UI data packet memory 0
|
384 |
|
|
sc_in<sc_bv<USER_MEMORY_ADDRESS_WIDTH> > ui_memory_read_address1;///< Read address for UI data packet memory 1
|
385 |
|
|
sc_out<sc_bv<32> > ui_memory_read_data0;///< Read data for UI data packet memory 0
|
386 |
|
|
sc_out<sc_bv<32> > ui_memory_read_data1;///< Read data for UI data packet memory 1
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
/**
|
391 |
|
|
Thread to stimulate the UserInterface packet reception interface.
|
392 |
|
|
It generates packets like the reordering module would
|
393 |
|
|
*/
|
394 |
|
|
void testRxInterface();
|
395 |
|
|
|
396 |
|
|
/**
|
397 |
|
|
Thread to stimulate the UserInterface packet sending interface.
|
398 |
|
|
It generates packet to send to the chain as the user would
|
399 |
|
|
*/
|
400 |
|
|
void testTxUserWrInterface();
|
401 |
|
|
|
402 |
|
|
/**
|
403 |
|
|
Thread to stimulate the UserInterface interface to come read
|
404 |
|
|
the internal buffers. This function simulates the flow control
|
405 |
|
|
that comes read the data in order to send it,
|
406 |
|
|
*/
|
407 |
|
|
void testTxSendSchedulerRdInterface();
|
408 |
|
|
|
409 |
|
|
/**
|
410 |
|
|
Takes care of all the initial members initialization
|
411 |
|
|
*/
|
412 |
|
|
void generalInitialisation();
|
413 |
|
|
|
414 |
|
|
/**
|
415 |
|
|
When the UserInterface receives packets from the reordering modules that has data
|
416 |
|
|
associated to it, it must go retrieve the data from the data buffers. This simulates
|
417 |
|
|
the data buffers and test that the access is correct.
|
418 |
|
|
*/
|
419 |
|
|
void testRxInterfaceSensitive();
|
420 |
|
|
|
421 |
|
|
/**
|
422 |
|
|
Allows to add random packets to a queue of ControlPacketComplete. This only generates
|
423 |
|
|
packets which are valid inside the HyperTransport module : it does not generate any
|
424 |
|
|
InfoPacket.
|
425 |
|
|
|
426 |
|
|
@param queue The Queue to add the packets to
|
427 |
|
|
@param number The number of packets to add
|
428 |
|
|
@param seed If we have to seed to random generator. If left at -1, the random
|
429 |
|
|
generator will not be seeded.
|
430 |
|
|
*/
|
431 |
|
|
void addPacketsToQueue(std::deque<ControlPacketComplete> &queue,int number, int seed = -1);
|
432 |
|
|
|
433 |
|
|
/**
|
434 |
|
|
Allows to add random packets to a queue of PacketContainer. This only generates
|
435 |
|
|
packets which are valid inside the HyperTransport module : it does not generate any
|
436 |
|
|
InfoPacket.
|
437 |
|
|
|
438 |
|
|
@param queue The Queue to add the packets to
|
439 |
|
|
@param number The number of packets to add
|
440 |
|
|
@param seed If we have to seed to random generator. If left at -1, the random
|
441 |
|
|
generator will not be seeded.
|
442 |
|
|
*/
|
443 |
|
|
void addPacketsToQueue(std::deque<PacketContainer> &queue,int number, int seed = -1);
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
/**
|
447 |
|
|
Generates a random packet. It takes as a parameter the last packet generated
|
448 |
|
|
with the length of chain left to be able to continue a chain if one was started
|
449 |
|
|
|
450 |
|
|
@param lastPacketToUpdateWithNew As a parameter, this is the last packet that
|
451 |
|
|
was generated. It will be updated with the new packet.
|
452 |
|
|
@param chainLengthLeft How many packets are left to the chain. 0 represents
|
453 |
|
|
that this is not a chain
|
454 |
|
|
*/
|
455 |
|
|
void getRandomPacket(PacketContainer &lastPacketToUpdateWithNew,int &chainLengthLeft);
|
456 |
|
|
|
457 |
|
|
///To display every clk cycle with it's number
|
458 |
|
|
int clockCycleNumber;
|
459 |
|
|
|
460 |
|
|
/** Memories to buffer data sent from the user. They are pointers because we only
|
461 |
|
|
know the logarithm2 of the size of the memory (the number of address bits), so
|
462 |
|
|
the actual size must be calculated before allocating the memory.
|
463 |
|
|
*/
|
464 |
|
|
//@{
|
465 |
|
|
int* memory0;
|
466 |
|
|
int* memory1;
|
467 |
|
|
//#}
|
468 |
|
|
|
469 |
|
|
/**
|
470 |
|
|
Displays the clk number in stdout at every negative edge
|
471 |
|
|
of the clk. It makes it easier to see what is going on when
|
472 |
|
|
there is a lot of console output for debug
|
473 |
|
|
*/
|
474 |
|
|
void clockOutputSeparator(){
|
475 |
|
|
std::cout << endl
|
476 |
|
|
<< "===================================" << endl
|
477 |
|
|
<< "Clock cycle number : " << clockCycleNumber++ << endl
|
478 |
|
|
<< "===================================" << endl;
|
479 |
|
|
//system("PAUSE");
|
480 |
|
|
cout << endl;
|
481 |
|
|
}
|
482 |
|
|
|
483 |
|
|
///Handle writing and readin in the memory
|
484 |
|
|
void manage_memories();
|
485 |
|
|
|
486 |
|
|
/**Macro to allow the classe to be used as a SystemC module*/
|
487 |
|
|
SC_HAS_PROCESS(userinterface_tb);
|
488 |
|
|
|
489 |
|
|
/**Test module constructor*/
|
490 |
|
|
userinterface_tb(sc_module_name name);
|
491 |
|
|
|
492 |
|
|
///Desctructor
|
493 |
|
|
virtual ~userinterface_tb();
|
494 |
|
|
};
|
495 |
|
|
|
496 |
|
|
#endif
|