4 BINARY SYSTEMS: cut
undertaken in Chapter 9. Various methods for designing the control unit are
introduced in Chapter 10, The organization and design of a small, complete digital
computer is presented in Chapter 11
A processor, when combined with the control unit, forms a component
referred to as a central processor unit or CPU, A CPU enclosed in small
integrated-cireuit package is called a microprocessor. The memory unit, as well as
the part that controls the interface between the microprocessor and the input and
‘output devices, may be enclosed within the microprocessor package or may be
available in other small integrated-circuit packages. A CPU combined with mem-
ory and interface control to form a small-size computer is called @ microcomputer.
The availability of microcomputer components has revolutionized the digital sys-
tem design technology, giving the designer the freedom to create structures that
were previously uneconomical. The various components of a microcomputer sys-
tem are presented in Chapter 12.
It has already been mentioned that a digital computer manipulates discrete
elements of information and that these elements are represented in the binary form.
Operands used for calculations may be expressed in the binary number system.
Other discrete elements, including the decimal digits, are represented in binary
codes. Data processing is carried out by means of binary logic elements using
binary signals. Quantities are stored in binary storage elements. The purpose of
this chapter is to introduce the various binary concepts as a frame of reference for
further detailed study in the suceeding chapters.
1-2 BINARY NUMBERS
A decimial number such as 7392 represents a quantity equal to 7 thousands plus 3
hundreds, plus 9 tens, plus 2 units. The thousands, hundreds, etc., are powers of 10
implied by the position of the coefficients. To be more exact, 7392 should be
written as:
Tx IP +3 x 10°+9X 10'+2x 10?
However, the convention is to write only the coefficients and from their position
deduce the necessary powers of 10. In general, a number with a decimal point is
represented by a series of coefficients as follows:
: sO Qy0y0,0)..d_\a_y0_y
The a, coefficients are one of the ten digits (0, 1, 2. :, 9), and the subscript value
{gives the place value and, hence, the power of 10 by which the coefficient must be
multiplied
10'a, + 10a, + 10a, + 1022, + 10'a, + 10ay + 10-'a_,
+10, + 1075
The decimal number system is said to be of base, of radix, 10 because it uses ten
digits and the coefficients are multiplied by powers of 10. The binary system is aSEC. 1-2 BINARY NUMBERS. 5
different nimber system. The coefficients of the binary numbers system have two
possible values: 0 and 1. Each coefficient a, is multiplied by 2/. For example, the
decimal equivalent of the-binary number {1010.11 is 26.75, as shown from the
multiplication of the coefficients by powers of 2:
IxBe 1x PrOx Pe 1x2 +0x 41x27
+127? = 26.75
In general, a number expressed in base-r system has coefficients multiplied by
powers of r:
OR ayy Hag tay rt iy
taper tate tag
The coefficients a, range in value from 0 tor — 1. To distinguish between numbers
of different bases, we enclose the coefficients in parentheses and write a subscript
equal to the base used (except sometimes for decimal numbers, where the content.
makes it obvious that it is decimal). An example of a base-5 number is:
(4021.2)5= 4X9 0X2 +2X SEL XS 42X57! = (5114)i0
Note that coefficient values for base 5 can be only 0, 1, 2, 3, and 4.
It is customary to borrow the needed r digits for the coefficients from the
decimal system when the base of the number is less than 10. The letters of the
alphabet are used to supplement the ten decimal digits when the base of the
number is greater than 10. For example, in the hexadecimal (base 16) number
system, the first ten digits are borrowed from the decimal system. The letters A, B,
C, D, E, and F are used for digits 10, 11, 12, 13, 14, and 15, respectively: An
example of a hexadecimal number is:
(BOSE), = 11 X 16° + 6 x 16° + 5 x 16 + 15 = (46687),0
‘The first 16 numbers in the decimal, binary, octal, and hexadecimal systems are
listed in‘ Table 1-1,
Arithmetic operations with numbers in base r follow the same rules as for
decimal numbers. When other than the familiar base 10 is used, one must be
careful to use only the r allowable’ digits. Examples of addition, subtraction, and
multiplication of two binary-numbers are shown below:
augen 101101 minuend: 101101 multiplicand: 1011
addend: +100111 subtrahend: - 100111 multiplier: x101
sum: 1010100 difference: 000110 1011
F2 101
product: Mont‘Tamve 1-1 Numbers with different bases
Decimal Binary Octal Hexadecimal
(oase 10) (base 2) (base 8) (base 16)
00 0000 00 0
o 01 a 1
a oo10 2 2
0 cou 0 3
o4 0100 4 4
0s 0101 05 5
06 onto 06 6
o oul 07 7
08 1000 10 8
6 1001 u 9 .
10 +. 1010 2 A
u 10 B B
2 1100 ipbiaks c
13 1101 1S D
4 110 16 E
5 mm ” F
The sum of two binary numbers is calculated by the same rules as in decimal,
except that the digits of the sum in any significant position can be only 0 or 1: Any
“carry” obtained in a given significant position is used by the pair of digits one
significant position higher. The subtraction is slightly more complicated. The rules
are still the same as in decimal, except that the “borrow” in a given significant
position adds 2 to a minuend digit. (A borrow in the decimal sysiem adds 10 10.4
minuend digit.) Multiplication is very simple. The multiplier digits are always "or
. Therefore, the partial products are equal either to the multiplicand or to 0.
1-3 NUMBER BASE CONVERSIONS
A binary number can be converted to decimal by forming the sum of the powers of
2 of those coefficients whose value is 1. For example:
(1010011), = 2° + 2! +27? +27? = (10375)0
The binary number has four I's and the décimal equivalent is found from the sum
of four powers of 2. Similarly, a number expressed in base r can be converted to its _
decimal equivalent by multiplying each coefficient with the corresponding power of
1 and adding. The following is an example of octal-o-decimal conversion:
(6304), = 6 X 8 +3 X84+4x 8"! = (408.5)i0SEC.1.3 NUMBER BASE CONVERSIONS 7
The conversion from decimal to binary or to any other base-r system is more
convenient if the number is separated into an integer part and a fraction part and
the conversion of each part done separately. The conversion of an integer from
decimal to binary is best explained by example.
EXAMPLE 1-1: Convert decimal 41 to binary. First, 41 is
divided by 2 to give an integer quotient of 20 and a remainder of 1.
The quotient is again divided by 2 to give a new quotient and
remainder. This process is continued until the integer quotient be-
comes 0. The coeficients of the desired binary number are obtained
from the remainders as follows:
integer
fonotiet: ease
t= + i
2. 10 + 0 a,=0
2. 5 + 0
feos}
ze 1 + 0, a=0
ey
answer: (AU)o = (asaayaya,aQ), = (101001);
The arithmetic process can be manipulated more conveniently +
as follows:
integer remainder
ai
1 L 101001 = answer”
. Pr)
The conversion from decimal integers to any base-r system is similar to the |
10
‘ 5
above example, except that division is done by r instead of 2.
2
. 1,
08 BINARY SYSTEMS cH
EXAMPLE 1-2: Convert decimal 153 to octal. The required
base r is 8. First, 153 is divided by’8 to give an integer quotient of 19
and a remainder of 1. Then 19 is divided by 8 to give an integer
quotient of 2 and a remainder of 3. Finally, 2 is divided by 8 to give
a quotient of 0 and a remainder of 2, This process can be con-
veniently manipulated as follows:
Zi , 133
w} 1
2/3
o|2L-a,
The conversion of a decimal fraction to binary is accomplished by a method
similar to that used for integers, However, multiplication is used instead of
» division, and integers are accumulated instead of remainders. Again, the method is
best explained by example.
EXAMPLE 1-3: Convert (0.6875)j5 to binary. First, 0.6875 is
multiplied by 2 to give an integer and a fraction. The new fraction is
multiplied by 2 to give a new integer and a new fraction. This
process is continued until the fraction becomes 0 or until the number
of digits have sufficient accuracy. The coefficients of the binary
number are obtained from the integers as follows:
integer fraction ‘coefficient
0.6875 X2 = t + 03750
‘UIOXI= 0 + 0750 a HO
0.7500 X 2 = t + 0500 a.y,=1
0500x2—= 1 + 0000 a,=1
answer: (0.6875)jo = (0.a_a-74-s0-,)y = (0.1011),
To convert a decimal fraction to a number expressed in base r, a similar
procedure is used. Multiplication is by r instead of 2, and the coefficients found
from the integers may range in value from 0 to r — 1 instead of 0 and 1.
EXAMPLE 1-4: Convert (0.513)jp to octal.
“0.513 x 8 = 4.104
0.104 x 8 = 0.832
0.832 x 8 = 6.656
0.656 x 8 = 5.248
0.248 x 8 = 1.984
0.984 x 8 = 7.872‘SEC. 1-4 OCTAL AND HEXADECIMAL NUMBERS 9
‘The answer, to seven significant figures, is obtained from the integer
part of the products:
(0.513)yo'= (0.406517.
‘The canversion of decimal numbers with both integer and fraction parts is
done by converting the integer and fraction separately and then combining the two
answers together. Using the results of Examples 1-1 and 1-3, we obtain:
(41.6875)y0 = (101001.1011),
From Examples 1-2 and 1-4, we have:
(153.513) 9 = (231.406517)s
1-4 OCTAL AND HEXADECIMAL NUMBERS
‘The conversion from and to binary, octal, and hexadecimal plays an important part
in digital computers. Since 2° = 8 and 2*= 16, each octal digit corresponds to
three binary digits and each hexadecimal digit corresponds to four binary digits.
The conversion from binary to octal is easily accomplished by partitioning the
binary number into groups of three digits each, starting from the binary point and
proceeding to the left and to the right. The corresponding octal digit is then
assigned to'cach group. The following example illustrates the procedure:
(20, 10, $0), 401, OU = LU, 100, 00, 110, ), = Q6153.7405,
26-1 53 7-4 0 6
Conversion from binary to hexadecimal is similar, éxcept that the binary number is
divided into groups of four digits:
(2, oq Ug. JOU) = JY 8, = COB Ng
2 C 6 B Fo2
‘The corresponding hexadecimal (or octal) digit for each group of binary digits is
easily remembered after studying the values listed in Table 1-1.
+ “Conversion from octal or hexadecimal to binary is done by a procedure
reverse to the above. Each octal digit is converted to its’ three-digit binary equi
alent. Similarly, each hexadecimal digit is converted to its four-digit binary equiv-
alent. This is illustrated in the following examples:
(673.124), = (0, JH, Ol, + 001, 010 100, ),
1 4
. 6
(206. Dhs=( 01), 0009 LI = 1101,
: 3 0 6 D10 BIRARY SYSTENS ou
Binary numbers are dificult to work with because they require three or four
times as many digits as their decimal equivalent, For example, the binary number
HIIMIITIITLL is equivalent to decimal 4095. However, digital computers use
binary numbers and it is sometimes necessary for the human operator or user to
communicate directly with the machine by means of binary numbers.°One scheme
that retains the binary system in the computer but reduces the number of digits the
human must consider utilizes the relationship between the binary number system
nd the octal or hexadecimal system. By this method, the human thinks in terms of
‘octal or hexadecimal numbers and performs the required conversion by inspection
when direct communication with the machine is necessary. Thus the binary num-
ber IIIIIILIIIT1 has 12 digits and is expressed in octal as 7777 (four digits) or in
hexadecimal as FFF (three digits), During communication betiveen people (about
binary numbers in the computer), the octal or hexadecimal representation is more
desirable because it can be expressed more compactly with a third or a quarter of
the number of digits required for the equivalent binary number, When the human
communicates with the machine (through console switches or indicator lights or by
means of programs written in machine language), the conversion from octal or
hexadecimal to binary and vice versa is done by inspection by the human user.
1-5 COMPLEMENTS
Complements are used in digital computers for simplifying the subtraction opera~
tion and for logical manipulations. There are two types of complements for each
base-r system: (1) the r's complement and (2) the (r ~ 1)'s complement, When the
value of the base is substituted, the two types receive the names 2’s and I's
complement for binary numbers, or 10's and 9's complement for decimal numbers.
The ’s Complement
Given a positive number N in base r with an integer part of n digits, the r's
complement of NV is defined as r” ~ N for N #0 and 0 for N’ = 0. The following
numerical example will help clarify the definition,
The 10's complement of (52520). is 10° ~ 52520 = 47480,
The number of digits in the number is n = 5,
The 10's complement of (0:3267)y is 1 ~ 0.3267 = 0.6733,
No integer part, so 10" = 10° = 1.
The 10's complement of (25.639), is 10 — 25,639 = 74.361,
The 2s complement of (10110) i 2 ~ (101100); = (1000000 — 101100),
The 2's complement of (0.0110), is (1 - 0.0110), = 0.1010,SEC. 1-5 COMPLEMENTS —1f
From the definition and the examples, it is clear that the 10's complement of
a decimal number can be formed by leaving all least significant zeros unchanged,
subtracting the first nonzero east significant digit from 10, and then subtracting all
other higher significant digits from 9. The 2’s complement can be formed by
leaving all least significant zeros and the first‘nonzero digit unchanged, and then
replacing I's by 0's and 0's by-I’s in all other higher significant digits. A third,
simpler method for obtaining the r’s complement is given after the definition of the
(x — 1)'s complement.
The r's complement of a number exists for any base r (r greater than but not
‘equal to 1) and may be obtained from the definition given above. The examples
"listed here use numbers with r = 10 (decimal) and r = 2 (binary) because these are
the two bases of most interest to us. The name of the complement is related to the
ase of the number used, For example, the (r ~ 1)'s complement of a number in
base 11 is named the 10's complement, since r — 1 = 10 for r = 11.
The (r— 1)'s Complement
Given a positive number Nin base r with an integer part of n digits and a fraction
part of m digits, the (r - 1)'s complement of I is defined as r” — r~™ — N. Some
numerical examples follow:
The 9's complement of (52520)jo is (10°
47479, :
No fraction part, so 10-" = 10° = 1 ‘
The 9's complement of (0,3267)1q is (1 — 10-* 0.3267) = 0.9999 - 0.3267
1732.
= 0.6
52520) = 99999 — 52520 =
No integer part, so 10" = 10° = 1.
The 9's complement of (25.639), is (10? ~ 10-> ~ 25,639) = 99.999 — 25.639
= 74360.
The 1's complement of (101100), is (2° — 1) — (101100) = (111111 -
101100), = 010011.
The I's complement of (0.0110); is (1 —2~*)yy - (0.0110), = (0.1111 -
0.0110), = 0.1001.
From the examples, we see that the 9's complement of a decimal number is
formed simply by subtracting every digit from 9. The I's complement of a
number is even simpler to form: the I's are changed to 0's and. the 0's to I's. Since
the (r — 1)'s complement is very easily obtained, it-is sometimes convenient to use
it when the r's complement is desired, From the definitions and from a comparison
of the results obtained in the examples, it follows that the r’s complement can be
obtained from thé (r ~ 1)'s complement after the addition of r~" to the least12 BINARY SYSTEMS cH
significant digit. For example, the 2's complement of 10110100 is obtained from
the I's complement 01001011 by adding 1 to give 01001100.
It is worth mentioning that the complement of the complement restores the
number to its original value. The r’s complement of Wis r" — NV and the comple-
ment of (r* — N) is r* — (r" = N) = N; and similarly for the I's complement.
Subtraction with ’'s Complements
‘The direct method of subtraction taught in elementary schools uses the: borrow-
~ concept. In this method, we borrow a I from a higher significant position when the
minuend digit is smaller than the corresponding subtrahend digit. This seems to be
casiest when people perform subtraction with paper-and pencil. When subtraction
is implemented by means of digital components, this method is found to be less
efficient than the method that uses complements and addition as stated below.
‘The subtraction of two positive numbers (M — NV), both of base r, may be
done as follows:
1, Add the minuend M to the r’s complement of the subtrahend N..
2. Inspect the result obtained in siep 1 for an end carry:
(a) If an end carry occurs, discard it.
(b) If an end carry does not occur, take the r’s complement of the number
obtained in step 1 and place a negative sign in front.
The following examples illustrate'the procedure:
EXAMPLE 1-5: Using 10's complement, subtract 72532 —
3250.
M = 72532 72532
N = 03250
+
10's complement of N = 96750 96750
end carry» 169282
answer: 69282 .
EXAMPLE 1-6: Subtract: (3250 ~ 72532),
M = 03250 03250
N = 72532
. +
10's complement of N = 27468 27468
; no carry 30718
answer: ~69282 = — (10's complement of 30718)SEC.1-5 COMPLEMENTS 19
EXAMPLE 1-7; Use 2's complement to perform M — N with
the given binary numbers.
(a) M = 1010100 1010100
N= 1000100
+
2's complement of N = 0111100 o11ti00
end carry» 1 “0010000
answer: 10000
© M = 1000100 1000100
N = 1010100
+
2's complement of N = 0101100 0101100
nocarry _/1110000
answer: ~ 10000 = ~ (2's complement of 1110000) SL
The proof of the procedure is: The addition of M to the r’s complement of N |
gives (M + r — N). For numbers having an integer part of n digits, r* is equal to
al in the (nm + 1)th position (what has been called the “end carry"). Since both M
and N are assumed to be positive, then:
(a) (M4r"-N)>r* ifM>N, oF
(0) (M4r"—N)