RecoSim  1.0
 All Classes Files Functions Variables Enumerations
TB_Stream_IN.h
1 
13 #ifndef TB_Stream_IN_TESTBENCH_FILE_H
14 #define TB_Stream_IN_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 TB_Stream_IN(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  wait(tb_interface.TB_IF_all_responses_received_event());
57 
58 #ifdef GENERATE_LOG_FILE
59  Simulation_controller::get_logfile() << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << ": Transaction " << i << " has been sent" << endl;
60 #endif
61 
62  if(i != (NB_TRANSACTIONS_TO_SEND - 1)) {
63  // Delay next transaction by waiting extra time
64  sc_time delayToNextPacket((i + 2) * tb_interface.TB_IF_get_period() - sc_time_stamp());
65  if(delayToNextPacket < SC_ZERO_TIME) {
66  cerr << "ERROR in TB: Negative delay to next packet send! Consider revising periods and other timing information" << endl;
67  exit(RECOSIM_INTERNAL_ERROR_ERRCODE);
68  }
69  wait(delayToNextPacket);
70  }
71 
73  }
74 
75 //#ifdef GENERATE_LOG_FILE
76  Simulation_controller::get_logfile() << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << ": All transactions have been sent" << endl;
77 //#endif
78 
79 }
80 //RECOSIM_USER_IF_OUT_END
81 
82 /************************** END USER SPACE ********************************/
83 /***************************************************************************/
84 
85 #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.