Description

Moving Average

Design a hardware module that computes a moving average over a window of N samples. For each position in the stream (starting from position N-1), output the average of the current element and the N-1 preceding elements.

Example: For stream [10, 20, 30, 40, 50] with N=3, the output should be [20, 30, 40] (averages of [10,20,30], [20,30,40], [30,40,50]).

Input

stream

Stream of 12-bit Unsigned Integer
Input stream.

n

5-bit Unsigned Integer
Window size.

Output

Stream of 12-bit Unsigned Integer
Moving average.