Forum Discussion
Altera_Forum
Honored Contributor
12 years agoYup, write a testbench and get simulating.
But you dont really specify exactly what you want? what exactly are you averaging? Notes on your code: - You dont show the whole code, so we cannot see signal declarations - WHy have you got a for loop summing together things? - This code looks messy A moving window average is easily acheived with a shift register and an adder tree, with a divider on the end. If the window is 2^n wide, all you need to divide is drop the n LSBs (with a possible rounding stage)