HOME       UP       PREV       NEXT (Inter-thread scheduling ?)  

Systolic Implementation of FIR Filter.

        static void ParallelFIR(int size, Kiwi.Channel xin, Kiwi.Channel yout)
        {
           Kiwi.Channel[] Xchannels = new Kiwi.Channel[size];
           Kiwi.Channel[] Ychannels = new Kiwi.Channel[size + 1];

           Ychannels[size] = new Kiwi.Channel();

            // Create the channels to link together the taps                                                                                    
            for (int c = 0; c < size; c++)
            {
                Xchannels[c] = new Kiwi.Channel();
                Ychannels[c] = new Kiwi.Channel();
                Ychannels[c].Write(0); // Pre-populate y-channel registers with zeros                                                           
            }

            // Connect up the taps for a transposed filter                                                                                      
            for (int i = 0; i < size; i++)
            {
                int jj = i;
                Thread tapThread = new Thread(delegate() { Tap(jj, weights[jj], Xchannels[jj], Ychannels[jj], Ychannels[jj+1]); });
                tapThread.Start();
            }


            // Broadcast the input                                                                                                              
            Thread broadcast = new Thread(delegate() { BroadcastInput(xin, Xchannels); });
            broadcast.Start();

            // Insert an infinte sequence of zeros into the first Y channel stage                                                               
            Thread zeroYs = new Thread(delegate() { ZeroFirstY(Ychannels[0]); });
            zeroYs.Start();

            // Drive yout                                                                                                                       
            int yresult;
            while (true)
            {
                yresult = Ychannels[size].Read();
                yout.Write(yresult);
            }
        }


20: (C) 2011, DJ Greaves, S Singh, University of Cambridge, Computer Laboratory.