Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /*
  2. * Processor.xc
  3. *
  4. * Created on: Mar 26, 2011
  5. * Author: Phani Gaddipati
  6. * phanigaddipati@yahoo.com
  7. */
  8. #include "DataProcessor.h"
  9. #include <stdio.h>
  10.  
  11. int processPair(int a, int b);
  12.  
  13. void processorThread(chanend inChan, chanend outChan) {
  14. short currentData[16];
  15. short counter1;
  16. int ret;
  17. timer t;
  18. unsigned long time;
  19. unsigned long time2;
  20. unsigned long time3;
  21.  
  22. t :> time;
  23.  
  24. for (counter1 = 0; counter1 < 16; counter1++) {
  25. inChan :> currentData[counter1];
  26. }
  27. t :> time2;
  28. for (counter1 = 0; counter1 < 14; counter1+=2) {
  29. ret = processPair(currentData[counter1],currentData[counter1+1]);
  30. }
  31. t :> time3;
  32.  
  33. printf("Process Thread: %ld, %ld \t %ld\n",(time2-time),(time3-time2),(time3-time));
  34.  
  35. }
  36.  
  37. int processPair(int a, int b) {
  38. return (1000000 * (a - b) / 1000000 * (a + b));
  39. }