Design a Simple Moving Average (SMA) calculator with a sliding window.

Module name: sma
Parameters:
  - WIDTH  = 24       // Total bit width (Q15.8 fixed-point)
  - FRAC   = 8        // Fractional bits
  - WINDOW = 8        // Number of samples in the moving window

Ports:
  - input              clk
  - input              rst_n       // Active-low synchronous reset
  - input  [WIDTH-1:0] price_in    // Unsigned fixed-point price
  - input              valid_in    // High for one cycle when price_in is valid
  - output [WIDTH-1:0] avg_out     // SMA output (unsigned fixed-point)
  - output             valid_out   // High once WINDOW samples have been received

Functional specification:
  - Maintain a circular buffer of the last WINDOW price values
  - On each valid_in pulse, shift the new price into the buffer
  - Compute avg_out = sum(buffer) / WINDOW
  - Since WINDOW=8 is a power of 2, division is a right-shift by 3
  - valid_out stays high after the first WINDOW valid samples have been received
  - On reset, clear the buffer and counters
