Newton-Raphson Reciprocal
Hard · Sequential · SystemVerilog
Compute the reciprocal $1/d$ of an unsigned fixed-point divisor using the iterative Newton-Raphson method, producing a result in the same Q(WIDTH-FRAC_BITS).FRAC_BITS format after exactly {ITERATIONS} clock cycles.
**Fixed-point format**
All values, including {d} and {recip_out}, are unsigned fixed-point numbers in Q(WIDTH-FRAC_BITS).FRAC_BITS format: {FRAC_BITS} fractional bits and $(WIDTH - FRAC\_BITS)$ integer bits. With the default parameters (WIDTH $= 16$, FRAC_BITS $= 14$): $1.0$ is represented as $16384$ ($= 2^{14}$, or 16'h4000), $0.5$ as $8192$ (16'h2000), and the maximum representable value $\approx 3.9999$ as $65535$ (16'hFFFF). The representable range of {d} is $(0,\; 2^{WIDTH-FRAC\_BITS})$ exclusive (i.e. $d$ must be nonzero and strictly less than $2^{WIDTH-FRAC\_BITS}$).
**Newton-Raphson algorithm**
The module executes {ITERATIONS} steps of the quadratic-convergence recurrence:
$x_0 = \text{seed}(d)$