Recursive Average The recursive average is a very efficient way to obtain a time-weighted average by low-pass filtering the signal. y[n] = (1-a)y[n-1] + ax[n] Consider the output for a step input if a = Output initialized to 0
Recursive Average By careful choice of a, we can create extremely efficient integer versions in software and hardware. Choose a to be N/2 n, where n ≥ 0 and 0 < N < 2 n 1-a is then 1 – N/2 n The accumulator width is generally larger than the input and output widths Exercise – implement in Verilog Let a = 5/8 (0.625) x, y are 8-bit unsigned values Keep 8 bits of fractional precision in accumulator NO multiplies or divides!
Simulation Results Note that accumulator value is still increasing after y=254. Will it ever get to 255?