// Master block which sends data

#include "systemc.h"

SC_MODULE(send_){
    
   // Refinable ports
   sc_outmaster<int > in_p1;
   
   sc_in_clk clk;
   
   static int pkt[10];
   
   int i;
   
   // Send function to Transmit data serially on every clock edge
   void send_f() {
      while(true) {
        wait(); // Static sensitivity wait
	
      	cout << "Transmitted Output = " << pkt[i] << endl;
       	in_p1 = pkt[i]; // Writes the value to slave
        
        if (i >= 9) i = 0; // Check for the end of the Packet & again go to top.
        else i++;
      }
   }
   
   //Constructor to create & initialize an instance & data structures.
   SC_CTOR(send_) {
      SC_THREAD(send_f); // Clock sensitive thread
      sensitive << clk;
      i = 0;
   } 
};
