cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Throughput optimization of basic FIR filter implementation?

Highlighted

Throughput optimization of basic FIR filter implementation?

Hi All,

 

I'm working on creating a basic FIR filter as part of a larger project. I've created a really basic four tap filter using LabVIEW primitives that's about as fast as I can make it, but I was curious to see if anyone would be able to spot any ways I can make gains in efficiency Smiley Happy The file attached is a VI snippet.

 

Part of the problem is that eventually this would need to become a 64 or 128 tap filter, and I don't believe this implementation would scale up very well.

 

Some things I already tried that didn't do much:

  • Using compound arithmetic
  • Moving the array indexing function outside the for loop (surprisingly)
  • Disabling debugging

Thanks!

0 Kudos
Message 1 of 4
(264 Views)

Re: Throughput optimization of basic FIR filter implementation?

You're right in that it's going to be rough to scale.

 

To start trying to make it easier, try right-clicking on the Shift Registers and having them implement as a Feedback Node.  At least that way you're not forced to drag out N-1 of those.

 

Also, don't you want a casual filter?  If so, you'll need to set those initial conditions to 0.  Shift Registers/Feedback Nodes will maintain their last value.  If you call your filter more than once, you'll be using the values that remain from the last time you called the filter.

 

If you can get the MAC into an easy subVI, you can go into VI Properties and make it inline.  That way, it'll appear like a subVI but you'll be able to treat it as if it's on the block diagram.  That might make it a little easier to scale.

0 Kudos
Message 2 of 4
(211 Views)

Re: Throughput optimization of basic FIR filter implementation?

I noticed you're trying to time your loop.  You aren't succeeding with your current attempt.  There's nothing controlling the order of operation.  You'll want to use a sequence structure and change the time to high resolution relative seconds.

0 Kudos
Message 3 of 4
(195 Views)

Re: Throughput optimization of basic FIR filter implementation?

Maybe this will be better, although I question the efficiency of the "Rotate 1D Array" primitive.....

 

FIR example Snippet.png

 

PS. is this for a Windows, RT or FPGA target?

Message 4 of 4
(173 Views)