0% found this document useful (0 votes)
34 views4 pages

DSP Lab Experiment 3

This report details the implementation of a fixed-point division method using the Newton-Raphson iterative technique, focusing on the division of 15 by 23. The methodology includes fixed-point representation, Newton-Raphson iterations, and final computation, with verification through Verilog and MATLAB. The results show that the fixed-point representation accurately approximates the floating-point result of approximately 0.6522 with high precision.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

DSP Lab Experiment 3

This report details the implementation of a fixed-point division method using the Newton-Raphson iterative technique, focusing on the division of 15 by 23. The methodology includes fixed-point representation, Newton-Raphson iterations, and final computation, with verification through Verilog and MATLAB. The results show that the fixed-point representation accurately approximates the floating-point result of approximately 0.6522 with high precision.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Fixed-Point Division using Newton-Raphson

Method
Kanishk Devatwal - ee23btech11029
February 26, 2025

1 Introduction
Fixed-point arithmetic is widely used in embedded systems and hardware im-
plementations where floating-point operations are costly. In this report, we
implement a fixed-point division method using the Newton-Raphson iterative
technique.

2 Methodology
15
The objective is to compute the fixed-point division of 23 using an iterative
method. The Newton-Raphson method is applied to approximate the reciprocal
of the denominator and then multiplied by the numerator to obtain the result.

2.1 Fixed-Point Representation


A precision parameter, N = 8, is chosen, meaning the scaling factor is:

Scaling Factor = 2N = 256. (1)

The denominator and numerator are converted to fixed-point representation:

Dfixed = round(D × Scaling Factor) = 23 × 256 = 5888. (2)

The initial guess for the reciprocal of D is taken as:


1
x0 = , xfixed = round(x0 × Scaling Factor) = round(0.0588 × 256) = 15.
17
(3)

2.2 Newton-Raphson Iteration


The Newton-Raphson update formula for reciprocal approximation is:

xi+1 = xi × (2 − xi × D) . (4)

1
In fixed-point arithmetic, this translates to:

xi+1 = bitshift (xi × (2 × Scaling Factor − bitshift(xi × Dfixed , −N )) , −N ) .


(5)
The iteration is performed for 5 steps to refine the reciprocal approximation.

2.3 Final Computation


Once the reciprocal is computed, the division result is obtained as:

Resultfixed = num × xfixed . (6)

Converting it back to floating-point:


Resultfixed
Resultfloating = . (7)
Scaling Factor

3 Implementation
The implementation was verified using Verilog and MATLAB. The Verilog code
simulates the fixed-point division, while the MATLAB script verifies the results
using the same Newton-Raphson method.

3.1 Verilog Code


The Verilog implementation initializes the fixed-point values and applies Newton-
Raphson iterations. The final result is displayed in both fixed-point and floating-
point representations.
module f i x e d p o i n t d i v i d e r ;
parameter PRECISION = 8 ;
parameter SCALING FACTOR = 1 << PRECISION ;
parameter d i v i d e n d = 2 3 ;
parameter num = 1 5 ;

reg [ 1 6 : 0 ] scaled dividend ;


reg [ 1 6 : 0 ] reciprocal ;
reg [ 1 6 : 0 ] intermediate ;
integer itr ;

i n i t i a l begin
s c a l e d d i v i d e n d = d i v i d e n d ∗ SCALING FACTOR ;
r e c i p r o c a l = (SCALING FACTOR / 1 7 ) ;

f o r ( i t r = 0 ; i t r < 5 ; i t r = i t r + 1) begin
i n t e r m e d i a t e = r e c i p r o c a l ∗ ( 2 ∗ SCALING FACTOR − ( ( r e c i p r o c a l ∗ s c a
r e c i p r o c a l = i n t e r m e d i a t e >> PRECISION ;

2
end

i n t e r m e d i a t e = num ∗ r e c i p r o c a l ;

$ d i s p l a y ( ” Fixed−P oi nt R e s u l t : %d ” , i n t e r m e d i a t e ) ;
$ d i s p l a y ( ” F l o a t i n g −P oi nt R e s u l t : %f ” , i n t e r m e d i a t e ∗ 1 . 0 / SCALING FACTOR

$stop ;
end
endmodule

3.2 MATLAB Code


The MATLAB implementation follows the same approach, converting values
to fixed-point, iterating with the Newton-Raphson method, and computing the
final division.
N = 8;
s c a l e f a c = 2ˆN;
D = 2 3 ; % Denominator
num = 1 5 ; % Numerator

% Convert t o f i x e d −p o i n t
D f i x = round (D ∗ s c a l e f a c ) ; % denominator t o f i x e d p o i n t c o n v e r t
x0 = 1 / 1 7 ;
x f i x e d r e p = round ( x0 ∗ s c a l e f a c ) ; %c o n v e r t i n g i n i t i a l g u e s s 1/D t o f i x e d p o i n

% Newton−Raphson I t e r a t i o n
for i = 1:5
x f i x e d r e p = b i t s h i f t ( x f i x e d r e p ∗ (2 ∗ s c a l e f a c − b i t s h i f t ( x f i x e d r e p ∗ D
end

% computing 15/23
r e s u l t f i x e d = num ∗ x f i x e d r e p ;

% Converting to f l o a t i n g point
result floating = result fixed / scale fac ;

% Display
d i s p ( [ ’ Fixed−P oi nt R e s u l t : ’ , num2str ( r e s u l t f i x e d ) ] ) ;
d i s p ( [ ’ F l o a t i n g −P oi nt R e s u l t : ’ , num2str ( r e s u l t f l o a t i n g ) ] ) ;

3
4 Results and Discussion
The computed fixed-point result is displayed and verified in both Verilog and
MATLAB. The floating-point result obtained is:
15
≈ 0.6522. (8)
23
The fixed-point representation correctly approximates this value with high ac-
curacy.

5 Conclusion
This report presents a hardware-friendly fixed-point division method using Newton-
15
Raphson iteration. The implementation successfully computes 23 with an 8-
bit precision scaling factor, demonstrating the feasibility of efficient division in
fixed-point arithmetic.

You might also like