RecoSim  1.0
 All Classes Files Functions Variables Enumerations
TBout2.h
Go to the documentation of this file.
1 
12 #include "user_parameters.h"
13 #ifndef TBOUT2_TESTBENCH_FILE_H
14 #define TBOUT2_TESTBENCH_FILE_H
15 
16 /*****************************************************************************/
17 /************************** BEGIN USER SPACE ********************************/
18 
19 /********************/
20 /* Output TestBench */
21 //RECOSIM_USER_IF_OUT_BEGIN
22 template<int No>
23 void TBout2(Testbench_out_interface<No>& tb_interface) {
24  // Default
25  //
26  // DATA SEND
27  //
28  tasks_execution_time = WCET;
29 
30  for (int i = 0; i < NB_TRANSACTIONS_TO_SEND; i++) {
31 
32 
33  if (i==2)
34  tasks_execution_time = BCET;
35  if (i>2)
36  tasks_execution_time = RANDOM;
37 
38  // Check that first module in the chain is ready
39 #ifdef GENERATE_LOG_FILE
40  Simulation_controller::get_logfile() << endl << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << " checks instantiation for following modules" << endl;
41 #endif
42 
43  // Initialize data to send for this transaction
44  for(int j = 0; j < No; j++) {
45  int *data_out_ptr = tb_interface.TB_IF_get_data_out_ptr(j);
46  for(int k = 0; k < 16; k++) data_out_ptr[k] = (i << 16) | k;
47  }
48 
49  tb_interface.TB_IF_nb_send_all_data();
50 
51  /* DO NOTHING */
52  /* check_target method asks for following modules instantiation, answer from
53  * the manager will produce an event responsible for data transfers */
54 
55  // Wait until all responses from following modules have been received */
56 
57  application_start_time=sc_time_stamp();
58  app_is_running=1;
59 
60  wait(tb_interface.TB_IF_all_responses_received_event());
61 
62 #ifdef GENERATE_LOG_FILE
63  Simulation_controller::get_logfile() << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << ": Transaction " << i << " has been sent" << endl;
64 #endif
65 
66  if(i != (NB_TRANSACTIONS_TO_SEND - 1)) {
67  // Delay next transaction by waiting extra time
68  sc_time delayToNextPacket((i + 1) * tb_interface.TB_IF_get_period() - sc_time_stamp());
69  if(delayToNextPacket < SC_ZERO_TIME) {
70  cerr << "ERROR in TB: Negative delay to next packet send! Consider revising periods and other timing information" << endl;
71  exit(RECOSIM_INTERNAL_ERROR_ERRCODE);
72  }
73  wait(delayToNextPacket);
74  }
75 
77  }
78 
79 //#ifdef GENERATE_LOG_FILE
80  Simulation_controller::get_logfile() << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << ": All transactions have been sent" << endl;
81 //#endif
82 
83 }
84 //RECOSIM_USER_IF_OUT_END
85 
86 /************************** END USER SPACE ********************************/
87 /***************************************************************************/
88 
89 #endif
virtual void TB_IF_nb_send_all_data(void)=0
Non-blocking data send through every socket.
virtual sc_time TB_IF_get_period(void) const =0
Get testbench period.
virtual void TB_IF_increment_current_transaction_id(void)=0
Increments working transaction counter.
Definition: testbench_out_interface.h:31
virtual int * TB_IF_get_data_out_ptr(int socketID) const =0
Get pointer to ougoing data structure.
virtual const sc_event & TB_IF_all_responses_received_event(void) const =0
Watch the event issued once all TLM responses have been sent from following modules to testbench...
virtual const char * TB_IF_name(void) const =0
Get testbench full name.