RecoSim  1.0
 All Classes Files Functions Variables Enumerations
testbench_in.h
Go to the documentation of this file.
1 
22 #ifndef TESTBENCH_IN_H
23 #define TESTBENCH_IN_H
24 
25 // Needed for the simple_target_socket
26 #define SC_INCLUDE_DYNAMIC_PROCESSES
27 
28 #include <systemc.h>
29 #include "tlm.h"
30 #include "tlm_utils/simple_initiator_socket.h"
31 #include "tlm_utils/simple_target_socket.h"
32 #include "tlm_utils/multi_passthrough_initiator_socket.h"
33 #include "tlm_utils/multi_passthrough_target_socket.h"
34 #include "tlm_utils/peq_with_cb_and_phase.h"
35 #include "utils.h"
36 #include "memory_manager.h"
37 #include "trace.h"
38 #include "simulation_controller.h"
39 #include "user_parameters.h"
40 #include "testbench_in_interface.h"
41 #include "testbench_algorithms.h"
42 #include <map>
43 #include <set>
44 
45 using namespace sc_core;
46 using namespace sc_dt;
47 using namespace std;
48 using namespace tlm;
49 using namespace tlm_utils;
50 
51 #define FOUT if(generate_logfile()) (*fout)
52 
53 DECLARE_EXTENDED_PHASE(internal_ph_tb);
54 
55 template<int Ni>
56 class TestbenchIn : public sc_module, public Testbench_in_interface<Ni> {
57 
58 public:
59 
60  // I/O sockets
61  multi_passthrough_target_socket<TestbenchIn> input_target_socket;
62 
63 private:
64 
65  // Payload event queues
66  peq_with_cb_and_phase<TestbenchIn> m_peq_targ;
67 
68  // Maps to retrieve socket ID from a transaction in PEQ callbacks
69  map<tlm_generic_payload*, unsigned int> m_id_targ_map;
70 
71  // Events
72  sc_event response_received_event[Ni];
73  sc_event transaction_received;
74 
75  // Transactions
76  tlm_generic_payload* incoming_transaction[Ni];
77  tlm_generic_payload* incoming_transaction_pending[Ni];
78 
79  // Memory manager
80  Memory_manager m_mm;
81 
82  // Data
83  int *data_in[Ni];
84  uint64 address_in[Ni];
85  int nb_data_received[Ni];
86 
87  // Packet sizes
88  int input_packet_size[Ni];
89 
90  // Timing parameters
91  sc_time end_req_time[Ni];
92  sc_time begin_resp_time[Ni];
93  sc_time computation_time;
94 
95  // Trace methods events
96  sc_event set_target_phase_end_req_event[Ni];
97  sc_event set_target_phase_begin_resp_event[Ni];
98 
99  // Log file stream
100  ofstream* fout;
101 
102  // Trace file
103  sc_trace_file *tf;
104  trace_packet_testbench_t<Ni, 0> trace_packet;
105 
106  // Misc
107  int nb_responses_received; /*< Number of responses received so far */
108  int current_transaction_id; /*< Transaction currently processed */
109 
110  vector<string> preceding_modules_connection_name;
111 
112 
113  // Priority channels / Communications
114  set<int> priority_channels_in;
115  int nb_non_priority_channels_requests_in;
116  sc_event decrement_nb_non_priority_channels_requests_in_event;
117  sc_event shared_channel_in_ready_event;
118  sc_event send_end_req_event[Ni];
120  string applicationName;
121 
122  void (*testbench_thread_ptr)(Testbench_in_interface<Ni> &);
123 
124  vector<int> sockets_with_new_transactions;
125 
126 public:
127 
128  // Constructor
129  SC_HAS_PROCESS(TestbenchIn);
130  TestbenchIn(sc_module_name instname, void (*tb_thread)(Testbench_in_interface<Ni> &), ofstream& logfile, sc_trace_file *mtf) :
131  input_target_socket("input_socket"),
132  m_peq_targ(this, &TestbenchIn::peq_targ_callback),
133  fout(&logfile),
134  testbench_thread_ptr(tb_thread),
135  tf(mtf) {
136 
137  for(int i = 0; i < Ni; i++) {
138  incoming_transaction[i]= 0;
139  incoming_transaction_pending[i]= 0;
140  nb_data_received[i] = 0;
141  }
142 
143  nb_responses_received = 0;
144  current_transaction_id = 0;
145  nb_non_priority_channels_requests_in = 0;
146 
147  // Data in initialization
148  for(int i = 0; i < Ni; i++) {
149  input_packet_size[i] = 16;
150  data_in[i] = new int[input_packet_size[i]];
151  for(int j = 0; j < input_packet_size[i]; j++) data_in[i][j] = 0;
152  }
153 
154  // Init timing parameters
155  for(int i = 0; i < Ni; i++) end_req_time[Ni] = sc_time(50, SC_US);
156  for(int i = 0; i < Ni; i++) begin_resp_time[Ni] = sc_time(50, SC_US);
157  computation_time = sc_time(500, SC_US);
158 
159  // Register transport methods
160  input_target_socket.register_nb_transport_fw(this, &TestbenchIn::nb_transport_fw);
161 
162  // Spawn testbench thread as a function outside the class
163  sc_spawn(sc_bind(testbench_thread_ptr, sc_ref(*this)), "testbench_in_thread");
164 
165  SC_METHOD(decrement_nb_non_priority_channels_requests_in_method);
166  sensitive << decrement_nb_non_priority_channels_requests_in_event;
167  dont_initialize();
168 
169  // Dynamic threads initialization for tracing purpose: set_target_phase_end_req
170  for(int i = 0; i < Ni; i++) {
171  sc_spawn_options method_options;
172  method_options.spawn_method();
173  method_options.dont_initialize();
174  method_options.set_sensitivity(&set_target_phase_end_req_event[i]);
175  string process_name("set_target_phase_end_req_process_");
176  ostringstream out;
177  out << i;
178  process_name.append(out.str());
179 
180  sc_spawn(sc_bind(&TestbenchIn<Ni>::set_target_phase_end_req, this, i), process_name.c_str(), &method_options);
181  }
182 
183  // Dynamic threads initialization for tracing purpose: set_target_phase_begin_resp
184  for(int i = 0; i < Ni; i++) {
185  sc_spawn_options method_options;
186  method_options.spawn_method();
187  method_options.dont_initialize();
188  method_options.set_sensitivity(&set_target_phase_begin_resp_event[i]);
189  string process_name("set_target_phase_begin_resp_process_");
190  ostringstream out;
191  out << i;
192  process_name.append(out.str());
193 
194  sc_spawn(sc_bind(&TestbenchIn<Ni>::set_target_phase_begin_resp, this, i), process_name.c_str(), &method_options);
195  }
196 
197  // Send end req process
198  for(int i = 0; i < Ni; i++) {
199  sc_spawn_options method_options;
200  method_options.spawn_method();
201  method_options.dont_initialize();
202  method_options.set_sensitivity(&send_end_req_event[i]);
203  string process_name("set_end_req_process_process_");
204  ostringstream out;
205  out << i;
206  process_name.append(out.str());
207 
208  sc_spawn(sc_bind(&TestbenchIn<Ni>::send_end_req_method, this, i), process_name.c_str(), &method_options);
209  }
210 
211  // Add signals to trace
212  init_packet();
213  sc_trace(tf, trace_packet, (string) name());
214  }
215 
216  ~TestbenchIn() {
217  for(int i = 0; i < Ni; i++) {
218  delete[] data_in[i];
219  }
220  }
221 
222  // Payload event queue callback function
223  void peq_targ_callback(tlm_generic_payload& trans, const tlm_phase& phase);
224 
225  // Transport methods
226  virtual tlm_sync_enum nb_transport_fw(int id, tlm_generic_payload& trans, tlm_phase& phase, sc_time& delay);
227 
228  // Helper functions
229  void send_response(int id, tlm_generic_payload& trans);
230  tlm_sync_enum send_end_req(int socketID, tlm_generic_payload& trans);
231 
232  void decrement_nb_non_priority_channels_requests_in_method(void);
233 
234  // Simulation controller interface
235  void notify_simulation_controller(bool);
236 
237  // Testbench interface methods
238  string getName(void) const;
239 
240  // User interface
241  void verify_bindings(void);
242  void set_packet_size(string connection_name, int val);
243 
244  void add_preceding_module_connection_name(string name);
245  void add_timing_info(tlm_phase_enum phase, string connection_name, sc_time time);
246  void set_end_req_time(string connection_name, sc_time t);
247  void set_begin_resp_time(string connection_name, sc_time t);
248 
249  void info(void);
250 
251  // Trace packet
252  void init_packet(void);
253  void update_target_packet(int id, tlm_phase phase);
254  void update_target_packet(int id);
255  void set_target_phase_end_req(int id);
256  void set_target_phase_begin_resp(int id);
257 
258  // Priority channels
259  void add_priority_channel(string connection_name);
260  bool is_priority_channel_in(int id);
261  void send_end_req_method(int id);
262 
263  void set_application_name(string n);
264 
265  int get_input_socket_id(string connection_name) const;
266 
267 
268  // TB In Interface
269  const char * TB_IF_name(void) const;
270  string TB_IF_get_instance_name(void) const;
271  const sc_event& TB_IF_transaction_received_event(void) const;
272  const int TB_IF_get_nb_transactions_received_per_socket(int socketID) const;
273  const int TB_IF_get_nb_transactions_received_per_socket(string channelName) const;
274  const int TB_IF_get_nb_transactions_received(void) const;
275  int* TB_IF_get_data_in_ptr(int) const;
276  int* TB_IF_get_data_in_ptr(string) const;
277  void TB_IF_notify_simulation_controller(bool);
278  int TB_IF_get_packet_size(int ID) const;
279  int TB_IF_get_packet_size(string name) const;
280  int TB_IF_get_input_socket_id(string name) const;
281  string TB_IF_get_connection_name(int id) const;
282  vector<int> TB_IF_get_sockets_with_new_transactions(void);
283 };
284 
285 
286 /***********************************
287  ****** Target part ******
288  ***********************************/
289 
290 // Forward path for the target socket
291 template<int Ni>
292 tlm_sync_enum TestbenchIn<Ni>::nb_transport_fw(int id, tlm_generic_payload& trans, tlm_phase& phase, sc_time& delay) {
293 
294  sc_dt::uint64 adr = trans.get_address();
295  unsigned int len = trans.get_data_length();
296  unsigned char* byt = trans.get_byte_enable_ptr();
297  unsigned int wid = trans.get_streaming_width();
298 
299  // Obliged to check the transaction attributes for unsupported features
300  // and to generate the appropriate error response
301  if (byt != 0) {
302  trans.set_response_status(TLM_BYTE_ENABLE_ERROR_RESPONSE);
303  return TLM_COMPLETED;
304  }
305  if (len > (4 * (unsigned int) input_packet_size[id]) || wid < len) {
306  trans.set_response_status(TLM_BURST_ERROR_RESPONSE);
307  return TLM_COMPLETED;
308  }
309 
310  // Now queue the transaction until the annotated time has elapsed
311  m_id_targ_map[&trans] = id;
312  m_peq_targ.notify(trans, phase, delay);
313 
314  return TLM_ACCEPTED;
315 }
316 
317 // Payload event queue callback (Target side)
318 template<int Ni>
319 void TestbenchIn<Ni>::peq_targ_callback(tlm_generic_payload& trans, const tlm_phase& phase) {
320 
321  int socketID = m_id_targ_map[&trans];
322 
323  int nb_total_data_received = 0;
324 
325  #ifdef DEBUG
326  if(phase == BEGIN_REQ)
327  FOUT << sc_time_stamp() << ": " << name() << " (T" << socketID << ") received BEGIN_REQ at address " << hex << trans.get_address() << endl;
328  else if(phase == END_RESP)
329  FOUT << sc_time_stamp() << ": " << name() << " (T" << socketID << ") received END_RESP at address " << hex << trans.get_address() << endl;
330  else if(phase == internal_ph_tb)
331  FOUT << sc_time_stamp() << ": " << name() << " (T" << socketID << ") received int_phase at address " << hex << trans.get_address() << endl;
332  #endif
333 
334  switch (phase) {
335  case BEGIN_REQ:
336 
337  // Increment the transaction reference count
338  trans.acquire();
339 
340  send_end_req_event[socketID].notify();
341 
342  incoming_transaction[socketID] = &trans;
343 
344  //nb_data_received[socketID]++;
345  //status = send_end_req(socketID, trans);
346 
347  update_target_packet(socketID, phase);
348 
349  break;
350 
351  case END_RESP:
352 
353  //cout << "TB received response for transaction " << trans.get_address() << endl;
354 
355  incoming_transaction[socketID] = 0;
356 
357  sockets_with_new_transactions.push_back(socketID);
358  transaction_received.notify();
359 
360  update_target_packet(socketID, phase);
361 
362  trans.release();
363 
364  break;
365 
366  case END_REQ:
367  case BEGIN_RESP:
368  SC_REPORT_FATAL("TLM-2", "Illegal transaction phase received by target");
369  break;
370 
371  default:
372 
373  if (phase == internal_ph_tb) {
374 
375  // Set response status (mandatory)
376  trans.set_response_status(TLM_OK_RESPONSE);
377  send_response(socketID, trans);
378  update_target_packet(socketID);
379 
380  break;
381  }
382  }
383 
384 
385 }
386 
387 template<int Ni>
389  nb_non_priority_channels_requests_in--;
390  if(nb_non_priority_channels_requests_in == 0) shared_channel_in_ready_event.notify();
391 }
392 
393 template<int Ni>
395 
396  if(!is_priority_channel_in(id)) {
397  if(nb_non_priority_channels_requests_in != 0) {
398  FOUT << sc_time_stamp() << ": " << name() << ": (I) request already in progress in shared channel, waiting for shared_channel_in_ready_event" << endl;
399  next_trigger(shared_channel_in_ready_event);
400  return;
401  }
402 
403  nb_non_priority_channels_requests_in++;
404  }
405 
406  // Store transaction address and data into local memory
407  address_in[id] = incoming_transaction[id]->get_address();
408  memcpy(data_in[id], reinterpret_cast<int *>(incoming_transaction[id]->get_data_ptr()), incoming_transaction[id]->get_data_length());
409 
410  //cout << name() << " socket " << socketID << " nb_data_received: " << nb_data_received[socketID] << endl;
411 #ifdef DEBUG
412  FOUT << sc_time_stamp() << ": " << name() << " (T" << id << ") Updating address and data. New address: " << address_in[id] << " (Transaction " << dec << nb_data_received[id] << ")" << endl;
413 
414  FOUT << "Data: " << hex;
415  for(int i = 0; i < 16; i++) FOUT << data_in[id][i] << " ";
416 
417  FOUT << endl << endl;
418 
419 #endif
420 
421  send_end_req(id, *incoming_transaction[id]);
422 
423  next_trigger();
424 }
425 
426 template<int Ni>
427 tlm_sync_enum TestbenchIn<Ni>::send_end_req(int socketID, tlm_generic_payload& trans) {
428 
429  tlm_sync_enum status;
430  tlm_phase bw_phase;
431  tlm_phase int_phase = internal_ph_tb;
432  sc_time delay;
433 
434  // Queue the acceptance and the response with the appropriate latency
435  bw_phase = END_REQ;
436  delay = end_req_time[socketID];
437  status = input_target_socket[socketID]->nb_transport_bw(trans, bw_phase, delay);
438  if (status == TLM_COMPLETED) {
439  // Transaction aborted by the initiator
440  // (TLM_UPDATED cannot occur at this point in the base protocol, so need not be checked)
441  trans.release();
442  return status;
443  }
444 
445  set_target_phase_end_req_event[socketID].notify(delay);
446 
447  // Queue internal event to mark beginning of response
448  delay = delay + computation_time; // Latency
449  m_id_targ_map[&trans] = socketID;
450  m_peq_targ.notify(trans, int_phase, delay);
451 
452  if(!is_priority_channel_in(socketID)) decrement_nb_non_priority_channels_requests_in_event.notify(delay);
453 
454  nb_data_received[socketID]++;
455 
456  return status;
457 }
458 
459 template<int Ni>
460 void TestbenchIn<Ni>::send_response(int id, tlm_generic_payload& trans) {
461 
462  tlm_sync_enum status;
463  tlm_phase bw_phase;
464  sc_time delay;
465 
466  bw_phase = BEGIN_RESP;
467  delay = begin_resp_time[id];
468 
469  status = input_target_socket[id]->nb_transport_bw(trans, bw_phase, delay);
470 
471  set_target_phase_begin_resp_event[id].notify(delay);
472 
473  if (status == TLM_UPDATED) {
474  // The timing annotation must be honored
475  m_id_targ_map[&trans] = id;
476  m_peq_targ.notify(trans, bw_phase, delay);
477  } else if (status == TLM_COMPLETED) {
478  // The initiator has terminated the transaction
479  trans.release();
480  }
481 }
482 
483 
484 template<int Ni>
486  Reconfiguration_manager::endApplication(applicationName, success);
487 }
488 
492 template<int Ni>
493 string TestbenchIn<Ni>::getName(void) const {
494  return name();
495 }
496 
497 /******************************
498  **** User interface ****
499  ******************************/
500 template<int Ni>
501 void TestbenchIn<Ni>::set_packet_size(string connection_name, int val) {
502 
503  int socketID = -1;
504  for(int i = 0; i < (int) preceding_modules_connection_name.size(); i++) {
505  if(preceding_modules_connection_name.at(i).compare(connection_name) == 0) {
506  socketID = i;
507  break;
508  }
509  }
510 
511 #ifdef CONSOLE_DEBUG
512  cout << "Preceding module" << endl;
513  cout << "Socket ID: " << socketID << endl;
514 #endif
515 
516  assert(socketID < Ni);
517  input_packet_size[socketID] = val;
518 
519  try {
520  delete[] data_in[socketID];
521  data_in[socketID] = new int[input_packet_size[socketID]];
522  for(int i = 0; i < input_packet_size[socketID]; i++) data_in[socketID][i] = 0;
523  } catch (bad_alloc& ba) {
524  cerr << "ERROR: " << name() << " bad_alloc caught: " << ba.what() << endl;
525  //exit(-1);
526  Simulation_controller::endSimulation();
527  }
528 }
529 
530 template<int Ni>
532  if(input_target_socket.size() != Ni) {
533  cerr << "ERROR: Incorrect bindings for module " << name() << "! Exiting..." << endl;
534  exit(-1);
535  }
536 }
537 
538 template<int Ni>
539 void TestbenchIn<Ni>::set_end_req_time(string connection_name, sc_time t) {
540  add_timing_info(END_REQ, connection_name, t);
541 }
542 
543 template<int Ni>
544 void TestbenchIn<Ni>::set_begin_resp_time(string connection_name, sc_time t) {
545  add_timing_info(BEGIN_RESP, connection_name, t);
546 }
547 
548 template<int Ni>
550  preceding_modules_connection_name.push_back(name);
551 }
552 
553 template<int Ni>
554 void TestbenchIn<Ni>::add_timing_info(tlm_phase_enum phase, string connection_name, sc_time time) {
555 
556  int socketID = -1;
557  for(int i = 0; i < (int) preceding_modules_connection_name.size(); i++) {
558  if(preceding_modules_connection_name.at(i).compare(connection_name) == 0) {
559  socketID = i;
560  break;
561  }
562  }
563 
564  switch(phase) {
565  case END_REQ: end_req_time[socketID] = time; break;
566  case BEGIN_RESP: begin_resp_time[socketID] = time; break;
567  default: cerr << "ERROR: Phase not recognized!" << endl;
568  }
569 }
570 
571 template<int Ni>
572 void TestbenchIn<Ni>::info(void) {
573 
574  FOUT << endl << "Testbench " << name() << ":" << endl;
575 
576  for(int i = 0; i < Ni; i++) {
577  FOUT << "Input socket " << i << " (Connection " << preceding_modules_connection_name.at(i) << "):" << endl;
578  if(priority_channels_in.find(i) != priority_channels_in.end()) FOUT << " Priority channel" << endl;
579  FOUT << " Packet size: " << input_packet_size[i] << endl;
580  FOUT << " END_REQ time: " << end_req_time[i] << endl;
581  FOUT << " BEGIN_RESP time: " << begin_resp_time[i] << endl;
582  }
583 }
584 
585 // Priority channels
586 template<int Ni>
587 void TestbenchIn<Ni>::add_priority_channel(string connection_name) {
588  int id = -1;
589  for(int i = 0; i < (int) preceding_modules_connection_name.size(); i++) {
590  if(preceding_modules_connection_name.at(i).compare(connection_name) == 0) {
591  id = i;
592  break;
593  }
594  }
595 
596  if(id == -1) cerr << "ERROR: Module " << name() << " cannot find connection name through preceding or following modules vector!" << endl;
597 
598  assert(id < Ni);
599  priority_channels_in.insert(id);
600 }
601 
602 template<int Ni>
604  return (priority_channels_in.find(id) != priority_channels_in.end());
605 }
606 
607 template<int Ni>
609  applicationName = n;
610 }
611 
612 
613 
614 template<int Ni>
615 int TestbenchIn<Ni>::get_input_socket_id(string connection_name) const {
616  int socketID = -1;
617  for(int i = 0; i < (int) preceding_modules_connection_name.size(); i++) {
618  if(preceding_modules_connection_name.at(i).compare(connection_name) == 0) {
619  socketID = i;
620  break;
621  }
622  }
623 
624  if(socketID == -1) {
625  cerr << "Error: Testbench unable to retrieve input socket ID via connection name" << endl;
626  exit(RECOSIM_INTERNAL_ERROR_ERRCODE);
627  }
628 
629  return socketID;
630 }
631 
632 
633 /**********************************
634  * Testbench In Interface *
635  **********************************/
636 template<int Ni>
637 const char * TestbenchIn<Ni>::TB_IF_name(void) const {
638  return name();
639 }
640 
641 template<int Ni>
643  string fullname(name());
644  if(fullname.find("/") != string::npos) {
645  return (fullname.substr(fullname.find("/") + 1)).c_str();
646  } else return name();
647 }
648 
649 template<int Ni>
651  return transaction_received;
652 }
653 
654 template<int Ni>
656  return nb_data_received[socketID];
657 }
658 
659 template<int Ni>
661  return TB_IF_get_nb_transactions_received_per_socket(get_input_socket_id(channelName));
662 }
663 
664 template<int Ni>
666  int nb_total_data_received = 0;
667  for(int i = 0; i < Ni; i++) nb_total_data_received += nb_data_received[i];
668  return nb_total_data_received;
669 }
670 
671 template<int Ni>
672 int* TestbenchIn<Ni>::TB_IF_get_data_in_ptr(int socketID) const {
673  return data_in[socketID];
674 }
675 
676 template<int Ni>
677 int* TestbenchIn<Ni>::TB_IF_get_data_in_ptr(string connectionName) const {
678  return data_in[get_input_socket_id(connectionName)];
679 }
680 
681 template<int Ni>
683  notify_simulation_controller(val);
684 }
685 
686 template<int Ni>
688  return input_packet_size[ID];
689 }
690 
691 template<int Ni>
692 int TestbenchIn<Ni>::TB_IF_get_packet_size(string connectionName) const {
693  return TB_IF_get_packet_size(get_input_socket_id(connectionName));
694 }
695 
696 template<int Ni>
697 int TestbenchIn<Ni>::TB_IF_get_input_socket_id(string connectionName) const {
698  return get_input_socket_id(connectionName);
699 }
700 
701 template<int Ni>
703  return preceding_modules_connection_name.at(id);
704 }
705 
706 template<int Ni>
708  vector<int> vectorCopy(sockets_with_new_transactions);
709  sockets_with_new_transactions.clear();
710  return vectorCopy;
711 }
712 
713 
714 /**********************************
715  * Packet trace methods *
716  **********************************/
717 
718 
719 template<int Ni>
720 void TestbenchIn<Ni>::init_packet(void) {
721  //update_initiator_packet(0);
722  //update_target_packet(0);
723 }
724 
725 
726 template<int Ni>
727 void TestbenchIn<Ni>::update_target_packet(int id, tlm_phase phase) {
728  assert(id < Ni);
729  update_target_packet(id);
730  trace_packet.target_packet[id].phase = tlm_phase_to_ascii(phase);
731 }
732 
733 template<int Ni>
735  assert(id < Ni);
736  trace_packet.target_packet[id].transaction.update_transaction(incoming_transaction[id]);
737  trace_packet.target_packet[id].transaction_pending.update_transaction(incoming_transaction_pending[id]);
738 }
739 
740 template<int Ni>
742  assert(id < Ni);
743  trace_packet.target_packet[id].phase = END_REQ_ASCII;
744 }
745 
746 template<int Ni>
748  assert(id < Ni);
749  trace_packet.target_packet[id].phase = BEGIN_RESP_ASCII;
750 }
751 
752 #endif
string getName(void) const
Definition: testbench_in.h:493
vector< int > TB_IF_get_sockets_with_new_transactions(void)
Get a list of the sockets that received a new transaction since last function call. WARNING: Calling this function will reset the vector stored within the testbench and hence should be stored in a new vector within the algorithm thread.
Definition: testbench_in.h:707
Definition: testbench_in_interface.h:31
Definition: memory_manager.h:29
const int TB_IF_get_nb_transactions_received(void) const
Get the number of transactions processed by every socket.
Definition: testbench_in.h:665
string TB_IF_get_instance_name(void) const
Get testbench instance name.
Definition: testbench_in.h:642
int TB_IF_get_input_socket_id(string name) const
Get input socket id by the name of the connection.
Definition: testbench_in.h:697
const char * TB_IF_name(void) const
Get testbench full name.
Definition: testbench_in.h:637
int * TB_IF_get_data_in_ptr(int) const
Get incoming data pointer.
Definition: testbench_in.h:672
int TB_IF_get_packet_size(int ID) const
Get socket packet size.
Definition: testbench_in.h:687
string TB_IF_get_connection_name(int id) const
Get the name of the connection bound to a particular socket.
Definition: testbench_in.h:702
Definition: testbench_in.h:56
Definition: trace.h:168
const int TB_IF_get_nb_transactions_received_per_socket(int socketID) const
Get the number of transactions processed per socket.
Definition: testbench_in.h:655
void TB_IF_notify_simulation_controller(bool)
Notifies simulation controller about success/failure of the simulation (e.g. data corruption)...
Definition: testbench_in.h:682
const sc_event & TB_IF_transaction_received_event(void) const
Get the event launched when a transaction has been received.
Definition: testbench_in.h:650