Design a Relative Strength Index (RSI) calculator using Wilder's smoothing.

Module name: rsi
Parameters:
  - WIDTH  = 24       // Total bit width (signed Q15.8 fixed-point)
  - FRAC   = 8        // Fractional bits
  - PERIOD = 14       // RSI lookback period

Ports:
  - input                     clk
  - input                     rst_n       // Active-low synchronous reset
  - input  signed [WIDTH-1:0] price_in    // Signed fixed-point price
  - input                     valid_in    // High for one cycle when price_in is valid
  - output [WIDTH-1:0]        rsi_out     // RSI value 0-100 in unsigned Q15.8
  - output                    valid_out   // High after PERIOD+1 valid samples

Functional specification:
  - Compute price change: delta = price_in - prev_price
  - Separate gains (delta > 0) and losses (delta < 0, stored as positive)
  - First PERIOD changes: avg_gain = sum(gains)/PERIOD, avg_loss = sum(losses)/PERIOD
  - Subsequent: Wilder's smoothing:
      avg_gain = (prev_avg_gain * (PERIOD-1) + current_gain) / PERIOD
      avg_loss = (prev_avg_loss * (PERIOD-1) + current_loss) / PERIOD
  - RS = avg_gain / avg_loss
  - RSI = 100 - 100 / (1 + RS) = 100 * avg_gain / (avg_gain + avg_loss)
  - If avg_loss == 0: RSI = 100 (all gains)
  - If avg_gain == 0: RSI = 0 (all losses)
  - Output range 0 to 100 in Q15.8 fixed-point
  - valid_out after PERIOD+1 valid samples (need PERIOD deltas)
  - On reset, clear all state
