#include "systemc.h"

SC_MODULE(transmit){
   
   sc_outmaster<int > inp1;
   
   sc_in_clk clk;
   
   static int array[10];
   
   int i;
   
   //Transmit block: sends data from array, uses clock sensitive autonomous thread
   void transmit_f() {
      while(true) {
         wait();
         cout << endl << "transmit: data transmitted = " << array[i] 
              << "  at time = " << sc_time_stamp() << endl;
         inp1 = array[i];
         if (i >= 9) i = 0;
         else i++;
      }
   }
   
   SC_CTOR(transmit) {
      SC_THREAD(transmit_f);
      sensitive << clk;  //clock in NS
      i = 0;
   } 
};
