Example Code for FIR

All technical discussions and projects around startKIT
Junior Member
Posts: 7
Joined: Sat Mar 04, 2017 3:47 pm

Example Code for FIR

Post 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!

User avatar
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post 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
Posts: 1
Joined: Tue Nov 28, 2017 10:29 am

Post by donny33 »

Thank you for the post!