/*
* Processor.xc
*
* Created on: Mar 26, 2011
* Author: Phani Gaddipati
* phanigaddipati@yahoo.com
*/
#include "DataProcessor.h"
#include <stdio.h>
int processPair(int a, int b);
void processorThread(chanend inChan, chanend outChan) {
short currentData[16];
short counter1;
int ret;
timer t;
unsigned long time;
unsigned long time2;
unsigned long time3;
t :> time;
for (counter1 = 0; counter1 < 16; counter1++) {
inChan :> currentData[counter1];
}
t :> time2;
for (counter1 = 0; counter1 < 14; counter1+=2) {
ret = processPair(currentData[counter1],currentData[counter1+1]);
}
t :> time3;
printf("Process Thread: %ld, %ld \t %ld\n",(time2-time),(time3-time2),(time3-time));
}
int processPair(int a, int b) {
return (1000000 * (a - b) / 1000000 * (a + b));
}