Residue Arithmetic in Digital Computers
Total Page:16
File Type:pdf, Size:1020Kb
r* 6 l't ¡r "RESIDUT ARITHMETIC IN DIGITAL COIIPUTERS" RAMESH CHANDRA DEBNATH/ M.SC. BEING A THESIS SUBMITTED FOR THE DEGREE OF DOCTOR OF PHILOSOPHY IN THE DEPARTMENT OF ELECTRICAL ENGINEERING THE UNIVERSITY OF ADELAIDE IVIARCl-i I979 SUIq¡4ARY The number systems used have great impact on the speed of a computer, At present at least 4 number systems (binary, negabinary, ternary and residue) are in use either for general purposes or for special purposes. The calîry plîopagation delay which j-s inherent to all weighted systems (binary, negabi-nary and ternary) is a limiting factor on the speed of computations. tlnlike the weighted system, the residue system is carry free which is the m¿rln attractj-ve feature of this system and therefore its potentiality in a general purpose computer, in the light of present day tech- nology, has been investigated. As the background of the investigation the binary and negabinary arithmetic have been thoroughly studied. A ne',r method for fractional negabinary division, and a correction on negabinary multiplì-cation have been proposed. It has been observed that the binary arithmetic operations are fas- ter thair thcse ir. negabinary syslem. The residue system has got. problems too. The sign detectj-on, operations j-nvolving sign detection (comparison, overflow detection, division) and the resj-due-to--decimal- con- version are difficult. Moreover, the residue systemT being an i.nteger: systetn, makes floati-ng poinc arithmetic operatlcns very difficult. The def:ails of the existing algorithms,/ methods to solve those problems have been thoroughly inves- tigated and drawbacks of those algoritlrms/methods have been di scussed. This thesis proposes a new method on multiplj-cative overflow detect-ion in the residue system, a technique for the determination of the first approximation for residue integer division, algorithms for floating point arithmetic operations in the residue system and a method for the res- idue--to-decimal conv.rsion. In order to verify those proposed methods and algor- ithms a 16-15 moduli- residue arithmetic unit has been designed using LS1 components. The unit together with (in this case) an SDK-80 microcomputer can perform all the integer and floating poi-nt arithmetic operations. It has been obse::ved that t'he binary system still- main- tains its predominance over the residue system in general purpose digital computers. However, the residue system is faster where there is no operation involvi-ng sign detection, and also the carry free property, in very large systems, is of great i-mportance j-n minimj-sing the chip connectíons and inter chip delays. In future, investigation should be carried out on the possibility of using VLS1 components which may up- set the present conclusions which are generally in favour of the binary system. ACKNOWI,EDGEMENT The autholî likes t'o acknowledge the contributions of those who have, directly or indlrectly, assisted in this research and preparat-i-on of this t.hesis. The author is pleased to thank Dr D.A. Pucknell, the project supervisor, for his invaluabÌe grlid"rr." and encouragement. The author likes to thank the Radio Research Board of Australia and the Col-ombo Plan Authority for their financial assistance for this project. The author would like to thank t.he technical staff of the Department of Electrical Engineering, University of Adelaide and specially Mr R.C. Nash for his helping hand in the computer laboratory. The author is pleased to thank Mr D.C. Pawsey, senior lecturer and Mr C.K. Linke, laboratory manager, of the Department of Electrj-cal Engineerirg, universj-ty of Adelaide, for their positive help in making a pleasant stay in Ausf:ra1ia. The author likes to thank Mrs Mercaa Fuss for her excellent typing. Fina1ly, the author wislies to thank his wife, Mrs Asha Rani Debnath, for her encouragement 'Ehroughout the research. PAPER WRITTEN BY THE AUTHOR with D.A. Pucknell, "Orr multiplicatlve overflow detection in residue number system". Electronics Letters, Vol.L4, No.5, March 1.978, Þp. L29-130. ERRATA: "On multiplicative overflor^¡ detection i-n residue number system", Electronj-cs Letters, Vol.14, No.l-2, June L978, p. 385. NOTATIONS [x] The highest integer value of X, but less than X. (X may be an arithmetic expressi-on also. ) Fr (ArB) Floating point au].dition/ subtraction with operands A and B. rr (a. e) Floating point multiplicat1on with operands A and B. Fr (AlB) Floating point division with operands À and B. r (n) Shift T to n positions left. (_ Pol (r (n) ) Pol-arÍse r (n) . X+V Replace the value of X with V. (/ may be an arithmetic or a logical expression. ) rn( x, v,....) fnputs X, Y , SX or S (X) Sign of X. x V Swap the values of X and Y. - (X) E F"n, ,t,] E(X ) G (X) 2 lx l* or [x ]* Residue of X with respect to module m. lxl Absotute value of X. Gate (qb,c,...Þ,L) Gate with inputs b, c, . .lz ano output ,L at the location 4. on the residue arithmetic unit (net-t) board. Coef f (a) :> d2 t a-7 0,2 and G.7 are the co-efficients of A. Exp (X) Exponent of X. Mnr (x) MantÍssa of X. :l Contains. CONTBNTS Page L/ INTRODUCTION 1 1.1 Introductory Note 1 1.2 Number Systems an overview 2 2/ ÏNTRODUCTÏON TO BINARY AND NEGABINARY NUMBER SYSTEMS, B 2.L Binary Arithmetic B 2.I.1 Binary Addition and Subtraction 9 2.I.2 Binary Multiplication l_1 2.t.3 Binary Division t4 2.2 The Negabinary Number System 15 2.2.1 Negabinary Number Representation 15 ( lnreger) 2.2.2 Negabinary Number Representation (fraction) 15 2.2.3 Polarisation of Negabinary Number 16 2.2.4 Negabinary Addition/Subrraction l_6 2.2.5 Negabinary Multiplication 20 2.2.6 Negabinary Divislon 20 2.2.7 A Correction Proposed on Varrable Shift Ncgabinary Multiplication 22 2.2.8 Method Proposed on Negabinary Fracti-onal Divisicn 23 2.3 Concl-usion 27 3/ RESIDUE ARITHMETTC LITERATURE REVTEW 2B 3.1 Introduction 2B 3.2 Integer Residue ArithmetÍc an outl j-ne 29 3.2.1 Addition, Subl-raction and Multipl j-cation 29 3.2.2 Division 2c) 3.3 Overflow 33 3.3.1 Overflow due to Addition/ Sul:traction 34 3.3.2 Mul-tiplicative Overf low 34 3.4 Floating Poj.nt Arithmetic in a Residue Number System 35 3.4 1 The Representation of Floating Point Numbers 36 3.4.2 Floating Point Arithmetic 36 3 5 Transl-ation of Residue Numbers to Decimal Numbers 40 3.6 Conclusion 40 4/ RESIDUE ARTTHMETTC ALGORITHMS AND 43 TECHNIQUE PROPOSED 4.L Tntroducti-on 43 4.2 Multiplicative Overf l-ow Theoretical- Aspects 43 4 .2.L Logarithmj-c Distribution of Residue Numbers 44 4.2.2 Design Ideas for Overflow Detection 50 4.2.3 Desi-gn Example on Overflow Detection 52 4 3 General- Division 59 4.3.1 A Division Process 59 4.3.2 How to find the first approx- imation and successive approxJ-m- 61 ations 4.4 Floating Point Ari--hmetic 65 4.4.L Theoretical Concept 65 4.4.2 Floating Point Representation of a Number 66 4.4.3 Floatiug Point Arithmetic with Zero Exponent 66 ¿.Á.a Float-ing Point Ar:j thmetic with Non-zero Exponent 71, 4.4.5 How to find the co-eff-tcient of a mantissa 73 4.4.6 Error in the Proposed Floating Point Arithmetic Operations 73 4.5 Output Translation 74 4.5. 1 Theoretical- Aspects 74 4.5.2 Conversion Prrccedure 75 4.6 Conclusion 77 5/ DESIGN OF A REÀL TIME RESTDUE ARITHMETIC COIVIPUTER 79 5 1 Introduction 79 5 2 Addition, Subtraction and Multiplicat.ion 90 ( rnteger ) 5 3 Comparison 9B 5 4 Overflow Detection 108 5.5 Integer Division 118 5.6 Floating Point Arithmetic r26 5.7 Output Circuit of the RAU t44 5 I Conversion of Residue Numbers to Deci-mal Numbers L47 9 How the Residue Arithmetic Computer Works L49 5. 10 FIow to Operate the RAC 151 5.11 Conclusion 153 6/ CONCLUSTON 155 BIBLIOGRÀPHY L70 Appendix- 1 Some fmportant Proofs A1 .T Appendix-2 Floating Point Val-ue otB A7 Appendl x-3 Table of mantlssa and A9 exponent 1 "f B Appen<lix-4 Error Analysis of Floating Point Àddi-tion and Multiptication A16 Appendix-5 Mixed Radix Conversion A24 Appendix-6 Program Listings A26 À 1 INTRODUCTION 1.1 Introductory Note The number system has a great impact on the speed of computer arithmetic which, together wÍth other factors access ti-¡ne of memories, memory hierarchy and computer architecture, inflüence the speed of a computer as a whole. scientific probrems such as the solution of rarge sets of linear equations, problems embracing the field of structural design, traffic f-icw, signal processing etc. are associated- with a great deal of computation. A number system with its associated arithmetic algori-thms can greatly effect the speed of computat j-on. The choice of a number system depends on the availab- ility of efficient arithmetic algorithms. Technology also influences the choice a great deal. For example, a decimar system would be preferable to a binary system if technology could provide low cost reliable ten valued logic circuits. one nuirrber system can offer advantages on a particular cper- ation, but may be unsuitable from the consideration of over- all s;peed of computatl-on. For example, in a resi_due system, mu]-tiplication is faster, however, other operations such as si-gn detection, comparison and overflow detection are slow processes" rt is, therefore, worthwhile to investigate which of the existing number systems can offer the greatest overall 1 2 speed advantage in computer arithmetic for general purpose computers.