World Acdemy of Science, Engineering nd Technology 9 8 A Reduced-Bit Multipliction Algorithm for Digitl Arithmetic Hrpreet Singh Dhillon nd Ahijit Mitr Astrct A reduced-it multipliction lgorithm sed on the ncient Vedic multipliction formule is proposed in this pper. Both the Vedic multipliction formule, Urdhv tirykhym nd Nikhilm, re first discussed in detil. Urdhv tirykhym, eing generl multipliction formul, is eqully pplicle to ll cses of multipliction. It is pplied to the digitl rithmetic nd is shown to yield multiplier rchitecture which is very similr to the populr rry multiplier. Due to its structure, it leds to high crry propgtion dely in cse of multipliction of lrge numers. Nikhilm Sutr, on the other hnd, is more efficient in the multipliction of lrge numers s it reduces the multipliction of two lrge numers to tht of two smller numers. The frmework of the proposed lgorithm is tken from this Sutr nd is further optimized y use of some generl rithmetic opertions such s expnsion nd it-shifting to tke dvntge of it-reduction in multipliction. We illustrte the proposed lgorithm y reducing generl 4 4-it multipliction to single -it multipliction opertion. Keywords Multipliction, lgorithm, Vedic mthemtics, digitl rithmetic, reduced-it. I. INTRODUCTION DIGITAL multipliers [], [] re the core components of ll the digitl signl processors (DSPs) nd the speed of the DSP is lrgely determined y the speed of its multipliers []. They re indispensle in the implementtion of computtion systems relizing mny importnt functions such s fst Fourier trnsforms (FFTs) nd multiply ccumulte (MAC). Two most common multipliction lgorithms followed in the digitl hrdwre re rry multipliction lgorithm nd Booth multipliction lgorithm [4]. The computtion time tken y the rry multiplier is comprtively less ecuse the prtil products re clculted independently in prllel. The dely ssocited with the rry multiplier is the time tken y the signls to propgte through the gtes tht form the multipliction rry. Booth multipliction is nother importnt multipliction lgorithm [5]. Lrge ooth rrys re required for high speed multipliction nd exponentil opertions which in turn require lrge prtil sum nd prtil crry registers. Multipliction of two n-it opernds using rdix-4 ooth recording multiplier requires pproximtely n/(m) clock cycles to generte the lest significnt hlf of the finl product, where m is the numer of Booth recoder dder stges. Thus, lrge propgtion dely is ssocited with this cse. Due to the importnce of digitl multipliers in DSP, it hs lwys een n ctive re of reserch nd Mnuscript received Mr, 8. The uthors re with the Deprtment of Electronics nd Communiction Engineering, Indin Institute of Technology (IIT) Guwhti, Indi. E-Mil: {hrpreet;.mitr}@iitg.ernet.in. numer of interesting multipliction lgorithms hve een reported in the literture [6] [9]. This pper presents one such new multipliction lgorithm which circumvents the need of lrge multipliers y reducing the multipliction of lrge numers to tht of smller numers. This reduces the propgtion dely ssocited with the conventionl lrge multipliers considerly. The frmework of the proposed lgorithm is primrily sed on the Nikhilm Sutr (formul) of Vedic mthemtics [] nd is further optimized to tke full dvntge of reduction in the numer of its in multipliction. Although Nikhilm Sutr is pplicle to ll cses of multipliction, it is more efficient when the numers involved re lrge. In ddition to this Sutr, Vedic mthemtics dels with nother multipliction formul, Urdhv tirykhym, which is eqully pplicle to ll cses of multipliction. Attempts hve een mde in the literture to pply this generl multipliction formul to inry rithmetic. In [], this Sutr is shown to e more efficient multipliction lgorithm s compred to the conventionl counterprts. Another pper [] hs lso shown the effectiveness of this Sutr to reduce the N N multiplier structure into n efficient 4 4 multiplier structures. In this pper, Urdhv tirykhym Sutr is first pplied to the inry numer system nd is used to develop digitl multiplier rchitecture. This is shown to e very similr to the populr rry multiplier rchitecture. Nikhilm Sutr is then discussed nd is shown to e much more efficient in the multipliction of lrge numers s it reduces the multipliction of two lrge numers to tht of two smller ones. The proposed multipliction lgorithm is then illustrted to show its computtionl efficiency y tking n exmple of reducing 4 4-it multipliction to single -it multipliction opertion. The sic frmework of the proposed lgorithm is tken from the Nikhilm Sutr of Vedic mthemtics nd is further optimized to tke full dvntge of the it-reduction in multipliction. This pper is orgnized s follows. In Section, rief overview of Vedic mthemtics is provided. Section dels with the Vedic multipliction Sutrs followed y the proposed lgorithm. Concluding remrks re presented in Section 4. II. VEDIC MATHEMATICS Vedic mthemtics is the nme given to the ncient Indin system of mthemtics tht ws rediscovered in the erly twentieth century from ncient Indin sculptures (Veds) y Sri B. K. Tirth (884-96) []. It minly dels with Vedic mthemticl formule nd their ppliction to vrious 756
World Acdemy of Science, Engineering nd Technology 9 8 STEP STEP STEP 5 Result = 4 Prev. Crry = 5 Result = Prev. Crry = 4 5 Result = 6 5 Prev. Crry = 4 5 6 8 5 8 5 Crry = 4 Crry = Crry = 6 STEP 4 STEP 5 5 Result = Prev. Crry = 6 5 Result = Prev. Crry = 9 9 8 5 9 8 5 Crry = 5 X 78 = 985 Fig.. Multipliction of two deciml numers y Urdhv tirykhym Sutr. Fig.. 5 4 9 8 8 8 6 5 7 4 5 4 9 8 6 6 7 7 5498 X 4 = 77 4 Previous Crry Alterntive wy of multipliction y Urdhv tirykhym Sutr. rnches of mthemtics. The lgorithms sed on conventionl mthemtics cn e simplified nd even optimized y the use of Vedic Sutrs. The word Vedic is derived from the word ved which mens the store-house of ll knowledge. Vedic mthemtics is minly sed on 6 Sutrs (or phorisms) deling with vrious rnches of mthemtics like rithmetic, lger, geometry etc. []. These Sutrs long with their rief menings re enlisted elow lpheticlly. ) (Anurupye) Shunymnyt If one is in rtio, the other is zero. ) Chln-Klnyhm Differences nd Similrities. ) Ekdhikin Purven By one more thn the previous one. 4) Eknyunen Purven By one less thn the previous one. 5) Gunksmuchyh The fctors of the sum is equl to the sum of the fctors. 6) Gunitsmuchyh The product of the sum is equl to the sum of the product. 7) Nikhilm Nvtshcrmm Dshth All from 9 nd the lst from. 8) Prvrty Yojyet Trnspose nd djust. 9) Purnpurnyhm By the completion or noncompletion. ) Snkln-vyvklnhym By ddition nd y sutrction. ) Shesnynken Chrmen The reminders y the lst digit. ) Shunym Smysmuccye When the sum is the sme tht sum is zero. ) Sopntydvymntym The ultimte nd twice the penultimte. 4) Urdhv-tirykyhm Verticlly nd crosswise. 5) Vyshtismnstih Prt nd Whole. 6) Yvdunm Whtever the extent of its deficiency. These methods nd ides cn e directly pplied to trigonometry, plin nd sphericl geometry, conics, clculus (oth differentil nd integrl), nd pplied mthemtics of vrious kinds. As mentioned erlier, ll these Sutrs were reconstructed from ncient Vedic texts erly in the lst century []. Mny Su-sutrs were lso discovered t the sme time which re not discussed here. The euty of Vedic mthemtics lies in the fct tht it reduces the otherwise cumersome-looking clcultions in conventionl mthemtics to very simple ones. This is so ecuse the Vedic formule re climed to e sed on the nturl principles on which the humn mind works. This is very interesting field nd presents some effective lgorithms which cn e pplied to vrious rnches of engineering such s computing nd digitl signl processing [] [5]. 757
World Acdemy of Science, Engineering nd Technology 9 8 Fig.. STEP STEP STEP STEP 4 STEP 5 STEP 6 STEP 7 Line digrm for multipliction of two 4-it numers. III. THE PROPOSED VEDIC MULTIPLIER The proposed Vedic multiplier is sed on the Vedic multipliction formule (Sutr). These Sutr hve een trditionlly used for the multipliction of two numers in the deciml numer system. In this pper, we pply the sme ides to the inry numer system to mke the proposed lgorithm comptile with the digitl hrdwre. Let us first discuss oth these Sutrs in detil. A. Urdhv Tirykhym Sutr Urdhv tirykhym Sutr is generl multipliction formul pplicle to ll cses of multipliction. It literlly mens Verticlly nd Crosswise. To illustrte this multipliction scheme, let us consider the multipliction of two deciml numers (5 78). Line digrm for the multipliction is shown in Fig.. The digits on the two ends of the line re multiplied nd the result is dded with the previous crry. When there re more lines in one step, ll the results re dded to the previous crry. The lest significnt digit of the numer thus otined cts s one of the result digits nd the rest ct s the crry for the next step. Initilly the crry is tken to e zero. An lterntive method of multipliction using Urdhv tirykhym Sutr is shown in Fig.. The numers to e multiplied re written on two consecutive sides of the squre s shown in the figure. The squre is divided into rows nd columns where ech row/column corresponds to one of the digit of either multiplier or multiplicnd. Thus, ech digit of the multiplier hs smll ox common to digit of the multiplicnd. These smll oxes re prtitioned into two hlves y the crosswise lines. Ech digit of the multiplier is then independently multiplied with every digit of the multiplicnd nd the two-digit product is written in the common ox. All the digits lying on crosswise dotted line re dded to the previous crry. The lest significnt digit of the otined numer cts s the result digit nd the rest s the crry for the next step. Crry for the first step (i.e., the dotted line on the extreme right side) is tken to e zero. Now we extend this Sutr to inry numer system. To illustrte the multipliction lgorithm, let us consider the multipliction of two inry numers nd. As the result of this multipliction would e more thn 4 its, we express it s...r r r r. Line digrm for multipliction of two 4-it numers is shown in Fig. which is nothing ut the mpping of the Fig. in inry system. For the ske of simplicity, ech it is represented y circle. Lest significnt it r is otined y multiplying the lest significnt its of the multiplicnd nd the multiplier. The process is followed ccording to the steps shown in Fig.. As in the lst cse, the digits on the oth sides of the line re multiplied nd dded with the crry from the previous step. This genertes one of the its of the result (r n ) nd crry (sy c n ). This crry is dded in the next step nd hence the process goes on. If more thn one lines re there in one step, ll the results re dded to the previous crry. In ech step, lest significnt it cts s the result it nd ll the other its ct s crry. For exmple, if in some intermedite step, we get, then will ct s result it nd s the crry (referred to s c n in this text). It should e clerly noted tht c n my e multi-it numer. Thus we get the following expressions: r =, () c r = +, () c r = c + + +, () c r = c + + + +, (4) c 4 r 4 = c + + +, (5) c 5 r 5 = c 4 + +, (6) c 6 r 6 = c 5 + (7) with c 6 r 6 r 5 r 4 r r r r eing the finl product. Hence this is the generl mthemticl formul pplicle to ll cses of multipliction. The hrdwre reliztion of 4-it multiplier using this Sutr is shown in Fig. 4. This hrdwre design is very similr to tht of the fmous rry multiplier where n rry of dders is requited to rrive t the finl product. All the prtil products re clculted in prllel nd the dely ssocited is minly the time tken y the crry to propgte through the dders which form the multipliction rry. Clerly, this is not n efficient lgorithm for the multipliction of lrge numers s lot of propgtion dely is involved in such cses. To del with this prolem, we now discuss Nikhilm Sutr which presents n efficient method of multiplying two lrge numers. B. Nikhilm Sutr Nikhilm Sutr literlly mens ll from 9 nd lst from. Although it is pplicle to ll cses of multipliction, it is more efficient when the numers involved re lrge. Since it finds out the compliment of the lrge numer from its nerest se to perform the multipliction opertion on it, lrger the originl numer, lesser the complexity of the multipliction. We first illustrte this Sutr y considering the multipliction of two deciml numers (96 9) where the chosen se 758
World Acdemy of Science, Engineering nd Technology 9 8 ADDER ADDER ADDER ADDER ADDER ADDER c r r r r r r r (Output) 6 6 5 4 Fig. 4. Hrdwre rchitecture of the Urdhv tirykhym multiplier. Fig. 5. Common Difference Nerest se = Column digits 96 X 9 96 ( 96 ) 9 ( 9 ) Column 96 4 Multipliction 9 7 Result 89 8 digits Result = 96 X 9 = 898 Multipliction using Nikhilm Sutr. is which is nerest to nd greter thn oth these two numers. As shown in Fig. 5, we write the multiplier nd the multiplicnd in two rows followed y the differences of ech of them from the chosen se, i.e., their compliments. We cn now write two columns of numers, one consisting of the numers to e multiplied (Column ) nd the other consisting of their compliments (Column ). The product lso consists of two prts which re demrcted y verticl line for the purpose of illustrtion. The right hnd side (RHS) of the product cn e otined y simply multiplying the numers of the Column (7 4 = 8). The left hnd side (LHS) of the product cn e found y cross sutrcting the second numer of Column from the first numer of Column or vice vers, i.e., 96 7 = 89 or 9 4 = 89. The finl result is otined y conctenting RHS nd LHS (Answer = 898). After this illustrtion, we now discuss the opertionl principle of Nikhilm Sutr y tking the cse of multipliction of two n it numers x nd y hving compliments x = n x nd ȳ = n y respectively. The required product p is defined s: p = xy, (8) which cn e refrmed y dding nd sutrcting n + n (x + y) to the right hnd side s: p = xy + n n + n (x + y) n (x + y). (9) The ove terms cn e clued s follows: p = { n (x + y) n } + { n n (x + y) + xy} = n {(x + y) n } + {( n x)( n y)} = n {x ȳ} + { xȳ} = n {y x} + { xȳ}. () From (), the expressions of LHS nd RHS cn e deduced, which come out to e: LHS = {x ȳ} = {y x}, () RHS = { xȳ}. () Hence the multipliction of two n- it numers is reduced to the multipliction of their compliments. To tke full dvntge of this reduction, it should e ensured tht the numers otined fter tking the compliments re lesser thn the originl numers. This condition is stisfied if oth the originl numers re greter thn n /, i.e., x > n / nd y > n /. This is the reson why it is sid tht the Nikhilm Sutr is more efficient in the multipliction of lrge numers thn the smller ones. An importnt point to note here is the numer of digits required in the RHS of the product. From (), it is cler tht RHS should hve n digits irrespective of numer of digits in the product xȳ. We illustrte this point y considering specil cse of the multipliction of two - digit numers in which RHS comes out to e single digit (99 97). As shown in Fig. 6, the LHS of the product comes out to e 99 = 759
Fig. 6. Common Difference 99 X 97 Nerest se = 99 ( 99 ) 97 ( 97 ) Column Column 99 97 96 digits digits Result = 99 X 97 = 96 Multipliction using Nikhilm Sutr. Multipliction Result 97 = 96 nd the RHS comes out to e =. As n = in this cse, we need to ppend leding zero to the RHS mking it to e. The finl result thus comes out to e 96. On the other hnd, if the numer of digits in RHS would hve een three, then the most significnt digit would e the crry digit to LHS. With this knowledge of the Vedic formule, we now descrie the developed multipliction lgorithm. C. The Proposed Algorithm We recst the Nikhilm Sutr in inry rithmetic nd further exploit certin sic properties of multipliction like shifting to propose new reduced-it multipliction lgorithm. The proposed lgorithm is summrized in Tle for the cse of multiplying two 4-it numers. It is shown tht the proposed lgorithm reduces 4 4-it multipliction to single -it multipliction opertion. As result, it reduces the dely for crry propgtion thn ny stndrd 4 4-it multiplier. In the preprocessing stge, the input inry numers re right shifted to remove the lest significnt consecutive zero its. This decreses the computtionl time y reducing the numer of its in the multiplier nd the multiplicnd. The effect of the removed zero its is efficiently incorported y shifting the finl product to the left y equl numer of its. As explined in Tle, if oth the multiplier nd the multiplicnd otined fter the preprocessing stge re 4-it numers, Nikhilm Sutr is directly pplied to reduce the numers to tmost -its. If the numers thus otined re exctly -it numers, the sutr is gin pplied to reduce the multipliction to -it which cn e done with ny stndrd multiplier. In nother cse, if the numers otined fter preprocessing stge re 4-it nd -it numers, the lrger numer is expnded s sum of inry nd -it numer. This reduces the entire multipliction to -it multipliction opertion, followed y shift nd n ddition opertion. A -it multipliction is further reduced to -it multipliction opertion s explined in the previous cse. On the other hnd, if one of the numers is -it long nd the other one -it, the lrger numer is expnded s sum of inry nd -it numer. This reduces the entire multipliction World Acdemy of Science, Engineering nd Technology 9 8 TABLE I THE PROPOSED REDUCED-BIT MULTIPLICATION ALGORITHM () Initiliztion Predefine: flg = flg = flg = flg 4 = () Preprocessing Input 4-it inry numers nd n = Numer of lest significnt consecutive zeros in n = Numer of lest significnt consecutive zeros in n = n + n ā = Right shift y n = Right shift y n (c) Processing. IF (ā > & > ) THEN ā = ā; = ; flg =. IF (ā > & > ) THEN = ; [Solution = ā + ā] flg = [If > & ā >, THEN ā = ā ]. IF ā > & > THEN ā = ā; = ; flg = 4. IF (ā > & > ) THEN = ; [Solution = ā + ā] flg 4 = [If > & ā >, THEN ā = ā ] 5. IF (ā = ) THEN p = IF ( = ) THEN p = ā GOTO Step 7 6. Perform -it multipliction: p = ā 7. IF (flg 4 = ) THEN p = ā + p; = + 8. IF (flg = ) THEN p = {LHS = (ā + ) + crry of RHS} {RHS = (-it) p}; ā = + ā ; = + 9. IF (flg = ) THEN p = ā + p ; = +. IF (flg = ) THEN p = {LHS = (ā + ) + crry of RHS} {RHS = (4-it) p}. p = Left shift p y n its. Return the product p. END. to -it multipliction, shift nd n ddition opertion. If the preprocessing stge outputs -it or -it numers, they re processed s explined erlier. Finlly, nother cse might rise in our processing stge where either of the numers is. In tht cse, the output lwys equls to the other numer irrespective of the vlue of the numer otined fter processing. The entire lgorithm to e followed in the 4 4 multipliction opertion is presented in Tle. Here, we hve exploited the sic opertionl principle of Nikhilm Sutr in conjunction with certin other sic rithmetic opertions like decomposition nd it shifting s explined ove. The proposed multiplier lgorithm cn further e extended for lrger numers with some modifictions in the lgorithm condition checking steps ccordingly. IV. CONCLUSION A new reduced-it multipliction lgorithm sed on formul of ncient Indin Vedic mthemtics hs een proposed. Both the Vedic multipliction formule, Urdhv tirykhym nd Nikhilm, hve een investigted in detil. Urdhv tirykhym, eing generl mthemticl formul, is eqully pplicle to ll cses of multipliction. A multiplier rchitecture sed on this Sutr hs een developed nd is seen 76
to e similr to the populr rry multiplier where n rry of dders is required to rrive t the finl product. Due to its structure, it suffers from high crry propgtion dely in cse of multipliction of lrge numers. This prolem hs een solved y introducing Nikhilm Sutr which reduces the multipliction of two lrge numers to the multipliction of two smll numers. The frmework of the proposed lgorithm is tken from this Sutr nd is further optimized y use of some generl rithmetic opertions such s expnsion nd itshifting to tke full dvntge of it-reduction in multipliction. The computtionl efficiency of the lgorithm hs een illustrted y reducing generl 4 4-it multipliction to single -it multipliction opertion. World Acdemy of Science, Engineering nd Technology 9 8 REFERENCES [] K. Hwng, Computer Arithmetic: Principles, Architecture And Design. New York: John Wiley & Sons, 979. [] M. M. Mno, Computer System Architecture. Englewood Cliffs, NJ: Prentice-Hll, 98. [] G.-K. M, F. J. Tylor, Multiplier Policies for Digitl Signl Processing, IEEE ASSP Mg., vol. 7, no., pp. 6, Jn. 99. [4] D. Golderg, Computer Arithmetic, in Computer Architecture: A Quntittive Approch, J.L. Hennessy nd D.A. Ptterson ed., pp. A- A66, Sn Mteo, CA: Morgn Kufmnn, 99. [5] A.D. Booth, A Signed Binry Multipliction Technique, Qrt. J. Mech. App. Mth.,, vol. 4, no., pp. 6 4, 95. [6] G. Goto. High Speed Digitl Prllel Multiplier. U. S. Ptent 5 465 6, Nov. 7, 995. [7] L. Ciminier nd A. Vlenzno, Low Cost Seril Multiplier for High Speed Specilised Processors, IEE Proc., vol. 5, no. 5, pp. 59 65, Sept. 988. [8] D. Ait-Boudoud, M. K. Irhim nd B. R. Hyes-Gill, Novel Pipelined Seril/Prllel Multiplier, Electron. Lett., vol. 6, no. 9, pp. 58 58, April 99. [9] R. Gnnsekrn, A Fst Seril-Prllel Binry Multiplier, IEEE Trns. Comput., vol. 4, no. 8, pp. 74-744, Aug. 985. [] B. K. Tirth, Vedic Mthemtics. Delhi: Motill Bnrsidss Pulishers, 965. [] P. D. Chidgupkr nd M. T. Krd, The Implementtion of Vedic Algorithms in Digitl Signl Processing, Glol J. of Engg. Edu., vol. 8, no., pp. 5 58, 4. [] H. Thpliyl nd M. B. Srinivs, High Speed Efficient N N Bit Prllel Hierrchicl Overly Multiplier Architecture Bsed on Ancient Indin Vedic Mthemtics, Enformtik Trns., vol., pp. 5-8, Dec. 4. [] H. Thpliyl, R. V. Kml nd M. B. Srinivs, RSA Encryption/Decryption in Wireless Networks Using n Efficient High Speed Multiplier, in Proc. IEEE Int. Conf. Personl Wireless Comm. (ICPWC- 5), New Delhi, Jn. 5, pp. 47 4. [4] H. Thpliyl nd M. B. Srinivs, An Efficient Method of Elliptic Curve Encryption Using Ancient Indin Vedic Mthemtics, in Proc. IEEE MIDWEST Symp. Circuits. Systems, Cincinnti, Aug. 5, pp. 86 89. [5] H. Thpliyl, M. B. Srinivs nd H. R. Arni, Design And Anlysis of VLSI Bsed High Performnce Low Power Prllel Squre Architecture, in Proc. Int. Conf. Algo. Mth. Comp. Sc., Ls Vegs, June 5, pp. 7 76. 76