A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

download A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

of 6

Transcript of A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

  • 7/25/2019 A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

    1/6

    A Novel Binary Division Algorithm based on Vedic

    Mathematics and Applications to Polynomial Division

    Ashish Joglekar1, Shaunak Vaidya

    1, Ajinkya Kale

    2,

    1T.Y.B.Tech, Department of E&TC,

    2Final Year, B.Tech, Department of Computer & IT,College of Engineering, Pune 05, Maharashtra, INDIA.

    Abstract - The Parvartya Stra from ancient Indian

    Vedic Mathematics is extended to Radix 2 Binary

    number system. An enhanced algorithm for binary number

    division is presented and a corresponding hardware

    module is proposed. Two algorithms are proposed to

    perform polynomial division in binary system and may findapplications in various digital systems.

    Keywords: Vedic Mathematics, Algorithm, Binary

    Division, Synthetic Division, Polynomial Division.

    1. Introduction

    1.1. Need for Division Algorithm

    Designers of processors with enhanced Arithmetic

    and Logic Unit (ALU) are always on a look out for

    algorithms for performing basic operations one of them

    being Division. The algorithm should be such that itinvolves processes requiring compact hardware while

    satisfying efficiency constraints.

    1.2. Role of Vedic Mathematics

    Ancient Indian Vedic Mathematics deals mainly

    with sixteen Sutras and their applications for carrying out

    tedious and cumbersome arithmetical operations, and to avery large extent, executing them mentally [2]. Parvartya

    Stra is one of these sixteen Sutras used for division, in

    Vedic Mathematics.Synthetic division [3], which is a shortcut method

    for dividing a polynomial by a linear divisor of the form can be considered as a special case of theParvartya Stra [2].

    1.3.

    Vedic Mathematics Based Division

    Algorithm

    This paper presents an algorithm to perform binary

    number division based on the Parvartya Stra. Anenhancement in this algorithm has led to process

    optimization with respect to number of intermediateoperations involved.

    Two algorithms for polynomial division viz. Split

    Coefficient Method and Scaled Coefficient Method have

    been proposed in binary format as required by any digital

    system, which may find application in scientific

    calculators.

    2. The Parvartya Stra

    The Polynomial Remainder Theorem states that ifpolynomial ( ) is dividedby ( then the remainder is

    The Parvartya Stra however, provides us with both

    Quotient and Remainder as illustrated in examples below.

    2.1. Polynomial division

    Figure 1: Example illustrating Parvartya Stra for

    polynomial division

    Unlike Synthetic division, the divisor inFigure 1

    is non linear. This helps illustrate the scope of the

    Parvartya Stra.

    2.2. Application of the Stra to Decimal

    Number Division

    Following the representation similar to the case of

    polynomial division, Figure 2 illustrates the Parvartya

    Stras application to Arithmetical Operations.

    Divisor Dividend

    2 1 2 7 2 18 3 8

    2 0 1

    4

    0

    2

    22 0 1140 0 202 11 20 20 8 12 2 1 1 2 0 2 0 8 1 2

  • 7/25/2019 A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

    2/6

    Figure 2: Application to Decimal System

    3. Extension to Binary Number

    System

    The Parvartya Stra as described in [2] is applied todecimal, i.e., Radix 10 system only. We have extended the

    Sutra to perform Binary Number Division as illustrated in

    Figure 3:

    Figure 3: Extension to Binary Number System

    4. Hardware Implementation

    The binary form of Parvartya Stra is implemented

    using Dedicated Register Bank Structure. Figure 4 shows

    one such register bank.At each stage subtract contents of bit wise

    vertically and add contents of bit wise vertically. Thisexplains hardware representation of -1.

    Bits always interpreted as negative

    1 1 1 1 0 1 1 0 1

    1 0 1 0 0 00 0 0

    0 0 0

    1 0 1

    0 0 0

    0 0 0

    1 0 1

    1 0 1

    0 0 0

    0 0 0

    1 0 1

    Note: 0, 1 and -1 are coded vertically in and as:

    0: 1: 1:

    0 0 1 0 1 0

    Truth table:

    Figure 4: Register Bank Structure

    Divisor Dividend

    1 1 3 1 3 9 0 5 1 3 1 3

    2 6

    4

    12

    1 2 4 10 71 2 3 06

    1 2 4 1 1 2 3 11310706

    Divisor Dividend1 1 0 1 1 1 1 1 0 1 1 0 11 0 1 1 0 10 0 01 0 11 0 11 0 1 1

    0 1 1 0 1 1 1 1 11 1 10 101010101100101 1 1 0 0 1 0 1 01100

    1 1 0 1

    1 0 1

    Result bits

    1 0 1 1 1 1 1 1 0

    Carry 1

    1Sign bits 0 0 0 1 0 1 0 1

    Interpretation0 x x 01 0 0 0

    1 1 0 -1

    1 1 1 1

  • 7/25/2019 A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

    3/6

    The hardware can be reduced further by retaining only

    two of the shown registers at the Result position, onebeing the current register and the other being the Result

    Register which is continuously refreshed at every stage

    of computation. The Result Register will show finalresult when computations for all bits have been done.

    5. Process Enhancement

    The number of operations performed, in binary version

    of the Parvartya Stra are reduced significantly by

    modifying its process algorithm. The new enhancedalgorithm, which remarkably simplifies the process, is

    represented in Figure 5.

    Figure 5: Process enhancement flowchart

    Figure 6: Process enhancement Example

    1. Here, 111101101 , 1101.2. Compare first 4 bits 1111 with. Since

    , replace by, Get intermediate.3. Intermediate 1001101 isthe new.4. Compare first 4 bits 1001with.

    Since , perform Parvartya Division asshown.

    6. Polynomial Division

    Polynomial Division, by itself is a cumbersomeprocess and not a frequently seen feature, even on

    scientific calculators. Our enhanced algorithm is modifiedto suit generalized polynomial division in a binary format,

    provided both polynomials have integer coefficients. This

    enables applications in various digital systems, thereby

    equipping them with another useful tool.

    6.1. Scaled Coefficient Method

    Performsgeneralizedpolynomialdivision

    Dividend Divisor 6.1.1.

    Need for Scaling of Coefficients

    Scaling of coefficients by powers of enables us toeliminate fractional values in calculation stages.

    The coefficients of the final result are conveniently

    expressed in the form of fraction where numerator and

    denominator are stored in separate locations.

    Divisor Dividend Quotients1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 1 0 0 0 0 0 1000001 1 0 1 1 0 0 1 1 0 1 1 0 1 1 0 11 0 11

    0

    1

    1 0 1 1 1 1 1 11 1 10 101 1010101101 110010 101100

    100101

    Yes

    No

    Yes

    No Intermediate 0 ,

    END

    Compare first (starting fromMSB)

    ?

    Proceed by our

    Binary Parvartya

    Stra,

    Replace by ,Get intermediate ,Intermediate R is the new.

    Merge all

    intermediate Qs

    START

    Accept

    dividend

    ?

    Yes

  • 7/25/2019 A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

    4/6

    Illustration :

    Let m = 3 and n = 3

    2 3 3 23

    1 32 3 1 332

    0 33 3 0 3233 Now, 3 3 33 22 1 0 23 323 2 13231332 033303233

    33 22 1 0Thus

    Figure 8: Scaled Coefficient Method Illustration

    This can be extended further for the general case when thedividend is and divisor is

    :

    :

    Start

    Accept Dividend andDivisor where,

    Get

    and

    where

    0 and 110

    Get Coefficients of Q by further dividing each of the first 1 coefficients by The remaining coefficients of result directly represent R

    Apply Parvartya Stra with

    Get

    and

    END

    Figure 7: Scaled Coefficient Method Flowchart

    END

  • 7/25/2019 A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

    5/6

    32 , 52 1Figure 9: Scaled Coefficient Method Example

    3 4 12 1

    32 34 , 54 12Figure 10: Scaled Coefficient Method Example

    4 13 23 1

    43 359 , 479 5127

    6.2. Split Coefficient Method

    This method works for the special case when thedivisor has coefficients 0 or 1 and generalized dividend

    with integer coefficients. The coefficients of the dividend

    are split to form binary segments. This is a relativelysimple approach considering the operations involved,

    compared to Scaled Coefficient Method.

    Figure 11: Scaled Coefficient Method ExampleFigure 12: Split Coefficient Method Flowchart

    -00 -01*10 011 000*10 100*10*10 001*10*10*10

    00 -11*10

    00 00

    11 00 1010 1000Divide by:

    (representative)

    10 10*10 10*10*10

    Final

    Division by:

    (for Q only)10

    -01 -01*10 011 000*10 100*10*10 001*10*10*10

    -11 -11*10

    11 11*10

    11 -11 101 100

    10 10*10 10*10*10

    10

    -01 -01*11 100 1101*11 0000*11*11 0010*11*11*11

    -100 -100*11

    -100011 -100011*11

    100 100011 -101111 -11001111 11*11 11*11*11

    11

    No

    Get Partial 2in binarywith sign of current dividend

    segment MSB.

    Subtract from current dividendsegment to get partial, where is

    the binary number obtained by

    replacing first bits of currentdividend segment by divisor.

    END

    Add 1s in partial R to next largestdividend segments available where

    corresponding bit is 0. If corresponding

    bit in all dividend segments is 1,createnew segment

    Yes

    Split the Coefficients of

    dividend to form binary

    dividend segments

    Start from largest dividend

    segment remaining

    Is no. of bits in Divisor

    > no. of bits inDividend Segment ?

    START

    AcceptgeneralizedDividend andDivisor where 0 1

  • 7/25/2019 A Novel Binary Division Algorithm Based on Vedic Mathematics and Applications to Polynomial Division

    6/6

    Divisor DividendSegment

    Partial

    Quotients

    Partial

    Remainder

    101 111011 1000 10011111000

    100000

    101 111011 1000 10011110000

    101 110011 1000 1-1011

    10000

    101 10000 100 -100

    1-1011

    101 1-1-111 100 -1-111-100

    101 -1-111 -10 -111

    -100 1

    101 -111 -1 11

    -110 1

    101 -111 -1 11

    11 11

    1

    3 2 2 2 3

    Figure 12: Split Coefficient Method Example

    1. The dividend is initially split into three binary

    segments.

    2. The partial quotient is obtained from the first

    dividend segment at each stage.3. The partial remainder is merged with the other

    segments and the new segments thus formed

    are shown in the next stage.

    4. Representation of -1 can be done at hardware

    level by assigning a sign bit.

    7. Conclusion

    The Parvartya Stra is successfully extended to

    perform binary division. The Scaled CoefficientMethod and Split Coefficient Method enable us to

    perform polynomial division in binary format. Thisenables applications in various digital systems, like

    scientific calculators, thereby equipping them with

    another useful tool.

    Acknowledgements

    The Authors are grateful to Prof. V.V. Joshi, Dept.

    Of Mathematics, COEP and Prof. A.A. Sawant, Head,

    Dept. of Computer Engineering & IT, COEP and Prof.(Mrs.) M.A. Joshi, Dept. of E&TC, COEP for their

    valuable suggestions.

    References

    [1] Himanshu Thapliyal and Hamid R. Arabania ,

    "High Speed Efficient N Bit by N Bit Division

    Algorithm And Architecture Based On Ancient

    Indian Vedic Mathematics", Proceedings of

    VLSI04, Las Vegas, U.S.A, June 2004, pp. 413-

    419(CSREA Press).

    [2] Jagadguru Swami Sri Bharati Krsna TirthatjiMaharaja, Vedic Mathematics, Motilal

    Banarsidass Publication,

    1992.

    [3] Wolfram MathWorld

    http://mathworld.wolfram.com/SyntheticDivision.html

    [4] Shaunak Vaidya, Ashish Joglekar, and Vinayak

    Joshi, An Efficient Binary MultiplicationAlgorithm based on Vedic Mathematics,

    Proceedings National Conference on Trends in

    Computing Technologies 2008, Pg 37-43.[5]

    Himanshu Thapliyal and M.B Srinivas,"VLSI

    Implementation of RSA Encryption Systemusing Ancient Indian Vedic Mathematics ",

    Proceedings of SPIE -- Volume 5837 VLSI

    Circuits and Systems II, Jose F. Lopez, FranciscoV. Fernandez, Jose Maria Lopez-Villegas, Jose

    M. de la Rosa, Editors, June 2005, pp. 888-892[6]

    Chidgupkar Purushottam D., Karad Mangesh T.,

    The Implementation of Vedic Algorithms inDigital Signal Processing, Global J. of Engng.

    Educ., Vol.8, No.2 (2004), 153 157.