// Master block which Transmits data

#include "systemc.h"

SC_MODULE(transmit){
   
   // Refinable ports
      sc_outmaster<int > inp1;
   
   sc_in_clk clk;
   
   static int array[10];
   
   int i;
   
   // Transmit function to send data on every clock edge
   void transmit_f() {
      while(true) {
         wait(); // Static sensitivity wait
         
         cout << "data transmitted = " << array[i];
         inp1 = array[i]; // Writes the value to slave
         
         if (i >= 9) i = 0; // Check for the end of the Array & again go to top.
         else i++;
      }
   }
   
   //Constructor to create & initialize an instance & data structures.
   SC_CTOR(transmit) {
      SC_THREAD(transmit_f); // Clock sensitive thread
      sensitive << clk;
      i = 0;
   } 
};