/*--------------------------------------------------------- * * Finite Impulse Response (FIR) Filter (C-RAM) * */ #include #include"fir.h" // PE0 has least delay // highest PE's input is tied to ground cuint8 weights[TAPSperPE]; // [0] is least delayed cuint16 runningSum[TAPSperPE + 1]; // [highest] from previous PE long int fir(int in) { int j; // get runningSum from neighbour runningSum[TAPSperPE].cshiftx(-1, runningSum[0]); for (j = TAPSperPE-1; j >= 0; j--) // inner product of weights runningSum[j] = runningSum[j + 1] + weights[j] * in; return (runningSum[0][0]); }