Design an Exponential Moving Average (EMA) calculator.

Module name: ema
Parameters:
  - WIDTH      = 24    // Total bit width (signed Q15.8 fixed-point)
  - FRAC       = 8     // Fractional bits
  - ALPHA_FRAC = 8     // Fractional bits for alpha (unsigned Q0.ALPHA_FRAC)

Ports:
  - input                        clk
  - input                        rst_n        // Active-low synchronous reset
  - input  signed [WIDTH-1:0]    price_in     // Signed fixed-point price input
  - input  [ALPHA_FRAC-1:0]      alpha        // Smoothing factor, unsigned Q0.ALPHA_FRAC
  - input                        valid_in     // High for one cycle when price_in is valid
  - output signed [WIDTH-1:0]    ema_out      // EMA output (signed fixed-point)
  - output                       valid_out    // High after first valid sample

Functional specification:
  - Compute EMA_new = alpha * price_in + (1 - alpha) * EMA_prev
  - alpha is unsigned Q0.ALPHA_FRAC, representing a value in [0, 1)
  - The first valid sample initializes EMA directly (EMA = price_in)
  - After the first sample, valid_out stays high
  - Use wider internal arithmetic to prevent overflow during multiply-accumulate
  - On reset, clear EMA state and valid flag
