RecoSim  1.0
 All Classes Files Functions Variables Enumerations
TB_Intermediate_IN.h
Go to the documentation of this file.
1 
11 #include "user_parameters.h"
12 #ifndef TB_INTERMEDIATE_IN_TESTBENCH_FILE_H
13 #define TB_INTERMEDIATE_IN_TESTBENCH_FILE_H
14 
15 /*****************************************************************************/
16 /************************** BEGIN USER SPACE ********************************/
17 
18 /********************/
19 /* Output TestBench */
20 template<int No>
21 void TB_Intermediate_IN(Testbench_out_interface<No>& tb_interface) {
22  // Default
23  //
24  // DATA SEND
25  //
26 
27  int my_id=0;
28 
29  if (current_application_id<NB_SLICES_APPLICATION)
30  my_id=current_application_id;
31 
32  current_application_id++;
33 
34  for (int i = 0; i < NB_TRANSACTIONS_TO_SEND; i++) {
35 
36  // Check that first module in the chain is ready
37 #ifdef GENERATE_LOG_FILE
38  Simulation_controller::get_logfile() << endl << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << " checks instantiation for following modules" << endl;
39 #endif
40 
41  // Initialize data to send for this transaction
42  for(int j = 0; j < No; j++) {
43  int *data_out_ptr = tb_interface.TB_IF_get_data_out_ptr(j);
44  for(int k = 0; k < 16; k++) data_out_ptr[k] = (i << 16) | k;
45  }
46 
47  //wait(TB_lock[my_id]);
48  Slice_lock_IN.wait();
49 
50  tb_interface.TB_IF_nb_send_all_data();
51 
52  /* DO NOTHING */
53  /* check_target method asks for following modules instantiation, answer from
54  * the manager will produce an event responsible for data transfers */
55 
56  // Wait until all responses from following modules have been received */
57  wait(tb_interface.TB_IF_all_responses_received_event());
58 
59 #ifdef GENERATE_LOG_FILE
60  Simulation_controller::get_logfile() << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << ": Transaction " << i << " has been sent" << endl;
61 #endif
62 
63  if(i != (NB_TRANSACTIONS_TO_SEND - 1)) {
64  // Delay next transaction by waiting extra time
65  sc_time delayToNextPacket((i + 1) * tb_interface.TB_IF_get_period() - sc_time_stamp());
66  if(delayToNextPacket < SC_ZERO_TIME) {
67  cerr << "ERROR in TB: Negative delay to next packet send! Consider revising periods and other timing information" << endl;
68  exit(RECOSIM_INTERNAL_ERROR_ERRCODE);
69  }
70  // wait(TB_lock[my_id]);//wait(delayToNextPacket);
71  }
72 
74  }
75 
76 #ifdef GENERATE_LOG_FILE
77  Simulation_controller::get_logfile() << sc_time_stamp() << ": " << tb_interface.TB_IF_name() << ": All transactions have been sent" << endl;
78 #endif
79 
80 }
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.