Calculate reciprocal with Newton-Raphson approximation method
HDL Coder / HDL Operations
The HDL Reciprocal block uses the Newton-Raphson iterative method to compute the reciprocal of the block input. The Newton-Raphson method uses linear approximation to successively find better approximations to the roots of a real-valued function.
The reciprocal of a real number is defined as a zero of the function:
HDL Coder™ chooses an initial estimate in the range as this is the domain of convergence for the function.
To successively compute the roots of the function, specify the Number of iterations parameter in the Block Parameters dialog box. The process is repeated as:
is the derivative of the function .
Following table shows comparison of simulation behavior of HDL Reciprocal with Math Reciprocal block:
|Math Reciprocal||HDL Reciprocal|
Computes the reciprocal as 1/N by using the HDL divide operator (/) to implement the division.
Uses the Newton-Rapshon iterative method. The block computes an approximate value of reciprocal of the block input and can yield different simulation results compared to the Math Reciprocal block.
To match the simulation results with the Math Reciprocal block, increase the number of iterations for the HDL Reciprocal block.
Number of Newton-Raphson iterations. The default is 3.
The block has the following ports:
Supported data types: Fixed-point, integer (signed or unsigned), double, single
Minimum bit width: 2
Maximum bit width: 128
|Input data type||Output data type|
|built-in integer||built-in integer|
|built-in fixed-point||built-in fixed-point|