Sunteți pe pagina 1din 14

Implementation Of Logarithmic Multiplier

1 | P a g e


1. INTRODUCTION

Multiplication has always been a hardware, time and power-consuming arithmetic
operation, especially for large value operands. This bottleneck is even more emphasized in
digital signal processing (DSP) applications that involve a huge number of multiplications.

In many signal processing algorithms, which include correlation computations, the exact
value of the correlation does not matter; only the maximum of the correlation plays a role.
Additional small errors introduced with multipliers, as mentioned in the application
described and others, do not affect the results significantly and they can still be acceptable
in practice.

In applications where the speed of the calculation is more important than the accuracy,
truncated or logarithm multiplications seem to be suitable methods.












Implementation Of Logarithmic Multiplier
2 | P a g e


2. Binary Representation :



Fig 1.1 actual log value [1] Fig 1.2 approximate log value [1]

Implementation Of Logarithmic Multiplier
3 | P a g e


Fig 1.3 Logarithmic curve and straight line approximation [1]
A table of binary logarithms is shown in Fig. 1 and the familiar logarithmic curve is plotted in
Fig. 2. Suppose the familiar logarithmic curve is plotted in Fig. 2 by straight lines. The dashed
lines in Fig. 2 describe the resulting curve If Ig N is approximated by the dashed line curve
the data shown in Fig. 3 is obtained. Consider the second and fourth columns which are
written in binary form. The characteristic of the logarithm may be determined by
inspection; it is the bit position of the most significant "one" bit starting the count at zero.
The approximate mantissa is contained in the number itself. The bits to the right of the
most significant "one" automatically interpolate between zero and one on a straight line
curve.
Example
To find log of 13 log
2
13:
13 = 1101
Here the most significant one bit is at 2
3
position. Hence characteristic is three. Consider
the bits to the right of the most significant "one" as a binary fraction there results 0.101
which is equivalent to 0.625 in decimal notation. Approximate Iog
2
13 is then 3.625 decimal
or 11.101binary.

Implementation Of Logarithmic Multiplier
4 | P a g e

3. Multipliers
3.1 Mitchells algorithm based multipliers

Step-1 : Shift A and B left until their most significant one bits are in the left most
positions and count down counters X
1
X
2
X
3
and Y
1
Y
2
Y
3
during the
shifting. After the shifting is completed the counters will contain the
characteristics of the logarithms of A and B.

Step-2: Shift nits 0-6 of A and B into nit positions 0-6 of C and D as indicated in Fig.[1] C
and D now contain the logarithms of the original numbers.

Step-3: Add or Subtract CDE. This puts the logarithm of the result in E.

Step-4: Decode Z
1
Z
2
Z
3
Z
4
and insert a one in appropriate position of F. Insert the
right-hand portion of E immediately to the right of this one. F now contains the
result.

Implementation Of Logarithmic Multiplier
5 | P a g e

Fig. 3.1 Logarithmic representation [1]

A logarithmic number system is introduced to simplify multiplication, especially in cases
when the accuracy requirements are not rigorous. In LNS two operands are multiplied by
finding their logarithms, adding them, and after that looking for the antilogarithm of the
sum.

One of the most significant multiplication methods in LNS is Mitchells algorithm. An
approximation of the logarithm and the antilogarithm is essential, and it is derived from a
binary representation of the numbers.

The logarithm of the product is:
Log
2
(N
1
.N
2
) = K
1
+ K
2
+ log
2
(1+X
1
) + log
2
(1+X
2
)
The expression log (1 + x) is approximated with x and the logarithm of the two numbers
product is expressed as the sum of their characteristic numbers and mantissas:
Log
2
(N
1
.N
2
) K
1
+ K
2
+ X
1
+ X
2
The characteristic numbers K
1
and K
2
represent the places of the most significant operands
bits with the value of 1. For 16-bit numbers, the range for characteristic numbers is from 0
to 15. The fractions X
1
and X
2
are in range [0, 1).
The final MA approximation for the multiplication (where P
TRUE
= N
1
.N
2
) depends on the
carry bit from the sum of the mantissas and is given by:

P
MA
= (N
1
.N
2
)
MA
{
()

( )
()

( )



Implementation Of Logarithmic Multiplier
6 | P a g e


Fig 3.2 Block diagram of logarithm-based multiplication [2]

The final approximation for the product requires the comparison of the sum of the
mantissas with 1. The sum of the characteristic numbers determines the most significant
bit of the product. The sum of the mantissas is then scaled (shifted left) by 2
(k1+k2)
or by
2
(k1+k2+1)
, depending on the X
1
+

X
2
. If X
1
+ X
2
< 1, the sum of mantissas is added to the most
significant bit of product to complete the final result. Otherwise, the product is
approximated only with the scaled sum of mantissas. The proposed MA-based
multiplication is given in as,


Algorithm 1
1. N
1
, N
2
: n-bits binary multiplicands, P
MA
= 0:2 n-bits approximate product
2. Calculate K
1
: leading one position of N
1
3. Calculate K
2
: leading one position of N
2
4. Calculate X
1
shift N
1
to the left by K
1
bits
5. Calculate X
2
: shift N
2
to the left by K
2
bits
6. Calculate K
12
= K
1
+ K
2
Implementation Of Logarithmic Multiplier
7 | P a g e

7. Calculate X
12
= X
1
+ X
2
8. IF X
12
2
n
(i.e. X
1
+ X
2
1):
(a) Calculate K
12
= K
12
+ 1
(b) Decode K
12
and insert X
12
in that position of P
approx
ELSE:
(a) Decode K
12
and insert 1 in that position of P
approx
(b) Append X
12
immediately after this one in P
approx
9. Approximate N
1
.N
2
= P
MA


Example

N
1
= 234 =11101010;
N
2
=198 =11000110

K
1
=0111; X
1
= 11010100
K
2
= 0111; X
2
= 10001100

K
1
+ K
2
= 1110

X
1
+ X
2
= 101100000> 2
8

K
12
= 1110 + 1 = 1111

P
MA
=101100000000000 = 45056
P
true
= 46332

E
r
= 2.754%


3.2 Operand Decomposition

Consider two n-bit binary numbers X and Y to be multiplied

X = X
n-1
X
n-2
. . . X
i
. . .X
1
X
0
Y = Y
n-1
Y
n-2
. . . Y
i
. . .Y
1
Y
0


Before multiplied, the two operands X and Y are decomposed into the four operands A, B,
C and D

A = A
n-1
A
n-2
. . .A
i
. . . A
1
A
0
Implementation Of Logarithmic Multiplier
8 | P a g e

B = B
n-1
B
n-2
. . .B
i
. . . B
1
B
0
C = C
n-1
C
n-2
. . .C
i
. . . C
1
C
0
D = D
n-1
D
n-2
. . .D
i
. . . D
1
D
0

Where the individual bits are:

a
i
= x
i
y
i
b
i
= x
i
y
i
c
i
= x

y
i
d
i
= x
i
y
i


The product is then computed as:

X Y = (AB) + (CD)

The partial products (AB) and (CD) are produced using MA based multiplier. The proposed
operand decomposition decreases the number of ones and hence increases the accuracy of
the MA based multiplier. The proposed method decreases the error percentage of the MA
by 44.7%, on average.

Implementation Of Logarithmic Multiplier
9 | P a g e


Fig 3.3 Operand decomposed (OD)-Mitchells algorithm *2+



3.3 Iterative MA-based Algorithm (Pipelined approach)
The iterative MA-based algorithm and introduces an iterative algorithm with various
possibilities for achieving an error as small as required and the possibility of achieving an
exact result.


By simplifying the logarithm approximation introduced in MA, the correction terms could be
calculated almost immediately after the calculation of the product (N
1
N
2
)
MA
has been
started. In such a way, the high level of parallelism can be achieved by the principle of
pipelining, thus reducing the complexity of the logic required by MA and increasing the
speed of the multiplier with error correction circuits. Looking at the binary representation
of the numbers we can derive a correct expression for the multiplication:

Implementation Of Logarithmic Multiplier
10 | P a g e

P
true
= N
1
N
2
= 2
k1
(1+X
1
) 2
k2
(1+X
2
)
= 2
k1+k2
(1+X
1
+X
2
) + 2
k1+k2
(X
1.
X
2
) (1)

To avoid the approximation error, we have to take into account the next relation derived as:
X.2
k
= N 2
k
..(2)

The combination of (1) and (2) gives:

P
true
= (N
1
N
2
) = 2
(k1+k2)
+ (N
1
2
k1
)2
k2
+(N
2
2
k2
)2
k1
+ +(N
1
2
k1
) (N
2
2
k2
).(3)

Let
P
approx
(0)
= 2
(k1+k2)
+(N
1
2
k1
)2
k2
+(N
2
2
k2
)2
k1

The approximate product P
approx
as a correction term by which we decrease the error of the
approximation

P
approx
(1)
= P
approx
(0)
+ C
(1)
..(4)

If we repeat this multiplication procedure with i correction terms, we can approximate the
product as

P
approx
(i)
= P
approx
(0)
+C
(1)
+C
(2)
+. . .+C
(i)
= = P
approx
(0)
+
j C
(j)


Then the final result is exact:
P
aprox
= P
true
Iterative MA-based Algorithm with i correction terms.
1. N
1
, N
2
: n-bits binary multiplicands, P
approx
(0)
=0

: 2n-bits first

approximation, C
(i)
= 0: 2n-bits
i correction terms, P
approx
= 0:

2n-bits product

2. Calculate K
1
: leading one position of N
1
3. Calculate K
2
: leading one position of N
2
4. Calculate (N
1
2
k1
)2
k2
: shift (N
1
2
k1
) to the left by K
2
bits
5. Calculate (N
2
2
k2
)2
k1
: shift (N
2
2
k2
) to the left by K
1
bits
6. Calculate K
12
= K
1
+ K
2
7. Calculate 2
(k1 + k2)
: decode K
12
8. Calculate P
approx
(0)
: add 2
(k1+k2)
,(N
1
2
k1
)2
k2
and (N
2
2
k2
)2
k1

9. Repeat i-times or until N
1
= 0 or N
2
= 0:
(a) Set: N
1=
N
1
2
k1
, N
2
= N
2
2
k2

Implementation Of Logarithmic Multiplier
11 | P a g e

(b) Calculate K
1
: leading one position of N
1
(c) Calculate K
2
: leading one position of N
2
(d) Calculate (N
1
2
k1
)2
k2
: shift (N
1
2
k1
) to the left by K
2
bits
(e) Calculate (N
1
2
k2
)2
k1
: shift (N
2
2
k2
) to the left by K
1
bits
(f) Calculate K
12
= K
1
+ K
2
(g) Calculate 2
(k1 + k2)
: decode K
12
(h) Calculate C
(i)
: add 2
(k1 + k2)
, (N
1
2
k1
)2
k2
and (N
2
2
k2
)2
k1

10. P
appeox
(i) =
P
approx
(0)
+

C
(i)








Implementation Of Logarithmic Multiplier
12 | P a g e



















Implementation Of Logarithmic Multiplier
13 | P a g e

4. Simulation Results


Mitchelles Algorithm


Operand decomposed


Pipeline approach





Implementation Of Logarithmic Multiplier
14 | P a g e


5. Conclusion
First we have seen Mitchelles algorithm for multiplication of two numbers using
logarithmic representation, but it shows small amount if error. Next we implemented
Operand Decomposition method which is quiet simple and easy to implement but still
gives approximate value as a result than a perfect one. In last we implemented Iterative
MA-based algorithm which also known as pipeline algorithm which gives exact value as
a result of multiplication.


References
[1] J.N. Mitchell, Computer multiplication and division using binary logarithms, IRE
Transactions on Electronic Computers, vol. EC-11,
pp. 512-517
[2] V. Mahalingam, Student Member, IEEE, and Nagarajan Ranganathan, Improving
Accuracy in Mitchells Logarithmic Multiplication Using Operand Decomposition ,
V. Mahalingam, Student Member, IEEE, and Nagarajan Ranganathan

[3] Patricio Bulic, Zdenka Babic and Aleksej Avramovic A Simple Pipelined
Logarithmic Multiplier

S-ar putea să vă placă și