15
ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS I. Latency: Time between arrival of new input and generation of corresponding output. For combinational circuits this is just the propagation delay (t) of the Multiplier Latency (L) = propagation delay of the circuit (t) eq. (2.2) II. Throughput: The other important measure of performance is throughput defined as rate at which new outputs appear. For combinational circuits this is just inversion of latency. Through put (T) = 1/L =1/ propagation delay of the circuit eq. (2.3) Department of ECE, SITAMS Page 1

Vedic Multiplier 2

Embed Size (px)

Citation preview

Page 1: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

I. Latency: Time between arrival of new input and generation of corresponding

output. For combinational circuits this is just the propagation delay (t) of the

Multiplier

Latency (L) = propagation delay of the circuit (t) eq. (2.2)

II. Throughput: The other important measure of performance is throughput defined

as rate at which new outputs appear. For combinational circuits this is just inversion

of latency.

Through put (T) = 1/L =1/ propagation delay of the circuit eq. (2.3)

Department of ECE, SITAMS Page 1

Page 2: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

CHAPTER -3

VEDIC MATHEMATICS

This chapter presents a brief introduction to Vedic mathematics and lists all the sutras

involved in it and pays attention towards the multiplication methods in the Vedic

mathematics.

3.1 VEDIC MATHEMATICS

The word ‘Vedic’ is derived from the word ‘Veda’ which means the store-house of all

knowledge. Vedic mathematics is the name given to the ancient system of

mathematics, which was rediscovered, from the Vedas between 1911 and 1918 by Sri

Bharati Krishna Tirthaji. It mainly deals with Vedic mathematical formulae and their

application to various branches of mathematics. The algorithms based on

conventional mathematics can be simplified and even optimized by the use of Vedic

Sutras. These methods and ideas can be directly applied to trigonometry, plain and

spherical geometry, conics, calculus (both differential and integral), and applied

mathematics of various kinds [7].

The whole of Vedic mathematics is based on 16 Sutras (word formulae) and

manifests a unified structure of mathematics. As such, the methods are

complementary, direct and easy. The sixteen sutras [8]are presented below.

1 .(Anurupye) Shunyamanyat – If one is in ratio, the other is zero.

2. Chalana-Kalanabyham– Differences and Similarities.

3. EkadhikinaPurvena– By one more than the previous one.

4. EkanyunenaPurvena– By one less than the previous one.

5. Gunakasamuchyah – The factors of the sum is equal to the sum of the factors.

6. Gunitasamuchyah – The product of the sum is equal to the sum of the product.

7. Nikhilam Navatashcaramam Dashatah – All from 9 and the last from 10.

Department of ECE, SITAMS Page 2

Page 3: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

8. Paraavartya Yojayet – Transpose and adjust.

9. Puranapuranabyham – By the completion or no completion.

10. Sankalana-vyavakalanabhyam – By addition and by subtraction.

11. Shesanyankena Charamena – The remainders by the last digit.

12. Shunyam Saamyasamuccaye – When the sum is the same that sum is zero.

13. Sopaantyadvayamantyam – The ultimate and twice the penultimate.

14. Urdhva-Tiryakbhyam – Vertically and crosswise.

15. Vyashtisamanstih – Part and Whole.

16. Yaavadunam – Whatever the extent of its deficiency.

The study of these formulae is a field of diverse study. The proposed design

uses only Urdhva-Tiryakbhyam and Nikhilam methods only hence; the detailed

description of other formulae is beyond the scope of this paper.

3.1.1 Urdhva Tiryakbhyam Sutra

This sutra is a general formula applicable to all cases of multiplication. It literally

means “Vertically and Cross-wise”. This scheme is illustrated by consider the

multiplication of two numbers [7].

I. Multiplication of two decimal numbers- 43*68

To illustrate this multiplication scheme, let us consider the multiplication of two

decimal numbers (43*68). The digits on the both sides of the line are multiplied and

added with the carry from the previous step. This generates one digit of result and a

carry digit. This carry is added in the next step and hence the process goes on. If more

than one line are there in one step, all the results are added to the previous carry. In

each step, unit’s place digit acts as the result bit while the higher digits act as carry for

the next step. Initially the carry is taken to be zero. The working of this algorithm has

been illustrated in Fig 3.1.

Department of ECE, SITAMS Page 3

Page 4: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

Figure 3.1 Multiplication of 2 digit decimal numbers using Urdhva

Tiryakbhyam Sutra

II. Multiplication of two decimal numbers- 5498*2314

The multiplication method of Urdhva Tiryakbhyam Sutra can be illustrated using the

lattice diagram for easy understanding of the multiplication process. The numbers to

be multiplied are written on two consecutive sides of the square as shown in Fig.3.2

The Square is divided into rows and columns where each row/column corresponds to

one of the digit of either a Multiplier or a Multiplicand. Thus, each digit of the

Multiplier has a small box common to a digit of the multiplicand. These small boxes

are partitioned into two halves by the crosswise lines. Each digit of the Multiplier is

then independently multiplied with every digit of the multiplicand and the two-digit

product is written in the common box. All the digits lying on a crosswise dotted line

are added to the previous carry. The least significant digit of the obtained number

acts as the result digit and the rest as the carry for the next step. Carry for the first

step (i.e., the dotted line on the extreme right side) is taken to be zero.

Department of ECE, SITAMS Page 4

Page 5: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

Figure 3.2 Alternative way of multiplication by Urdhva Tiryakbhyam Sutra

Algebraic principle involved behind the Urdhva Tiryakbhyam Sutra can be

understood by considering multiplication between (ax+b) and (cx+d) .The product is

acx2+x(ad+bc)+bd .In another words ,the first term ,i.e. the coefficient of x2 is got by

vertical multiplication of a and c ; the middle term ,i.e. the coefficient of x is obtained

by cross-wise multiplication of a and d and of b and c and the addition of two

products ;and the independent term is arrived by vertical multiplication of the

absolute terms . As all arithmetic numbers are merely algebraic expressions in x (with

x=10), the algebraic principle explained above is readily applicable to arithmetic

numbers too.

3.1.2 Nikhilam Sutra

Nikhilam Sutra [7] literally means “all from 9 and last from10”. Although it is

applicable to all cases of multiplication, it is more efficient when the numbers

involved are large (i.e., numbers nearer to the base). It finds out the compliment of the

large number from its nearest base to perform the multiplication operation on it, hence

larger the original number, lesser the complexity of the multiplication. Firstly this

Sutra is illustrate by considering the multiplication of two decimal numbers (96 × 93)

where the chosen base is 100 which is nearest to and greater than both these two

numbers.

Department of ECE, SITAMS Page 5

Page 6: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

Figure 3.3 Alternative way of multiplication by Nikhilam Sutra

As shown in Fig. 3.3, we write the Multiplier and the multiplicand in two rows

followed by the differences of each of them from the chosen base, i.e., their

compliments. We can now write two columns of numbers, one consisting of the

numbers to be multiplied (Column 1) and the other consisting of their compliments

(Column 2). The product also consists of two parts which are demarcated by a vertical

line for the purpose of illustration. The right hand side (RHS) of the product can be

obtained by simply multiplying the numbers of the Column 2 (7×4 = 28). The left

hand side (LHS) of the product can be found by cross subtracting the second number

of Column 2 from the first number of Column 1 or vice versa i.e., 96 - 7 = 89 or 93 -

4 = 89. The final result is obtained by concatenating RHS and LHS (Answer = 8928).

Algebraic principle involved in Nikhilam Sutra can be understood by Considering two

numbers n1 and n2 such that n1=(X-a), X= (n1-a); n2=(X-b), X= (n2-b); where X=base

and a, b differences from the base. Then

n1 x n2= (X-a)(X-b)= X( (X-a )+(X-b) – X) +a x b eq. (3.1)

Thus a Nikhilam Sutra effectively breaks the large number multiplication n1 x

n2 into small number multiplication (a x b) and addition [(X-a )+(X-b) – X] .

Department of ECE, SITAMS Page 6

Page 7: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

CHAPTER -4

ANALYSIS OF VEDIC MULTIPLIERS

This chapter deals with analysis of Vedic Multipliers which are designed based on

Urdhva Tiryakbhyam sutra and Nikhilam Sutra .The analysis of Vedic Multipliers is

presented by designing a 16x16 bit Vedic Multipliers based on these two sutras.

4.1 ALGORITHM BASED ON URDHVA TIRYAKBHYAM SUTRA

In order to analyze a Vedic binary Multiplier firstly it is important to know how

Urdhva Tiryakbhyam Sutra can be applied to the binary information .An algorithm is

presented here to illustrate the multiplication of binary numbers using Urdhva

Tiryakbhyam Sutra by considering 4x4 bit multiplication[8].

Algorithm for 4 x 4 bit multiplication Using Urdhva Tiryakbhyam (Vertically

and crosswise) for two Binary numbers is illustrated in Fig. 4.1(a) considering the

multiplication of two binary numbers such that A=A3A2A1A0 and B=B3B2B1B0.

As the result of this multiplication would be more than 4 bits, it is expressed as

R=R7R6R5R4R3R2R1R0 and carriers produced during multiplication process be c1,

c2, c3, c4, c5 and c6 (the carriers can be multi bit).

A3 A2 A1 A0 Multiplicand

x B3 B2 B1 B0 Multiplier

--------------------------------------------------------------------

R7 R6 R5 R4 R3 R2 R1 R0 Product

---------------------------------------------------------------------

(a) 4 x4 bit Multiplication of A and B

Department of ECE, SITAMS Page 7

Page 8: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

STEP1 STEP2 STEP3 STEP4

A3 A2 A1 A0 A3 A2 A1 A0 A3 A2 A1 A0 A3 A2 A1 A0

B3 B2 B1 B0 B3 B2 B1 B0 B3 B2 B1 B0 B3 B2 B1 B0

STEP5 STEP6 STEP7

A3 A2 A1 A0 A3 A2 A1 A0 A3 A2 A1 A0

B3 B2 B1 B0 B3 B2 B1 B0 B3 B2 B1 B0

(b) Line diagram for 4x4 binary multiplication using Urdhva Tiryakbhyam

Fig 4.1 Multiplication of binary numbers using Urdhva Tiryakbhyam Sutra

The line diagram which is shown in below Fig.4.1 (b) illustrates the multiplication

process that happens in the Urdhva Tiryakbhyam Sutra.

Now expressions are derived from the above line diagram for every step of

multiplication.

R0 = A0B0 eq.4.1

c1R1 = A1B0 + A0B1 eq.4.2

c2R2 = c1 + A2B0 + A1B1 + A0B2 eq.4.3

c3R3 = c2 + A3B0 + A2B1 + A1B2 + A0B3 eq.4.4

c4R4 = c3 + A3B1 + A2B2 + A1B3 eq.4.5

c5R5 = c4 + A3B2 + A2B3 eq.4.6

c6R6 = c5 + A3B3 eq.4.7

c6=R7

Department of ECE, SITAMS Page 8

Page 9: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

with c6R6R5R4R3R2R1R0 being the final product.

These expressions are derived from the above diagram. Same can be derived

for any N x N-bit number multiplication. In the entire above sum expressions only the

least significant bit is the result of that expression remaining bits are considered to be

carry which will be added to the next stage.

From above expressions one thing is observed, as the number of bits goes on

increasing, the required stages of carry and propagate also increase and get arranged

as in ripple carry adder. To overcome this problem a more efficient use of Urdhva

Tiryakbhyam is shown in Fig.4.2.

Figure 4.2 Better implementation of Urdhva Tiryakbhyam for binary numbers

In above Fig.4.2, a 4x4-bit multiplication is simplified into four, 2x2-bit

multiplications that can be performed in parallel. This reduces the number of stages of

logic and thus reduces the delay of the Multiplier. This example illustrates a better

and parallel implementation style of Urdhva Tiryakbhyam Sutra. The beauty of this

approach is that larger bit steams (of say N bits) can be divided into (N/2 = n) bit

length, which can be further divided into n/2-bit streams and this can be continued till

we reach bit streams of width2, and they can be multiplied in parallel, thus providing

an increase in speed of operation [9].

Department of ECE, SITAMS Page 9

Page 10: Vedic Multiplier 2

ANALYSIS, COMPARISON AND APPLICATION OF VEDIC MULTIPLIERS

4.2 Modified algorithm Using Urdhva Tiryakbhyam (Vertically and

crosswise) for two Binary numbers [9]

To illustrate the algorithm a 4 x4 binary multiplication is considered as shown in

Fig.4.3 in which binary information is grouped into two equal groups of two bits each

and multiplication for these groups of bits are performed separately. In this case two

bits are considered to be the result of the cross product and remaining bit is

considered as a carry.

Let A=A3A2A1A0, B=B3B2B1B0 and result R=R7R6R5R4R3R2R1R0

After dividing into two equal groups A becomes X1=A3A2 and X0=A1A0.

After dividing into two equal groups B becomes Y1=B3B2 and Y0=B1B0.

A3 A2 A1A0 Multiplicand

X1 X0

B3 B2 B1B0 Multiplier

Y1 Y0

X1 X0

x Y1 Y0

F E D C

CP = X0 * Y0 = C

CP = X1 * Y0 + X0 * Y1 = D

CP = X1 * Y1 = E

Figure 4.3 4 x 4 binary Multiplication using Modified Algorithm based on

Urdhva Tiryakbhyam sutra

Department of ECE, SITAMS Page 10