I have to implement a second order filter in DF1 or DF2. I should avoid housekeeping operations by suitable addressing strategies.

I don't understand what "housekeeping operations" means. Anyone could help me or propose a source i can find more information?


I use DF2 for the second-order filter: enter image description here

As pichenettes proposes with Housekeeping the code in matlab is something like:

%x=input sample
%state=containing old input values
%compute output value

%Update states

Without Housekeeping is going to be like:

%compute output value
pointer=rem(pointer+1,N-1); %increment pointer in modulo form, N number of taps 

%Update states 

%Overwrite oldest sum with b(N-1).x
pointer=rem(pointer+1,N-1);%Increment pointer modulo-(N-1)

Is that right?Any mistakes?

  • $\begingroup$ I don't think that's it. Your second example uses a circular buffer that really isn't required. Your first example is already "housekeeping" free since it doesn't contain a statement like state(2) = state(1), that implements the delay line by shuffling variables. In practice you would NOT implement the state as an array but as individual variables that are kept in registers $\endgroup$ – Hilmar Apr 16 '13 at 22:57

First, maybe you could give us more context (is that homework?).

I think that what is meant by "housekeeping operations" are the data transfers between registers / state variables ("delay propagation") that naturally arise when naively implementing filters. For example, a naive implementation of a 4-tap FIR would look like this:

output = h[0] * input + h[1] * x[0] + h[2] * x[1] + h[3] * x[2]
// "Housekeeping" operations
x[2] = x[1]
x[1] = x[0]
x[0] = input

The data transfers operations can be avoided on some hardware architectures (especially DSP) by using modulo addressing. I think this is what is meant by "suitable addressing strategies".

| improve this answer | |
  • $\begingroup$ Thank you, i think i understand the concept. If the edit i make is correct... $\endgroup$ – 20317 Apr 16 '13 at 19:06
  • 1
    $\begingroup$ It looks like you're on the right track (I haven't checked the details) - It's a strange exercise though to do this kind of things in matlab. You should see the benefits more clearly when writing this in the assembly language of a DSP of your choice - in which each data access / multiplication / accumulation is done in a single instruction, with all the modulo arithmetic handled automatically by the address generation unit (AGU) rather than performed explicitly by the ALU. $\endgroup$ – pichenettes Apr 16 '13 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.