1299 IEEF TRANSACTIONS ON COMPUThRS, DECFMBER 1974 [2] C. V. Page, "Equivalence between probabilistic and deterministic sequential machines," Inform. Contr., vol. 9, 1966. [3] G. H. Ott, "Reconsidering the state minimization problem for stochastic finite state systems," in IEEE 8th Symp. Switching and Automata Theory, Oct. 1966, pp. 267-273. [4] M. Depeyrot, "Operand investigation of stochastic systems," Stanford Univ., Stanford, Calif., Ph. D. dissertation, May 1968. [5] C. V. Page, "Strong stability problems for probabilistic sequential machines," Inform. Contr., vol. 15, pp. 487-509, 1969. [61 A. Paz, Introduction to Probabilistic Automata. New York: Academic, 1971. Francois Bancllhon was born in France in 1948. He graduated from the Ecole des Mines, Paris, France in 1970 and received the Docteur-Ingenieur degree from the University of Paris, Paris. He is currently a Ph.D. student at the University of Michigan, Ann Arbor, on leave from IRILA, Domaine de Voluceau, Rocquencourt, France. In 1971 and 1972 he was with IRIA, Domaine de Voluceau, Rooquencourt, France. Correspondence Serial Binary Division by Ten RICHARD L. SITES Abstract-A technique is presented for dividing a positive binary integer by ten, in which the bits of the input are presented serially, low-order bit first. A complete division by ten is performed in two word times (comparable to the time needed for two serial additions). The technique can be useful in serial conversions from binary to decimal, or in scaling binary numbers by powers of 10. Index Terms-Binary division, binary-to-decimal conversion, decimal floating point, serial arithmetic, serial division. INTRODUCTION In many applications, decimal numbers are stored in a machine in binary form, making it necessary to convert between binary and decimal representations, and perhaps to scale binary numbers during internal arithmetic. A common operation in such applications is multiplication or division of a binary number by ten. Multiplication by ten can easily be done by shifting and adding (2 X B + 8 X B). This paper deals with the inverse operation: division of a binary number by ten, specifically in a bit-serial machine where the bits of a number are presented in low-order bit first, the same order used for serial addition. For simplicity, only positive integers are treated. The problem, then, is to design a black box that accepts a serial number B and produces two serial numbers Q = LB/10j and R = B mod 10. Manuscript received January 29, 1973; revised March 4, 1974. This work was supported by the Fannie and John Hertz Foundation. The author is with the Computer Science Department, Stanford University, Stanford. Calif. 94305. ' [A] is the floor of A-the largest integer A. REDUCTION TO DIVISION BY 5 The remainder R = B mod 10 can be expressed in terms of division by 5: R = B mod 10 = 2 X (LB/2j mod 5) + B mod 2. This says that the remainder can be found by appending the loworder bit of B (= B mod 2), on the right of the remainder of dividing the rest of B (= LB/2J) by 5. In a similar way, the quotient Q = LB/10J can be expressed in terms of dividing by 2 and then by 5: Q = LB/2 X 5J = LLB/2j/5j. In a binary machine, LB/2J can be produced by just throwing away the low-order bit of B. The problem of division by ten is now reduced to the process of saving the low-order bit of B for the remainder, then using the quotient and remainder from dividing LB/2J by 5. A LOOK AT MULTIPLICATION BY 5 Division by 5 is a process that "undergoes" multiplication by 5. To gain some insight of how division by 5 works, it is useful to look at multiplication by 5. The long multiplication of a number, A = a4 a3 a2 al aO, by 5 looks like this: x a4 a3 a2 al aO 1 0 1 a4 a3 a2 al aO a4 a3 a2 al aO P = p7 p6 p5 p4 p3 p2 pl p0. If we were given a known multiple of five, P = A X 5, and asked to find A, we could immediately read off the two low-order bits of Athey are just the two low-order bits of P. Using al and aO, the next two bits of A can be found by subtraction: IEEE TRANSACTIONS ON COMPUTERS, DECEMBER 1974 1300 SERIAL BINARY DIVISION BY TEN Fig. 1. Divide by five circuit. The delay (Di and D2) outputs are initially zero. TABLE I NEW VALUE OF R IF A 1-BIT IS INPUT; 0-BITS DO NOT CHANGE R Bit Time 0 4 8 1 5 9 2 6 1O 3 7 11 p7 p6 p5 p4 p3 p2 - al aO Current 000 001 ... .. ... ... 001 010 100 0o1 010 011 000 100 011 100 001 000 t7 t6 t5 t4a3 a2. In turn, a3 a2 can be subtracted to find the last bit of A: t7 t6 t5 t4 - a3 a2 - since B L (B -B mod 5) /5J - B mod 5 = (B -B mod 5) /5, is an exact multiple of five. For example, L37/5i 2/5j = 35/5 = 7. So if B mod 5 is known, the quotient Q = LB/5J can be found with = L37 - two subtractors and two bit delays2 (Fig. 1). DETERMINING B MODULO FIVE The problem of finding B mod 5 can be solved with a 5-state sequential machine. This is done by viewing B as the sum of the powers of two that the individual bits represent, and using the identity (X + Y) mod 5 = (X mod 5 + Y mod 5) mod 5. For example: 2 Edward S. Davidson has suggested that one of the serial subtractors can be eliminated by using B mod 5 to set the initial states of the two delay flip-flops and the "borrow" flip-flop in the remaining subtractor: B mod 5 Borrow D2 Di 0 1 2 3 4 0 1 0 1 1 0 o 0 0 1 1 0 1 1 The bits of a binary number have the following place values modulo 5: b5 b4 b3 b2 bl bO 64 mod 5 32 mod 5 16 mod 5 8 mod 5 4 mod 5 2 mod 5 1 mod 5 ... 4 2 1 3 4 2 1 . This is the key to the division by five process: given a multiple of 5, read off the two low-order bits as the two low-order bits of the quotient, then subtract these two bits from the rest of the input to produce two more quotient bits, and repeat this process until the input is exhausted. This can be implemented with a serial subtractor and two bit delays. The above process only works if the input is an exact multiple of five. For an arbitrary number, B, = (32 +2 + 1) mod5 (32mod5 +2mod5 + 1 mod5) mod5 - (2 + 2 + 1) mod 5 = 5 mod 5 = = * 0a4 0a4. LB/5i 000 001 011 010 - 0. b6 a4a3 a2 + a4 -a3 a2 100 000 010 001 35mod5 a4 a3 a2 al aO + a4a3 a2 al aO - R in binary 010 011 100 0 The pattern * * .3 4 2 1 ... repeats indefinitely. If R designates B mod 5, and initially R = 0, then every one-bit in positions bO,b4, b8,... adds 1 to R, every bit in positions bl,b5,b9, .. adds 2 to R, every bit in positions b2,b6,blO,.. adds 4 to R, and every bit in positions 3, b7,bl 1, * adds 3 to R (the additions are done modulo 5). R has the transition diagram given in Table I. There is an analogy between the familiar casting out nines process in decimal arithmetic and this process of casting out 15's. - - THE COMPLETE DIVIDER The divide-by-ten black box is now complete except for some clocking, the logic for the low-order remainder bit, and the conversion of the static remainder flip-flop outputs to a serial bit train. The full circuit appears in Fig. 2. APPLICATIONS This technique can be used to convert integers from binary to decimal by repeated divisions. Unlike methods based on the ideas of Couleur [1}]-3], this method uses a fixed amount of hardware, independent of the word size; longer words just take more time for the successive divisions. This technique can also be used for the fast scaling of binary numbers by powers of 10, such as in decimal fraction or floating decimal point calculations. The technique allows division by ten to be performed in essentially the same amount of time as multiplication by ten: one or two add times instead of the much longer time needed for a general division. Since half the logic is unused during each word time, it is possible to pipeline the process: the remainder part of a second division can be calculated while the first quotient is being developed. Thus the effective speed can be as high as one division per word time. Of course, for converting a number to decimal by successive divisions, it is necessary to wait for the first quotient before using it as input to the second division. But two different numbers could be converted in almost the same time needed to convert one. 1301 CORRESPONDENCE SERIAL BINARY DIVISION BY TEN lst word time: develop R = B mod 10 2nd word time: output R3 R2 R1 Ro: Dl, D2 : R = B mod 10, 0 = LB/1OJ Flip-flops holding the remainder, 0000 to 1001 1-bit delay flip-flops - TIME J-L.... BIT0 BIT1 BIT2 BIT3 -~~~ Fig. T2 X r-L...T4 2.Copetdvdebtnit TS Fig. 2. Complete divide by ten circuit. REFERENCES BRUCE W. SUTER any modulus and any radix. This leads to the consideration of using modular arithmetic on arbitrarily long sequences with a finite state machine. A finite state machine can perform modular addition, subtraction, multiplication, and, if defined, division of a pair of arbitrarily large numbers, using any modulus and any radix. Two algorithmic procedures are presented for the evaluation of the residue of an arbitrarily long sequence. The first technique provided is a general procedure employing any modulus and any radix; a second technique provides an improvement of the previous technique for moduli of the form (rn- rQ), where r > 2 and 0 < q <n-1. Applications are presented for the almost simultaneous calculation of both the sum and residue sum and both the difference and residue difference of any pair of arbitrarily large r-ary numbers, using any modulus. Abstract-Some fundamental results in the area of computability theory are presented. These include the fact that a finite state machine can find the residue of an arbitrarily long sequence using Index Terms-Computability theory, computer arithmetic, modular addition, modular arithmetic, modular division, modular multiplication, modular subtraction, modulus, residue. [11 J. F. Couleur, "BIDEC-a binary-to-decimal or decimal-to-binary converter," IRE Trans. Electron. Comput., vol. EC-7, pp. 313-316, Dec. 1958. con[21 V. T. Rhyne, "Serial binary-to-decimal and decimal-to-binary 1970. version," IEEE Trans. Comput., vol. C-19, pp. 808-812, Sept. [3] M. S. Schmookler, "High speed binary to decimal conversion," IEEE Trans. Comput. (Short Notes), vol. C-17, pp. 506-508, May 1968. The Modular A thmetic of Arbitrarily Long Sequences of Digits Manuscript received July 16, 1973; revised January 23, 1974. The author is with Honeywell, Inc., St. Petersburg, Fla. The preliminary work with regard to the determining of remainders of binary sequences of finite length was conducted by Rothstein [1]
© Copyright 2026 Paperzz