Page 1 of 1

Example Code for FIR

Posted: Fri Nov 10, 2017 9:28 am
by DSPguy
Hello everybody,
I am new to the field of DSP Processing and I'd like to implement a FIR Filter on the startKIT with the Audio Expansion Board.

Does anyone have an example code which does an FIR Filter? I already calculated the coefficients for it but I am not a programmer so it would be great to see how an implementation could look like. Number of taps doesn't matter for now.

Thanks in advance!

Matt

Re: Example Code for FIR

Posted: Mon Nov 13, 2017 4:17 pm
by infiniteimprobability
lib_dsp has a fir example in it - https://github.com/xmos/lib_dsp/blob/ma ... _filters.c

FIR tends to get written quite a lot as making it super efficient can depend on how many taps you need (fixing that to say a multiple of 12 is good due to addressing modes). You'll find FIR implementations in lib_src and lib_mic_array too..

Most of these implementations rely on the double load and store (2 x 32 coeffs or data) and loop unrolling to get to approaching 2 cycles per tap. Normally there is a saturate and extract at the end to get back to 32b from the 64b accumulator

Re: Example Code for FIR

Posted: Tue Nov 28, 2017 10:32 am
by donny33
Thank you for the post!