US 3579267 A
Description (OCR text may contain errors)
United States Patent Inventor Carl Macey Wright Cinnaminson, NJ. 860,592
Sept. 24, 1969 May 18, 1971 RCA Corporation Appl. No. Filed Patented Assignee DECIMAL T0 BINARY CONVERSION 3,026,035 3/ I 962 Coleur 3,185,825 5/1965 McDonaldetal. 3,524,976 8/1970 Wang Primary Examiner-Maynard R. Wilbur Assistant ExaminerGary R. Edwards Attorney-H. Christofiersen ABSTRACT: Successive 4-bit numbers representing successive decimal digits in decreasing order of significance are inserted into one portion of a register means. During each period between the insertion of one 4-bit number and the next, the bits are shifted stage-to-stage and an adder serially adds the bit stored in one stage of said one portion of the register means to bits stored in two other stages of the register means. The selection of stages is such as to cause to be added to each new decimal digit, the two multiple and the eight multiple of a binary number representing all previously applied decimal digits. The successive sum bits produced by the adder are returned, in serial fashion, to the register means and represent a new binary number equal to the digits inserted, to that point, of the decimal number.
Patented May 18,1971
1 N VEN TOR.
l VF/ciflr H v k f k? km m x a;
M .3? v?? Q Q j mm &3 e
Pi'ented M y 18,1971 3,579,267 J v 2 Sheets-Sheet 2 INVENTOR.
(4a MM/ DECIMAL T BINARY CONVERSION BACKGROUND OF THE INVENTION Most computer operators prefer to employ decimal numbers as inputs to a computer. However. in small computers such as desk top calculators and in some large computer systems such as those employed for time sharing, in the interest of more efficient computer operation, the decimal numbers should be translated to binary numbers before other operations begin. Binary arithmetic operations, as one exam ple, are simpler to implement than decimal arithmetic operations because the available register capacity is used more efficiently and because the corrections and carries required in binary coded decimal (BCD) arithmetic, when a digit is between the values of and inclusive, are eliminated.
Decimal numbers may be entered into a computer via.a keyboard and it is most convenient to depress the keys in the normal sequence, that is, the key for the most significant digit first. The problem arising from such a presentation is that the number of digits to be entered is not known in advance by the machine. While departures from the conventional entry of numbers via keyboards can ease these problems, they would result in more work for the operator. and the abnormal nature of the presentation easily could lead to human errors.
The object of the present invention is to provide an improved decimal to binary number conversion circuit that is very simple and therefore relatively inexpensive and'which operates in the normal manner, that is, which'acceptsthe decimal numbers, most significant digit first, and which produces a binary number that is always correct, that is, which is of the correct value up to the decimal digit last entered.
SUMMARY OF THE INVENTION Successive 4-bit numbers representing successive decimal digits, in decreasing order of significance, are inserted into one portion of a register means. During each period between the insertion of one such number andthe next, the inserted number is shifted stage to stage and during each shiftinterval an adder adds a group of three bits, taken from three stages of the register means. The stages are selected to obtain the serial addition of the 2 multiple of the stored number to the 8 multiple of the stored number to the number just inserted, whereby the adder produces successive sum bits representing the binary equivalent of the digits of the decimal number inserted up to that point.
BRIEF DESCRIPTION OF THE DRAWING FIG. 1 is a block diagram of a preferred embodiment of the present invention; and
FIG. 2 is a logic diagram of one form of adder which may be used in the circuit of FIG. I.
DETAILED DESCRIP'T ION The system of the present invention operates on the principle that a decimal number may be converted to a binary number by obtaining successive l0 multiples .and performing successive addition steps. For example, the conversion of 387 decimal to 387 binary may be accomplished by multiplying the most significant digit 3 by 10 and addingit to 8 to obtain 38 binary. The 38 is then multiplied by 10 and added to 7 to obtain 387 binary. In the present system, the multiplication of a digit by 10 is carried out by multiplying it by 2 and multiplying it by 8, and adding the two products. The multiplication of a binary-coded decimal or binary number by 2 is accomplished by effectively shifting the number one place to the left and the multiplication by 8 is accomplished by effectively shifting the number three places to the left.
While the general algorithm above is in itselfwell-known, the present invention resides in a new and very simple system for implementing this algorithm without preliminary shifls or delays. The system requires only shift register means, shown in FIG. 1 to comprisea plurality of JKflip-flop stages 8,, B
In the operation of the system of FIG. 1, when a numbered key on the keyboard 14 is depressed, a 4-bit binary (or binarycoded decimal number-they are equivalent when only 4 bits are considered) is inserted into the most significant four stages B, B of the register means. In this particular register, the insertion is accomplished by applying the bits to the S terminals. In addition, in thisparticular arrangement, the four.
bits are inserted in parallel. However, it is to be understood that the invention operates equally well with the bits clocked into the four stages serially, as is sometimes done in small desk top calculators.
Each time a key on the keyboard is released after being depressed, the shift pulse generator 12 is activated and it generates a group of sequential pulses t t t,,, where n, the number of such pulses, is sufficient to cause the least significant, that is the '2-bit of the 4-bit number to be shifted from B stage to the B stage. The shift pulses, as is clear from the drawing, are applied to all of the shift (C) terminals of the register and are applied also to the adder. Each time a shift pulse occurs, the bits in all except E and 8, stages of the register are shifted one stage forward, that is, are shifted to the stage of next'lower significance; The bit stored in the B stage is applied to theadder as is the bit in the B stage. The bit stored in the B stage, in addition to being shifted one stage forward, also is applied to the adder.
In response to each shift pulse, the output of the adder 10 is shifted into register stage B The adder 10 is always the sum of the three inputs (I +I-,l and the carry generated during' the previous shift pulse. As will be shown shortly, this carry is stored in the adder 10 for the interval from one shift pulse to the next.
The conversion may be best understood by a specific example. Assume that it is desired to convert decimal 387 to binary 387. First, the reset key is depressed. This causes a reset pulse.
to be applied to all reset terminals to clear all storage stages. Next, the key 3 is depressed. This causes binary 3=00l l to be inserted, in parallel, into stages B, B The insertion is completed by the time the key is depressed and when the key is released, the shift pulse generator 12 is activated and generates its sequential pulses. The least significant bit'l of 001 l is shifted by these pulses from stage-to-stage until it reaches the B stage. In a similar manner, the remaining 3 bits 001 are shifted by these pulses through the adder 10 until they reach stages 8;, B and B respectively. Accordingly, by the time the last shift pulse terminates, and this is well prior to the time the next key is depressed, the number just inserted into the B, B stages has been moved to the B ....'B stages.
It is to be understoodthat the shifting above occurs very rapidly relative to the time between the depression of two successive keys. Even an extremely fast operator cannot depress successive keys on the keyboard in a time faster than a fraction of a second whereas the shift pulse generator 12 easily can generate its group of pulses in tens of microseconds with many circuits of standard design.
TABLE I t I u; r t. t t t Shift pulses u u l NumbersroredinBiBzB1Bo=3.
1 u 0 Numbergiuserted in Bu Bn-I Bu-z 0 0 1 1 Number shifted to B1 B 13-;
...... 1 O 0 1 1 0 Successive sum bits produced=38 (binary) 1 1 0 0 0 0 0 1 1 Successive sum bits produced=387 (binary).
As is clear from the table above, during the first shift pulse, the adder adds the least significant bit of the number 3 (this bit is stored in the B stage) to the second least significant bit of the number 8 (this bit is stored in the B,, stage). The 4-bit binary equivalent of the decimal number 8 therefore appears shifted one place to the right relative to the stored number 3. That is, the stored number 3 is shifted one place to the left relative to the new number 8 so that 6 (the 2 multiple of 3) is being added to 8.
I During the second shift pulse, t the second least significant digit of 3 is added to the third least significant digit of a number 8. By the time the third shift pulse, t arrives, the least significant bit of the number 3 is present in the B stage. At this same time, the most significant bit of the number 8 is present in the B stage. Concurrently, the third least significant bit of the number 3 is in the B stage. It should be clear from the upper part of Table I that what is actually occurring at this time is that the number 3 relatively shifted three places to the left is being added to the number 8 and is being added to the number 3 relatively shifted one place to the left. In other words, 24 (the 8 multiple of 3) is being added to 6 (the 2 multiple of 3) and to the number 8.
The process above continues until all of the shift pulses have been exhausted. At this time, the sum produced as a result of the steps described has been shifted into and is stored in the six stages B B B all as shown in Table I. As is also clear from the table, this sum is 38 binary so that the first two decimal numbers have been converted to their binary equivalent.
The lower part of Table I (below the double line) shows the completion of the conversion of 387 decimal to 387 binary. As should be clear from the foregoing explanation, what is done is to add the 2 multiple of 38 to the 8 multiple of 38 to the next decimal number 7 to obtain 387. binary.
The pulse generator 12 is designed to produce a number of pulses depending upon the number of stages in the shift register means. The number of stages, in turn, depends upon the number of decimal digits it is desired .to convert to binary digits. In the example shown-the conversion of 387 decimal to 387 binary, the binary number 387 is stored in nine stages, B,,, B B In addition, there is required the 2 least significant stages B and B In addition, the other stages B,,, B,,,, and B are needed. In general, to store a number not greater than 10", the number of stages required is given by (l0X)/3+8, or
the next larger integer, if (l00X )/3+8 is not an integer. The
binary equivalent of the decimal number will be stored in register positions B through B The value of n is given by (10X )/3+b06.
When the value of n has been determined, the shift pulse generator 12 is designed to generate a train of pulses, n3 in number, when triggered by the activation of a number button on the keyboard 14. Such generators are well known in the art and need not be described in detail.
While any one of a number of different types of adders may be employed, the one shown in FIG. 2 is specially designed for the purpose. It includes seven AND gates, 20 to 26, seven OR gates, 30 to 36. four inverters, 40 to 43 and one JK flip-flop 44.
The arrangement is such that it implements the Boolean equations for addition. It is a relatively simple three operand adder that takes advantage of the property that not more than three of the four bits 1,, I I K ever have the value I at the same time. A specific example is given below to show how the circuit operates.
Assume first that I =I =l and that I and K, the previous carry=0. AND gate 20 receives inputs I, and T and is disabled since T 0. AND gate 21 receives inputs T and I and is disabled since I =0. AND gate 22 receives inputs 1;. and K and is disabled as I =O. AND gate 23 receives inputs and K and is disabled as K=O. Accordingly, both AND gates 24 and 25 are disabled and S=0 and 8 1.
The carry circuit implements the Boolean equation: K=(I +I +I )(I +l +K)(I +l +K)(I +I +K) As I =1 is present in the first three expressions within the parenthes is, the first three OR gates 33, 34, 35 are enabled and as his present in the last expression within the parenthesis, OR gate 36 is enabled. Accordingly, AND gate 26 becomes enabled and flip-flop 44 becomes set and stores a 1 at the next clock pulse. Thus the circuit has been shown to produce an output S=0 and C=l when two of the four input bits have the value 1. It readily can be shown that the circuit also operates properly for the remaining cases.
In the operation of the adder of FIG. 2, the flip-flop 44 stores the carry generated during the previous shift pulse t,-. In response to the next shift pulse tfil, the sum, which is already present at terminals S and 8, is shifted into the Biz-3 stage (FIG. 1) and the carry, which already is calculated based on the previous values of 1,, I i and the previous carry K, and which is present on lead 50 (and its complement on its lead 51) is inserted into the flip-flop 44. This carry now remains stored in this flip-flop until the next shift pulse n After the carry is stored and before the next shift pulse t,- occurs, the values of 1,, l and I may change. This does not affect the stored carry as information cannot be shifted into flip-flop 44 until the next shift pulse 1 occurs. Similarly, immediately after one shift pulse r and before the next shift pulse t the new sum and its complement are present on leads 52 and 53 respectively but do not affect stage B,,, These bits are not shifted into the flip-flop B until the next shift pulse t, occurs.
As already stated, the broad idea of shifting and adding to obtain the 10 multiple is in itself known. For example, it is employed in a form different than that employed here, in the conversion scheme illustrated in McDonald, et al. Pat. No., 3,185,825. In the patented system, two left shifts are employed to obtain the 4 multiple and it is added to the one multiple to obtain the 5 multiple. The 5 multiple is then shifted one place to the left to obtain the 10 multiple.
An important advantage of the present system over that of the patent is its simplicity. In the present arrangement, only register means, an adder, a shift pulse generator, and data input means are employed, whereas in the McDonald, et al. system, in addition to these components, numerous logic gates and delay means are required. This difference is of great importance in a field such as desk top calculators, where, in order to be competitive, the hardware must be inexpensive and must occupy little space. In the present system, because of the ingenious way in which the elements are interconnected, their number may be reduced to a minimum satisfying both requirements above. In addition, the circuit is simple and yet it exhibits high operating speed-all shifting is simulated during a single serial add cycle. In McDonald, during a first serial add cycle the 5 multiple is obtained, and a second serial add cycle is needed to obtain the 10 multiple and perform the next addition.
1. A system for converting a decimal number to a binary number comprising, in combination:
a plurality of shift register stages;
means for inserting into four of said stages, during successive time intervals, successive 4-bit numbers representing the successive decimal digits of said decimal number;
means for shifting the bits stored in the least significant of said four stages and in the remaining ones of said stages, from stage to stage during each such time interval;
means for shifting during each shift of said bits from one stage to the next, a bit from one stage to said adder means, a bit from another stage to said adder means, and a bit from the second least significant of said four stages to said adder means for causing to be added serially the 2 multiple of the previous sum produced by said adder means to the 8 multiple of said previous sum to the 4-digit number just inserted into said register; and
means for inserting, during each shift of said bits from one stage to the next, the sum bit produced by the adder back into a given stage in said register.
2. A circuit for converting a binary coded decimal (BCD) number representing a multiple digit decimal number of a binary number comprising, in combination:
register means having a plurality of storage stages B,,, B
B B B "B B B 1, B,2, in decreasing order of significance, each stage having a shift terminal, signal input terminal means and signal output terminal means, each stage except the B and B stages being connected at its output terminal means to the input terminal means of the stage of next lower significance for shifting the bit stored therein to said stage of next lower significance in response to a shift pulse applied to its shift terminal; means for inserting into the most significant four stages B,,....B,, of said register, during successive time intervals.
the successive 4-bit BCD numbers which define said multiple digit decimal number, starting with the most significant decimal digit;
adder means connected to the output temiinal means of the B B and 8, stages of said register means for adding, in
response to each shift pulse, the bits stored in these stages to any carry produced in response to the preceding shift pulse, for producing a sum signal and applying it to the input terminal means of said B stage, and for producing and storing a carry; and
means responsive to each insertion into said register means of four hits of a BCD number, for applying a group of time sequential shift pulses to the shift terminals of all stages of said register means and to said adder means, of sufficient number to shift'the least significant bit of said BCD number from said B,, stage to said B stage of said register means and for causing said adder means to perform a number of sequential additions equal to the number of said shift pulses in said group.
3. A circuit as set forth in claim 2, wherein said means for inserting comprises a keyboard.
4. In a system for converting a decimal number into an equivalent binary number by shifting the binary digits already converted to obtain even multiples thereof to be added together to derive the tens multiple of the binary number to be added to the decimal digit being entered, the improvement comprising:
adder means having input terminal means for signals representing three bits to be added and an output terminal means for producing a manifestation of a sum; and binary register means storing said binary number and the binary equivalent of said decimal digit coupled at three stages thereof to said three input means, respectively, of said adder means, and coupled at another stage to said output terminal means of said adder means, and coupled at another stage to said output terminal means of said adder means for receiving said manifestation of a sum,
said binary register means including also additional stages preceeding and following the stages containing the binary number for rendering unnecessary any preliminary shifts to obtain said even multiples of said binary number.
UNITED STATES PATENT OFFICE CERTIFICATE OF CORRECTION Patent: No. 3.579.267 Dated May 18, 1971 Carl M. Wright PAGE Invento r(s) It is certified that error appears in the above-identified patent and that said Letters Patent are hereby corrected as shown below:
Col. 1, line 75, "E B should read --B B Col. 2, line 1, "B B B should read -B B B C01 2, line '13, "E B should read --B B Col. 2, line 26,"'B should read --B Col. 2, line 29, "B and B should read --B and B Col. 2, line 31, "B should read --B Col. 2, line 32, "B should read --B Col. 2, line 37, B should read -B Col. 2, line 48 "B B should read --B B C01. 2, lihe 58,"B E should read "a B Col. 2, line 70, B B should read -B B Col. 2, line 71, "1: t should read --t FORM 1 0-1050 (10-69) USCOMM-DC QOSTG-PGB a u.s. GOVERNMENT rnmmm OFFICE 190s o-us-au Patent No.
, line Col. 3
Col 3, line Col. 3 line Col. 3, line Col. 3, line Col. Q, lirfe C01,. 3, line C01. 3, line Col. 3 line Col 3, line C01. 4, line C01. 4, line Col. 4, line Page 2 UNITED STATES PATENT OFFICE In n o garl M. Bright It is certified that error appears in the above-ident1fied patent and that said Letters Patent are hereby corrected as shown below:
CERTIFICATE OF CORRECTION Dated May 18 1971 "B Should read -B "B should read --B "8, should read --B "B and B should read B and B "B B should read --B B "B should read -B H should read ti B should read B FORM FQ-105U (10-59) USCOMM-DC GOSIG-PGQ n u s, covnuuzm' murmur, oFrlci I969 o-zu-an Page 3 UNITED STATES PATENT OFFICE CERTIFICATE OF CORRECTION Patent No. 3 ,579 ,267 Dated Ma 18 1971 Inventor(s) Carl. M. Wright It is certified that error appears in the above-identified patent and that said Letters Patent are hereby corrected as shown below:
Col. 4, line 45, "B should read -B C01. 4, line 45, "t should read --t Col 5, line 23, E B should read B B Col. 5, line 24, "B B E B B B 1 B 2" should read -B B B B B -1 -2" Col 5, line 27, "B and B should read --B and B Col. 5, line 33, E B should read --B B Col. 5, line 38, "B 1 B and B should read --B B and B C01. 6, line 4, "E should read -B Col. 6, line 11, "B Should read -B Col. 6, lines 31-33, delete and coupled at another stage to v said output terminal means of said adder means" Signed and sealed this lLrth day of March 1972.
(SEAL) Attest: 4
EDWARD M.FLET0HER,JR. ROBERT GOTTSCHALK Attesting Officer Commissioner of Patents ORM po'wso uscoMM-Dc wave-P69 ,5, GOVERNMENT PRINTNG OFFICE '9" 0-36-33