You are on page 1of 35

: Chapter 1

,':Olgltal System$ and' Binary Numbers


DIGITAL SYSTEMS
Digitalsysteins have .such a prominent role in everyday life that we refer tot,pe present tech
nological poriod as the digital age. 'Digital systems are used in business trans..:
actions, traffic control. space guidance, mical't1'eIitirient, weather monitoring. the Internet, and
many other commercial. industrial. and scientific enterprises. Wihave digitat telephones"dig
ital television. digital vel:satile discs. digital cameras, handheld cOurse, digi
'. tal computers. The most striking prciperty ofthe digital computer is its generality. It can follow
asequence of instrllctions, called a program, that operates on given da,ta.The user can specify
andcbange the program or the data according to the specific need..Because of thisfiexibility,
digital coniputers can perform a variety of information-processing, tasks that
,range over a Wide spectrUm o(applications. . , ' ,', .
One characteristic of digital systems is their ability'to represent and manipulate discrete el
ements of information. Any set lhat is restricted to a finite numbei' of elements contains dis
. crete information. Exmq>les of discrete sets are the 10 deeimaldigits, the 26lettets ofthe'
alphabet. the 52 playing cards. and the 64 squares of a cheSSboard.' Early digital computers .
, were used for numeric computations. In this case. the discrete elements were the digits. From
this application, the term digital computer emerged. Discrete elements of infonnation are rep
resented in a digital system by physical quan#ties.called signals.. Electrical signals such as
voltilgesand currents are the most commort. Electronic devices called transistors predominate '
. in the circUitry that implements these. signals. The.signals in most electronic dig
ital systems use just tWQ diScrete values aDd are. therefore said to binary. A binary digit,'
called a bit, has two values:.O and 1. Discrete elements of information are repreSented with
groups of bits called binary .colks. For example. the decimal digits 0 through 9 are repre,sented
in a digital system with a of f()ur bits (e.g., the number 7 is represented by. 0111).
. -"
1
2 Chapter 1 Drgital Systems and Numbers
ThrouJb various techniques, groups of bits can made to represent discrete symbols, wbicb
aretilen to develop the in a digitAl fonnat. Thus, a digital. system isi! systemtbat
manipul8.lescijacrete of Inhinary form. ','. .
D:i$cretequantities of information either eilierge frOrri the nature of' the data being processed
or'inau' be qu&nl:ized from a continuous process. On the one hand, a payroll scbedule iun in
herently discrete process that contains employee names, social security numbers, weekly'
salaries, income taxes, and so' on. An employee's paycheck is processed by means ofdiscrete
data values such as letters of the alphfJbet digits (slilary), and special symbols (such
as $). On die other hand,a research scientist may observe a .continuous process,' but record
only specific quantities in tabUlar fonn. The'scientist is thus quantizing continuous data, mak
ing each number iithis or herta,Qlea discrete quantity. In many cases, the quantization ofa
process can be performed automatically by an
The digital computer is the best-known example of a digital system. The ' '
major parts ola computer are a memory unit, a central processing unit, and, input..:.output
The memory unit stores programs as well as input. output. and,intermediate data. central
processing unit performs arithmetic and other as specified by the
program. The program .and data prepared by a user arefranSferred into memory by means of
an input device such as a keyboard. An output device, such as a printer, receives the results of
the computations, and the printed results are presentedto the user: A digital computer canac
commodate many input and output devices. One very: uSeful device is a oonuiiunication unit
that provides interaction with Qther users through the lnterne,t. A digital computer is a power
ful instrument tha.t canperfonn nOt onlyarlthmetic computations, but also.logical operatiQns!
In addition, it be to makedeci!ot1s b,llsedon internal and cOndipons..
are fbndalDental reasons thatcommereialproducts are made with digital circuits.
Like I diSital compUter! mostwgibU progralnmable. By chimging the program in
i a programmable device. the same underlying hardware can beuSl for many different appli
cations.Dramatic cost reductions in digital devices have come. about because of advances ,
, digital integrated circuit thnology. As the number of fransistorsthat can be put on a piece .
silicon increases, to produce complex functions, the cost per unit decreases and digital devices
can bcj, b9ught at an increasingly reduced price. Equipment built with digital integrated
cuits Clm pCnorm at a speed ofmillions of operations pet second, Digital systems.
can to operate with extreme ,reliability,byusingerror..correcting codes. An '. ' .
ofthis stIlltegy is the digital versatile di.sk (DVD) .in which digital in(ormation repJreSe,ntiJilg
video, audio. 8n4 other data is recorded withoQt the loss ofa single item.' Digital iru(}nnati(J,n'
, oJiaDVD, isrecot:ded in such a way that. by examining the cOCte in each digital sample
it is played back, any error can be automaticaHy identified and corrected.
Adigital of d,igitalmoduies. understand the operation
eacb digital module. it is necessary to liave a basic knowledge:of digital circuits and
fifstse,ven of this book present the digital design,
as logic gate str\lCtUl'es, Combinational and Seq1iendal circuits. and programmable logiC ....VI........
Chapter 8 introduces digital design. at,the register le,,:el (RTL). 9 and 10
:.vitbasyDchronous sequeriti8t cin;l.Uts various integnrted ..... ...!
'II and 12mtrOdijce cOlllDlemal in.tegratedClrcuitsandshow how they can be connected
labqratory to perform experiments with digital circuits.' " . .
3 Section 1.2 Binary Numbers
A major trend in digital design methodology is the use. ofa hardware description language
(HDL) to simulate the function8llty ofa digital cin:uit. AnHDL resembles a pro
gramming language and is suitable for describing digital circuits iDtextual fOrin. It is used to .
simulate a digital system to verify its operation before bardwlU'e is built in. It is also used in
conjunction with logic synthesis tools to automate the design PrQCesS. Because it is . important
that students familiar with an HDL-baseddesign methodology, HDLdescriptions of
digital circuits arepiesented iliroughdut the book. While these examples help illustrate the fea
tures ofan HDL, they.also demonstrate the best practices used by industry to exploilHDLs.
Ignorance of these practic;es will lead to cute, but worthless;HDL models that may simulate a
phenomenon, but that be synthesized by design tools, or to models that waste silicon
area or synthesiZe to hardware that cannot operate correCtly. . .'
AB prevjously digital systems Qlanipulate discrete qllantities of information that are
represented in binary form: Operands used for calcU1{1.tions may bJ: e.ltpressed in the binary
number system. Other discrete elements, including the decimal digits, are represented in binary
codes. Digital circuits, also referred to as logic circUits, data by means of binary logic
elements (logic gates)using binary signals: Quantities are stored il1 binary (two-valued) stor-.
age elements The purpOse ofthis chapter islo introduce the various binary
cepts as a frame of'rcference'forfurther study in the succeeding chapters.
, , ' ''-,', ,
A decimal number such as 7,392 represents a quantity equal to 7 thousaads,plu8 3 bun<:lrs,
plUl 9 tens, plus 2 units; The thousands. bundred$, etc., are. powers of Hlirnplied by the posi.
tion Ofthe coefficients in the number. To be. moree'ltact, 1,392 is ashtmhai1d notation for what
should Dewrinen as '. .
. 7 x 10f+ 3' x 1Q2 + 9 X 10
1
+ .2 x 1O?
However, tqe convention is to write only the coefficients and, fromdJeitpoSltiori, deduce the
necessary powers 000. In general, a number with a decimal point is by a series
of coefficients: .. . . ..
.'
a504a3a2af'aO' a_I a-20-3
,'. "
The coe:(ficients aj.areanyofthe 10 (0,1,2. 9),andthe.$ubscript valuej gives the
place value and-hence. the power of 10 by which the coefficient be multiplied. ttte
preceding decimal number cltn be expressed as ..
lo5a5 + 10
4
a4 + 103a3 + + 10
I
ai + 1000 + + + 1O-
3
a_3 .
,.
The decimal nQmber systeirt to be of basf!. -or radix., 1Qbecause it uses ,1 0 digits and
ttiecOefficients are multiplied by powers of 10. The bin.arysystemis a differentoumber sys
tem. The coefficients ofthe binary number possible values: 0and 1.
.Each coefficient by,2
i
, and results are adQed.to tbc;decimalequiv
'. alent of the number. The radix pUint . the decin,w.poitlt when lOisth,erlWix) distinguishes
positive powers of10 frof{l negative powers of 10. For the <kclmlil equivalent of the
, '--. - . ' '. - - -,' .. - -',.
4 1 Digital. Systems and,Blnary Numbers
binary number 11010.11 is 26.75; as shown from the multiplication ofthe coefficients by pow
ersoH:
.1 X.24'+1 XZ
3
+0 x2
2
+ 1 X 21 + 0 X2 +1 xr
i
+ 1 X r
2
=
In general, a number expressed in base-r systeIri has. coefficients by powers of r:
,
an'r
n
+ a
n
-l ,:,,71-1 + ... +a2.,,2 .+ al'r +06 + a-I "'r-
1
.
+ + ... + q_m'r-m
The aj range ip. value from 0 .to" 1. To. distinguish between numbers of differ
,ent bases.:we enclose the coefficients in parentheses and \V:rite asubscripteqOal to .the base used
fot decimal nwnl:!ers, where the content makes it obvious that the base is
decimal). An example ofa'base:S numl.>eris '. '. . .'
. (4021.2)s 4X.s
3
-:I- 0 XS2+ 2;; 5
1
+ IX 5 + 2 X ,5-
1
== {511.4ho
. .
The cOefficient values for base 5 can be only 0, I, 2, 3, and 4. The octal mllnber system is a .'
base-8 system that has eight 0, 1,2,3,4, .5, 6. An example of an octal number is
127.4. To determine its equivalent decimal value, we expand the nlim'6er in apower series wit,b
a base of8: . ' ,. .
'(127.4)8 = 1 X 8
2
+ 2x 8
1
+ 7X SO,+4 x g-l=:=,(S7.5)lO
Note that the digits 8 and 9 cannot appearin an 'oCtal n'umber.;
Itis customary to borrow the needed " digits for.the coefficients from tlle decimal system
.when the base of thenmnber less than lO. The letters ofthe alphabet /;\reused.to supplement'
the 10 decimal digits when base of the number is 10. For. example, in:the
hexadecimal(base-16) number system,the fIrst 10 digits are borrowed fro1ll the decimaJ sys
tem. letters A, E. and F. are used for thedigits 10, n, .12, 13. 14, and 15, .
tively. An ex,ampICf ,ofa hexadecimar number is
(B65Fh6 = 11 X 16
3
+ '6>X 16
2
+ 5X 16
1
-+ 15 X 16
As noted before, the digits in lJ. binary number are called bits. When a bit is equal to 0, it does
. not contribute to the sum during the conversion. Therefore, the conversion from binary to dec
imal can be obtained by addingonly the numbers With powers'ofctwo cotreSpOnding to the bits
that are equal to l.Forexample, . . . ,
(1l0101h = 32+ 16 +4+ 1 = {53)10
There are jour l's. in the binw;y number. The decimal number is the sum of
the four powers of two. The. first 24 numbers. obtaiJ,ted from 2 to ,power of n are listed in
Table 1:1. In computerwork; 2
10
is referred to as K (kilo), 2
20
as M (mega), 2
30
asG (giga),
and 2
40
as T (tera).Thus. 4K = 212 :::: 4,096 'and 16M :::;2
24
= 16,777.216: Computer ca
is us1ial1y given inbyte$. A byte is equal to eight biis arid call (i.e., repre
sent the code of) onekeyboard character. A computer hard disk with four gigab'ytes'of storage
.' has a capacity of 4G = 2
32
brtes (approximately 4 billion bytes). '. '. .
.. Section 1.3 S
Table 1.1 .
Powers of Two
'..
n: 1!' n Z'" n .Z"
,
0 1 8 256 16 65,536
1
:,2;
9
512' .
17 131,072
2 4 10 1,024 18 262,144
3
&
11. 2,048 f9 , 524,288
4 16
12 .
4,096 '20 1,048,516
.5 32 13 ,8,192 . 21 2,097,152
6 64 14 1(i,3&4 22 4,194,304
7 128 15, 32,768 23 8,388;608'
, . Arithmetic operations with numbers in base; followtht same rules as for decimal nun1- .
hers. When a base othef than the fariilliar base 10 is used. one must becarefuho use only the
,-allowable of subtraction. and multipliCation oftwo binary num
bers are asfoUows; . . , " .: .... ' ...., ..' .' '. ".
,
augend: 101101 nlinuend: 101101 multiplicand: . 1011
addend: +100111 . subtrahend:. -tOOtH' multiplier: X.IOI
sum: 1010100 . difference: 000110' ,1011
. 0000
1011
,product: . HOli!
The sum oftwo binaiy numbers is calculated bY' the rules as in decimal, except that
the digits ofthe sum ifl any sigiuficaOt position can be oDly 0 or 1. Any carry obtained in agiven
significant position is 'uSed by the pair of digits one significantp<)sition higher. Subtraction is
slightly more complicated. Tho rules are still the lis ip. declmal.excep,t that the bonow in
a given signifieantposition adds '2 toa minuend digit. (A bonoW in the'deeimaI adds
10 to a minUend digit.) Multiplication is simpIe:'fhe mo1\iplier digits are 8lW'aYs l' or 0; there.
fore, the Partial produCts are either to the multiplicand Or la' O.
in ': in a power
, ' series and adding all the terixlsasshown previOU$ly. We nowptese
l1
u generij procedure for
the reverse operation of anum1>el in hasedf'the number in
cludes a radix point, it is necessary to separate a fraction
part. since each part be converte4 diffqeptly. The conversion ofadecimalinteger to a num-:
berin basO risdont by t;lividing.the humber SAd all by:, .
ing This procedure is best illustrated by example. . .... .... .
6 Chapter 1 DigitatSy$tems and BInary Numbers
11'*'1'4"'11 '. "
. Convert deciIIla14 r to binary. First, 41 is divided by 2 to ..live an integer quotient of 20: and a
"remainder 'of i Then the:quoiientis.a.gam. divided by :2 to give. a.newquotient and remainder ..
Theproeess is integer quotient bec:;omes O. The Cf)eJJicients of the desired .
binary number' are obtained fJ:Om the remainders as follows:
Ioteger
Quotient Remainder' Coeflldent
.4112= 20 +
!
ah.=
1
"
,2012 ;::;
10 +
0 at= 0
1012 =:
5 + 0 a2= 0
512 = 2
+
1
a3 = 1
1:
Z/2;:::: 1 ,0
+ G4'=O
I'
112= 0 +
'2
.as =1
, ,;< ':' " '
Therefore, the aDsWeris(41 )u).= =(IOlOOlh, . .'
The arithmetic proCess can be manipUlated moreconvemently as follOws:
\ . . , . .
Integer
41
20
10
5
2
1
o
Relnamder
1
o
o
1
o
,
. 1 101001 ==answer
from decimal:integeJ;S to lQ1ybase-r S;stem similar totljis ex.ample, except that,
. division is done by r iil$teadof2. . . . . '.' .
1I1t41'9','1I
Convert decimall5lto oCtal. The required baSe r is a.First, 153 is by 8 tQ.l1ve anin-.
tegerquotient of 19 and. a remainder of l.Then 19 is divided by 8 to give an
. of 2 anli a remainder of 3.
t
Fin,,"y, 2 is divided by 8to give aquotientof 0 and a remainder of
.2. 'lbisproeess can be conveniently manipulatecfas follows:, . ,
153 .
. 19 J .
'i \.3
o 2'= '(23J)s
7 " Section,1.3 Number-Base Conversions
. l'he(:OllVel'SiOllQC"'decimalfrm:t;onto binary js accompllshedby a similar to tbai
uscd for multiplication is used instead of division, and integers instead 'of
. are the method is best explajned by example,

, . (0.6875hotobmary.First, 0.6875 multiplied by2 to give an integer and ajraction.
nen the new fraction is multiplied by 2 ,to give a new integer and a new. fraction. The process
is continued until the fraction 0 or until the nUJ1lber of digits have sufficient accuracy.
necoefficients oftb.ebinary, nUlllber;are integers asfQUows: . .
. lnteger Fraction Coemclent
" ,i +
0.3750
a-I
= 1
,(),37SO
f
(2 . 0'
+
0.7500 g-2'= 0'
'. 0.7500"X;2= 1,
+ 0.5000 D-3
.,.,-
1
- "
0-.5000 X 2 == ,I
.+ ..
0,0000
. J
. ,'. ) . -'
Therefore/the at)Swer is (O.6875ho= (O.D-la,:"zQ-3D,-4h= {0.10l1,h,
.To convert adtcimal fractl.9D to a number expressed in base 1; a-similar procedure isused .
.HQwever, multiPlication by 1: instead all, and the coefficlentsfound from the integers may
'range iti value from 0 to r-,. 1 lI)stead of 0 and 1. .' . ' .
, , ,.- "!. ,.- -_., t 1',,, :' .. , ,"! ' "
. '

O.513X. 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
The to seven significant figures, is obtained from. the integer part onhe products:
"(O.'sP)IO= (0.406517;")8
8 Chapter 1 Digital Systems iilnd Binary Numbers
, 'I'bo oonversion ofdecimalnumbers withbotMnteger and ftattionparts is done by con- '
verting,the integer and the fraction separately and ihencombinihg,the two answers. Using the
re$Ults of Examples 1.1 and we.obtain, ' '. ,
:;::(lOI001.l011h
From Examples 1.2 and 1.4,,.e have
(153.513}}0 :;::(231.4tl6517)s
1.4 OCTAL AND HEXADEC.IMAL NUMBE'RS
The conversion frOm and to binary. octal, and bexadecimal plays an important role in digital
com.puters. Since 2
3
:::=.8 and 2
4
, = , 16, each, octal digit corresponds to thref: binary digits and,
each hexadecimal digit corresponds to foUr binary digits. The first 16 numbers in the decimal,
binary. oct8.r, systems are listed in Table 1-2. '"
The comersion binary to.octal is easilyac<;ooiplishedby the binary num..
ber into groups oftbree digits each, starting ti()n1 the binary plmt and proceeding to the left
I , and to ,the right. octal d,igit is then assigned. to each group. The following
example illustrates the proeedure: " "
(10, 110 001' 101 011 100 000 lloh, = (26153.7406)8
2 6 1 3 , 7 4 , 0 '6
T_lel.2
,Numbers with Different -Baus
"
, ,
DecImal ......IY Octal Hexadecimal
(base 10) (base 2) (b....) (.,..16)
i
00 0000 00
"
;p
01 0001 01 1
02
0010,
02 2
03 0011 03 3
04 0100 04 4
0;;
0101 OS 5
06 0110 06 6
07 0111 07 7
.08 1000 10 8
09 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100. 14 C
13 1101 IS ,D,
14 1110 16

,E
j,
IS' 1111 11 F
','; r i., .
9 section 1.S Complements.
Conversion from binary to heu.deciInal is similar. except thatthe binary nutriber is divided into .
groups of/ourdigits:
(10 1100 0110 1011 1111 0010h = (2C6BJ?2) 16
2 C 6 B . P' 2
The com:sponding fOr each group of binary digits is easily re
membeled from the values listed in Table 1.2. . . .
Conversion from octal or hexadeciInal to J:;linary is dOne by reversing the preceding proce
(lure; Each octal digit is converted to its tbi-ee-digit binary equivalent. Similarly,each hexa
decimal digit is convertedioits procedure is illustrated in
the following examples: .
(673.124)8= (110
6
III 011
7 .3,
001
.
010
2
l00h
4
and
'(306.Dh6 = (OOlf .. 00000
30.
110
6
.
D
Binary numbers are difficUlt to work with because they require three or fout times as many
digits as their decimal equivaltmts. Por exaniple, the binary number 111111111111is equivalent
to decimal409S. However,.digital computers use biIUuy11UIhbers. and itis soIIJ.et4nes necessary
for the human operator or user to oonununicatedirectly With the machine by means of such num,.
bers. One scheme that in the cotnputer; but reduceS the number of dig
its the human must cOnsider, utilizes the relationslripbet\yeen the binary .Ilumber system and the
or hexadeciinal system. By this method, the Q}l1D.aIlthinksin tenns ofQCtal ornexadecimal
n.urnbers and performs the required conversion by inspection when direct communication with .
the machine is necessary. Thus, thebinary number 111111111111 has 12 digits is,expressed
iIi octal 7777 (4 digits) or in hexadecimal as FFF (3digits), During communication between
people(about binary numbers in the coJlll}Qter),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 eqwvalent binary number. Thus,mpstcomputer manuals use either octal
hexadecimal numbers to specify The choice between diem is arbitrary,
although hexadecimal tends to win out, since it can represent a byte with. two digits.
PlEM ENTS
.Complements are used in digital cOmputers to simplifydle subtraction operation and for log
ical manipulation. Simplifying operations leads to simpler, less expensive circuil$ to implement
the operations. There are two types of complements for each baSe-r system: the radix com
plement and.the diminished raclix cOt;llplement .Theflrst is referred to as the rts complement
and the second as the (r - 1)'scomplement. When the value of the base r is the
name, the .twotypesare refefted to as the 2's complement and 1 'scomplement fot binary num
and the and 9's complement fqrdecimal numbers.
10 . Digital Systems and Binary Numbers
... Radix
a number N in base' r haYing n digits. the (r - 1)'scomplement N is defined as
,(r
ll
- 1) -= Wandr -.'1:;:: 9,sothe9'scomplementofNis
(10" - 1) - N. IIi this 10" represents a number that consists of a single 1 followed by .
nO's. 10" - lisartumberrepresentedbyn9's.FOrexample,ifn :;:: 4,wehavel0
4
= 10,000
and 10
4
-. 1 = 9999. It follows that the.9's complement ofa decimaJ:number is obt:ained by
subtracting each digit from 9. Here are some nwnericalexamples:.
The 9's complement of 546700':;:: 453299 .
,', ,'- ""'" I' ,
The 9'scothplement =987601.
For binary p.umbers, r =2 and r - 1,. sothe 1's complementofNis(Z: - 1) - N.
Again. 211 is represented by a binaty number thatconsistsof
a
1followed byIi0's. 211 - 1 is
abinary number represented by example, if 11= 4, we have :z4 = (10000)zand
24 - 1 '!= (1111h. Thus, .the l's complement of a binary number is obtained by sUbtractiDg
'each from 1. However, when subtracting binary digits. from 1, we can have either
I -0= l'or1 - 1 = 0; which causestbe bit to change from Oto 1 0(' from 1 to 0, respec- .
tively. Theretore, the l's complement 'of a binary number isfonnedby changing 1's to O'sand .
O'sto 1's. The f9llowi
ll
g are somenumqical .... .
. .' ,,".
, .
The l's Complement of 1011000 isotOOiu.
The 1 oHlIOUOI is 10 tOOl O.
'. The (r-l)'s ofoctal or numbers by subtracting
.eaeh digit from 70rF (diicimallS,), . . .

The ,'s complement of an number N in baserisdefined.asr"...:. Nfot N i: 0 and as
ofor N = Comparing with the (r- l)'s we notethat complement is
obtained by adding Ito the (r - l)'scomplement; smce'r" '.:.- N= H,A-:- 1) -. N] ,:. L .
'l'hus, the lO'sco,mplementof deein1al2389 is 76lO .+1 = 7611 and is ot:ltamed by adding 1
to the 9's,;complernent value. The 2's oomplementofbinary 1011oo:is 010011 ,"'" 1 =010100
and is'obtained by adding 1 to the l's-complement value. .
Since 10 is a number represented by a 1 followed by n0's:10
11
...;. N, Whicb is t:he10'S
plementof N, can be also by leaving allieasl sigtrlficani O's Unchanged.. .
. the first nonurO least significant digit from 10, and SUb!r8Cting all higher significant
from9. ThUs,' . . '. .
the 10's complement of 012398js987602
and
11 Sectlon 1.5' Complements
The 10's complement ofthefustnumber isobtaine<ibysublriiCting'Sfro.m lOin the least
nificant position and subtracting all other digits from The 10's complement of the second
number is obtained by leaving the t\!o least significant O's unchanged, subtracting 7 from 10,
and subtracting the other three digits from 9. .. .' . . .
Similarly. the 2's complement be fonned by leaving 1,ll11east significant O's and t:be first ' .
1 unchanged and replacing I 'swith O's and O's with l's in allother signifIcJUlt digits.
For example, ,
the 2's cORlplement of 1101100 is 0010100
,'and
the 2'scomplement ofOllOllHs 1001001
_ ,.:.-, ". r "
The. +'s complement pf therrrst nJUDber obt4iriedby least significant O's and
'the first 1 unchanged andlQen replacing l's with O's and O'swith inthe other four most sig
nificant digits. The 2's l'X>mplement qf the second number is obtained byleaving the least sig
nificantl unchanged and (fOmplementing all other digits. '.. , . /
In the previous definitions, it was the did not have a radix pomt.1f
the original number Noontains a radix point, the point should be removed temporarily in order .
to form .the ,'s or(r ,... 1)'s complement. The radix point is then restored to the c9ll1plement
ednumber in the same relative Position.Ilis abo w.Orth mentioning thatfhecontplement oftbe
complement restores.the number to its original v41ue. To see this the 't's
complement of N 'is ,n - N, so that the complement oft1\e complement is
,n - (,n - N) == N and is <lqual to the original number.
Mr8Ctiton wltl1 Complements,
. 1}le direct metb()jiofsubtraCtion taught in elexnentaty schpOls uses the bottow concept. In this
QlCth9d.webortowa I from, a higher significant position when the minuend digit is smaller
'than the subtrahend digit. The tD.ethod wen when peOple perfonnsubtraction with paper
. andpeooil.lIowever, when subtlaction is implemented with.digi1;al bardw8l'e, the method is less
than the method that ..
The subtraction of two n-digitunSigneq numbers M .,.. N in base ,can be done as fonows;
I . '
. '1. Add the minuend M to the of the.subtr&hend N. Mathematically,
M+ (,n ..:; N) = M N + ,". '," . ... .
2. If M 'N, tt:ie sum wiUproduce an end cu:ry ;'11., which caD be . discarded; what is left is
the result.M N. .
3. If M < N, the sum does not produce carry JUld iseijUattor",:" Ji).
which is the ,'s complement of (N - M). To obtain the answer in a familiar form. take
the ,'s complement of the sum ,aruI. place a negative sign in frorit. .
12 Chapter 1 Digital Syst-ems and Binary
The following examples illustrate the procedure:
.'pl'Pi"1I
VsinglO's complement, subtract 72532 -
M =, 72532
lO's complement of N "" + 96750
Sum::= 169282
Discard end caIry lOS ::= -100000
Answer ::= 69282
Note that M bas digits andN has only fourdigits:Both numbers mtast have the same num
ber of digits, sowe wrlteN as 03250. Taking the a9 in the most
significant Position.' The occurrence of the end carry signifies that M N 8ndtlult result
'is therefore positive;;, " " '
Ulling 10's complement, subtract 3250 ,- 72532.
. - .
M = 03250
JO'scornplementof N =+27468
Sum=
There is' no end carry. Theref()re,-theanswer is-'-(10'& complementof30718) == -69282:
Note that.since 3250 < result is negative. Becau. we are dealing with WUi:igned
numbers. there is really no way to get BnunSigned result for this case. When subtracting
complements. we reoogilize the neg.!l.tive answer from of. the end carry and
complemented result. When working'with paper and ,pencil, we c8nchlnp the aDswer
, signed negative number in oi'der to putH ina.familiar form.
Subtraction with complements is done with binary numbers in a similar manner, u,ing
procedure outlined previously. , '
EXAMPLE 1.7
Given the two binary numbersX = 1010100 and Y =;1000011, performtbe ,$UbiDctiG!
(8) X - Y arid (b) Y - Xby using ! " '. - "
f" ,
-"" -,
"Section ,1.5,Complements 13
(a) , x = 1010100'
2's complement ofY= +-0111101
. Sum = 10010001
:Discard end carry 27 =:..; 10000000
X- Y = , 0010001
(b)
Y == 1000011
of X = + '0101100
Sum= 1101111 .
There is nQend carry. Therefore, the answer is Y -(2'sq)mplement of 1101111) =
-0010001. "
.'
Subtractionof unsigned D1lJllbers also bed()neby' means of the (r - 1)'s complement.
Remember that the(r- l)'s complement is one lesstharither's complement. BeCause of
.'ibis, the result of adding the to tJte co.Qlplement of the it sum that
is one less than the correct 4ifference when an, end carrY oCcurs. Removing the end carry and
adding 1 to, the sum is referred to as, an end-around carry. '
. Repeat Example 1.7; but this time using rs complement.
(8) X'''' ,y = ,1010100 - 1000011
"X=' . 1010100
rs complementafY= + olfnoo'
'. Som = 10010000
=-
Answer. X .;.;.Y= 0010001
(b) Y - X = 1000011 -' 1010100
,
Y = 1000011
. 1's complement ofX = +0101011
Sum =" 1101110
There is no end carry. TherefOre, the answer is y. - X = -(1's complement of 1101110) =
-0010001. "

Note that the negative resultis by taltingtbe 1 'scomplemeilt of theJWlt.since this is
the type ofcoDiplementused. The proced:w:'ewithend;.aroundoan:yis aIs(> Iijlplic/lbleto sub
tracting Unsigned deciImdnumQers with 9'seomPlement,. .'. .
..
. '"
14, Chapter 1 Digital Systems'and Bina.,yNumbers '
1.6 SIGNED BINARYN'UMBER'$ ,
" " ','" ,,' ,
Positive'integers (including zero) CaB.,be 11$ unstPecl numbers. However, to rep
resent negative integers, we need a notation for negative ..s.rn ordinary arithmetic. a neg
ative number is indicated by a mulUs by aplus sign. Because of,
lJardware limitations, computers digits.It is customary
to represent the sign witb a bit placed inthe,leftmo'tp6sitiolwf'the number. The convention
is t<;l make the sign bit 0 for positive and 1 for negative. " ,', '
,Itis important to realize that botp siped and unsignedtDnary 11UJDbers consist of a strfug
of bits when represented in a TQeuser detem1ines.,;Wbether the number is signed or
unsigned. If the binary number is signed. then the lefuriostbitrepl'e$ellts t,htsign aud the rest
of the bits represent the number. If ,tO'be unsigned. then the left...
most bit is the most significant bit of the l)uMber; bits 01001 can be
considered,as 9 (unsigned b,inary) or as +9 (Sighedbitia1j) bit is O. The
" 'string ofbits 11001 represents the binary as an unsigned
number and the binary equivalent of ;....9whenconsidered'''1l This is because
the Ithal isintbe leftmost position,designates&C represent bi
nary 9. u,sually, tl}ere is no cotifusionin identifying Qfrepr:esentation for the
number is known in advance., "." ' , ", .' ,
, , ,'" " ' ,,' '
, The representation of the signed numbers in the lastexainple 'is referred to as the signed.
magnitutk coDvention. In this C4mSi&esOCa .
. or -) or a bit (0 or 1) indicating the sign. This is the representation used in.
ordinary arithmetic. When hii more .
convenient to use a different. system.refetred. t(>. as the for repre- .
senting negative numbers. In thissystl;m, a by its
Whereas the signed-magnitude system negates a nlllllher by cbanging its sign, me signed-com
plement system negatesanwn'ber by.ta.kin$ its. numbers always start
witb.O(plus}in tte leftmost pOsition, thecompktllint wiil.a,lwaysstart with a 1, indicating a
negative number. The siped-compleme!lt system can use olthertbe 1's Or the 2's '.
but the 2's complement is the . . . .
As an exa,mple,consider the in 'binary with eight bits. + 9 Is
sented with a sign bit of O.in the leftri1ostpOsition.. .the binary (equivalent of 9,
which gives ()()()olOOl. Note thai all eigbtbits must haY&a are inserted fol
lowing the sign bit:llp to the first 1. Although is only 01K\ way to tepresent +9, there
three different ways to represent ':"'9 with eight
. . . .
'. . . 10001001
sigried-l 's-complement : 11110110
signed-2' s-complemerit representatim:
',:1t'tltllU
, In signed.magnitu&, -9 isobwned from +9 by changing the sign bitmtbe leftmost
tromO to L In l'!roomplement, all the bits of
includinj the sign bit. is obt&Dedby
ihe 2's complement oftbepOsitivenumber,including,.tbesijn;bIt. .. ,
Sectlont.6 SIgned8lnary NumberS is
Table 1,3
Slgtlfd Biliary Humbm
+7
, +6
+5
+4
+3
+2
+l
+0
..;.0
-I
:'-2
, -3
...:4
-5
-6
-1
-8
Olll
'0110
0101'
( 0100 ,
001l
0010 '
0001
0000
IIll
, ", 1110
nOI,
noo, ,
Ion
1010
.1001
1000
OIll
Oito
eHOl
OHIO'
OOU
0010
0001
0000
1111 '
1110
dOl
1100
Ion
, ,lOti}
1001
1000
0111
OUO
0101
, 0100
0011
,0010
0001
0000
1000
1001
1010
IOU,
1100
,
1101,
1110
, lUI
Table 1,3 lists all possible four-bitsignedbinaryaumbers in the three representations.
The equivalent decimal number Is also shown for refel'enoe,Note that the positive
in all three representations are identicaland have 0 inthelef\mostpc;siticm. The signed",2's
onerepresentation for 0,. which is alway:s po$itive. The other .
tw()systetns- mlve either a positive 0 or a negative 0, sometbingnoteDcounteredin ordinary
arithmetic. Note that all negative, numbenhave a.lin the leftmost that is the
way we distinguish them from the positive'numbers. With fout bits, we can repreSent 16 binary
numbers. In the signed-magnitude aDd the'l's.:complement repre$eDtatipns. there are eight
positive numbers and eight negative numbers. inciUdingtwo zeros. In the2's-complement
representation; there are eight positive numbers. includi0a one zerQ, and eight negative
numberS.
, The siped-m_gnitude system is used in ordiI:lary arithmetic, but is awkward when em
ployed in computer arithmetie becauIe of the bandIinJ bfthe'sipand the magnitude.
Therefore, the signed-compiement systeni is normallyused. The l's imposes, some
difficulties .and is seldom USedJor arithmetic openitiOns. It is U$eful aSa operation,
since the change of 1 to O,br.() to 1 is equivalent,to a logical complement Operation, as will be
shown in the next .. The sigiled binary that fol10ws deals ex
clusively with the negadveilUlilbers. hsame pro
, cedurescan be.appJied to the sigMd. Iys. by inc:I.udiOI carry
as is done with unsigned numbers.
J6 1 OlgltalSystl!f(ns and, Binary Numbel"s .
Arithmetic Addition
The addition oftwo numbers in the signed-magnitude'!lYs_foUowsthe rules ofordinaiy arith
metiC: If we sum the CC?mmon sign.
Iftbe signs are we. subtract tllcsmaUermagnitude frOtnlthe larF and give the differ
ehtethe sign,ofthe larger magnitude. For example, (+25) +( - 37) = (37 - 25) = -12
and is done by subtrac;ung the smaller magnitude, 25, from the larger magnitude, 37,and
the sign of 37 tGtbe result. 'Ibis is a process that requires a corripanson of the
signs and magnitudes and then performing eith@r additi()n or subtraction: The same procedure
applieato binary numbers in sigped-magnitude the rule for
adding numbers in the does not require a comparison or ..
traction, but only addjtion. The procedure is very simple .andcanbe stated as follows for
binary numbers: . , ,
'The 8.ddltion oftwo signed binary numberS with negative numbers t;epresented in signed- "
2's:Comprement fonn is obtaiIled from the', additlooofthe two numbers, including,theii sign bits.
.AiirrY out oftbe sign-bitposition is diScacded.' . ,
, " 'N.umerIcal follow: .
+ 6 00000110 - 6 11UI0tO
.
I
. +13
00001101
..
+13 00001101
+19 00010011 +
J
0Q900111
+ 6 00000110 ".. 6, 11111010
11110011 11110011 .
.:..7
illl1001 -19 11101101
, . ,I ' \ ., . ,
Note that negative numbers must:hil iriitially in 2's,..eompkmentform and that if the swn
negative,ins fOl1Jl; " , .
- In each of thefoDr'cases,tlteoporationperfol1JlC(lis additionwitb the sign bit iil.cluded.
Any catTY and negative results.areButomaticallyin 2's
romplementfoon.' ,
In order to obtain acOrrect answer. we mustensQre that the result has a sufficient
of bits to accommodate the swn.lfwestartwith and tbeswn occupies
n + 1,bits, we say tbllt.an overflow one perfotmStbc ad(JitiOJl with nlll'lIP.TJllVIl
, pencil. aq overflow is not a preblem. because we arcr. noflimitecLbythewidth of the page.
jUst addanothr 0 to apositive number or another 1toa negative number in the mOst
cant positi()n to extend thenwnber to n.' + 1 bitS' and theQ perform., addition. Overflow is
, problem in computers beqiusetbe number of bol{:la finite. and a result .
. t;I1efinite hy l,catmot be accommodated." " . .
The compJement form of represent:iQg negativ.etl'QUlbers is .unfamiliar to those used' to
, signed-magnitude system. To i;tetermine value ,of II. negati\'enumber insiped-2's 'COlIlpJe:!
to CODVert,tbe num,bcr to apositi\!e ntirit_ place it'iD'a more
" form.Por binary number, q leftmost,
t. 1182's binary.eqqivalen\ of .+7.'Wctherefore
.nize the, Qumber to be lo-7. ::, 1 '
Sectlonl.7 Bh1ary Codes ' 17 '
ArIthmetic SubtractIOn',
" Subtraction of two signed binafy numbers negative numbers, are in2's-complement form
, is simple and can be stilted, as follows: . ' '"
Take the 2's complement of the5ubtraltend (including the sign bit) and add it to the minuend
(including the sign bit). A can;y oU1:of thesign.:.bit position is discarded.
This prOCedure is adopted because, a subtraction operation can be changed to an addition
operation if the 'sign of the subtrahend is changed, as is demonstrated b.y the following .
relationship: ' . '. " '
(A) (-t;B) = (A) + (-B);
(A) - (-B) =.\A) + (+B).
" ,
But changing a positive!twober toa negative is ea&ily done by taking the 2's comple
, mentof the pQsitive number, The reverse is also of a negative num
ber in complement form produces 'the equivalent positive number; To see this; consider the
,( "76) -:- ("..13) ,= +7. ,.In binaIy_ with eight bits, this ()peiationis written as
(11111010 :... 11,110011). The ischm,lged addition by taking the 2's complement
ofthe subtrahend (-13), giving (+13). In binaly. 11 niOlO+ 00001101 = lOOOOOU1.
Removing the we obtain the ootrect answer: ()()()()() III ( +7).
Itis'worth noting that binary DUmbersinthe signed-complement system are added and sub
, tracted by the same basic .addition and suPtraction rules as unsigned numbers. Therefore. com
putersneed omy one common hardware circuit tobandle bothtypc:s of aritbtnetic. The user or
programmer interpret the resw;'tI!i of $l1ch addition or subtraction differently. depending on
whether are signed <?r ti,nsigned'
j
BINARY CODES
, Digitalsystems use signals.that have two distinct values1Uld circuit elements that have,twosta
ble states. There is a direct analogy an:rong binary !iignals, binary circuitelements, and binary
digits. A binary number: ofndigits,for example. may be represented by n 'binary circuit ele
ments, each baving an output Oor I. Digital systems represent (Uld ma
nipUlate not omy binary numbers. but alsO many other diScrete elements of information. Any
discrete element of informatioIidlat is dis1;iilct among a,group of quantities can be represented
witha binary code (Le., a pattern of O's and fs). The codes must be in binary because, in
today's techIiology, omy circuits that represent and manipulate patterns of 0's and l's can be
manufactured economically in computers. ,However, it mtistbe realizCd that binary
codes merely change the symbols, not the meaning ofthe of infonbationthat they rep
'resent. IT we inspect the bits of a computer at random, we will find that mostofthe time they
,represent some tYPe of coded information than binlUY numbers.
AIln-bit binary code is a groopof,n hits that assumes up to 211 distinct cOmbinations of l's
O's, with eacn combination representing one element'of tnt. set that is being coded. A set .
, of four elements clab :becod,ed with two \lil'S.. with each thefoUowing
"bit oombinations:OO,O I, 10, J 1. A set of eight elements requiies a three-bit code .00 a set of
18 'Chapter 1 Digital Systems and Binary Numbers
J6 elements requires a fourbit code. The bit combination of code is det.ermined
the, count in bin;uy from 0 to 21t - t Each element must be assigned a unique bin;uy bit
bination;and no two elemerits c;m havetbtsame,.value;'othenvise,the code assignment
be ambigUous.,' " ", ". , ' "
Although the minimum nqrnber ,of 1;lits required to, code 21t distiItct quantities is n,there
,nomaximwn numbe( of bit!; that may he used for a bin;uy code. For example, the 10
,digits can be coded with 10 bits, and each decimal digit can be assigned a bit combination
nine O'Smid a 1. In this pamcularbinarycode, the digit6 is assigned the bit \,;,')UllIUla,uuu
0001000000. .', , ,
BCD,code'
Although the binary number system'is die natural system for a computer, most people
. more accustomed to the system. One way to resolve this; difference is to convert
inlal nUmbers to binary, perform all arithmetic calculations in binary, and then convert the
nary results back to decimal. This metbodrequites that we store' decimal numbers in
, cOinputer so that they to binary. Since the compllter Can accept only
values,we must represent the decimal digits by means ofa code that contains l's and O's.
also pOsSible lopedorm the: arithmetic operlltiorisd1rectly on decimal numbers when they
stored in the in form. ' .'. ' ,',,' . '
A. binarycode'w.ill have. some unasSigned bit ifthe elements in
set is not amultiple power of 2. The 10decimai digits form such asel. A biruuy code, that
tinguishes among 10 elements must coiltain at least four bits, but 6.otitofthe 16 possible
binations remain unassigned. 'Different binary, code$ can be oNained by arranging four
into 10 distinct Theicode':Illc:fflt oommonly used fdr the decimal digits is
straight binary in Table 1.4. This scheil)eis called decimal
. is commoolyreferred to as BCQ. OtherdecimalcodesaIlfpossible and a few of them are
. sentedlat.er'inthis section, . , '
Table 1.4 .
BinaryCoded Oeclmql (BCO) .
Decimal BCD
,S,nlboiDIgIt
o 0000
1 0001
2
0010 .
3 0011
4 0100
5. 0101 .
6 0110
7 0111
8 1000
9 1001
Section 1.7. BInary COdes 19
Table 1.4 gives.the four-bit code for one decimal digit. A number with k decimal digits will
. require 4k bits in BCD. Decimal 396 is represented in BCD with 12 bits as 0011 10010110,'
with each group of 4 bits representing one decimal digit. A decimal number in BCD is the
-. same as itS equiyalent binary number only when the number is between 0 and 9. A BCD num
ber greater than lO'Jpoks different from its equivalentbinary' number, even though both con:'
tain,l's' and O's, Moreover, the binary Combinations 1010 thrpugh 1111 are not used arid have
.no meaning in BCD. Consider decimal 18S.lUld its corresponding value inBCD and bUtary:
(185ho = (0001100001Ol)BCD = (l.0111001h
The BCD value has 12 bits to encode the characters of the decimal value, but the equivalent
binary number needs only 8 bits, It is obvious that.the representation of a BCp number needs
more bits than its equivalent binary value. However,;. there is an advantage in the use ofdeci
mal numbers, because compUterinput and output data are generated by people who use the dec
imal system.
It is important to realize, that BCD numbers are deCimal numbers and not binary numbers,
although they use bits in tb,eir representation. The only difference between a decimal number
and BCD is that decimals are written with the symbOls 0. 1. 2. '...'. 9 and BCD numbers use
tbebinarycode 0000,0001, ... 1001.The decimal value is exaCtly the same.
10 is represented in BCD with:eight as 00010000 and decitna1J5as 000'1 01Of..1lte cor
responding binary,values are 1010 and 1111 and have only four bits. '
Consider the addition of two decimal digits in BCD, together with a carry from a pre-.
. . vious less significant p,air ofdigits;Since each digit does not exceed 9, the sum cannot be .
greater than 9 + 9 + 1 = 19, with the 1 being a previous carry.,Sllppose we add the BCD dig- .
its as if they were binary numbers. Then the binary sum\vill produce It result in the range
from to 19. In bin8ry, thistange wil[be from 0000 to 10011, butin BCD, it is frOm 0000 to
. I 1001, with the first (i.e., leftmost) 1 bemg a carry and the next bits being the BCD sum.
When tP.e binary sum is equalto or less tha'n 1001 (wi'thaut a carry), the corresponding BCD
digit is correct However, when the binary sum is greater than. or equal to 1010, the result is an
invalid BCD digit. The addition of 6 ;::; (0110h to the binary Sum cOnverts it to the correct: digit
and also produces a catTy as required. This is because a' carry in the. most significant bitposi
tion of the binary sum and a deCimal carry differ by 16' 10 = 6. Consider the following
three BCD additions:
4 0100 4 0100 8 1000
+S +0101 +8 +1000 +9 1001
9 1001 12 1100 17 10001
+0110 +0110
--,-,-.
10010 10111
In each case, the two BCD digits are added as if they were two binary numbers. If the binary
sum is greater than or equal to 1010. we add 0110 to obtain the correct BCD sum and a carry ..
In the flIst example. the sum is equal 'to 9 and is 'the correct BCD s.um: In the s.econd example.
20 Chapter 1 Digital Systems and BInary Numbers
the binary sum produces an BCD digit The addition of0110 produces the cortect BCD
sum. 0010 (i.e., the number 2), and acany.Inthetbirdexample, the binalY SUDlproduces acany.
This condition occurs wben the $W)). is greater than or equal to 16.Altbough the other fout
are less than 1091, the binary 9Ulll requires acOn'ec.tionbecause of die carry. Adding 0110,
obtain thetequil'ed BCD sum 0111: (i.e., the numb 7) and 8 BCD CiUT}'.
The addition,oftwon;.digit unsipedBCD numbers follows the same procedure. COIlSio:ll',
the addition of 184 +. 576 '1= 76() in BCD: .
BCD 1 I
0001 10000100 184
+6101

0111
..,..---....
0110 +576'
lJinarysum 0111 .10000 1010
'. Add6
ono 0110
BCDs\un 0111 .0110 0000 7(1:)
The 'flfSt, sigDiticant p;ili- of BCD digits produces 0000 and a
.for the next pair of digits. the .second parr or BCD digits plus a cany produces a
sum of 0110 and a carry for the next patr()fdigits. The third pair of digits plus acarry
a binary of 0111 and does not require a correction.. .
Decimal Arithmetic
The represeil.tation of signed decimal numbers in BCD is simiiarto the tepresentation of
numbers in binary,We can useeitheI the familiar signed-magnitude system at the SllZllOO-COI1I
plemelit system, The sign of a decimal number is t,JSually represented with four bits to
. to thefour-bit code ofthe decimal digits. Itis customary to designate 8 plus With four O's
'.8 minus with the llCDequivalent oi9, whlcq is 1001.
, 'The is seldom used in The signed-complerDem
either the 9's octhe 10's complement, put the lO'scomplement is the one most
useP. To obtain the lO's complement of aBCD number,we first take the 9's complement
then add 1 to the least significant digit. The 9's Complement is calculated from the subtracloo
of each digit from 9. . '. . ..'
The pr<X;edures,develope4 for the signed-2's-complement system in the
also apply to the signed-IO's-complement system for decimal :mimberS. Addition is done'
summing all digits, including the sign digit, and discafding the end carry. This operatiQ
assumes that all negative numbers are in 10's-complement form. COOsider the
(+375) + (-240) == + 135, done in,the signed-complement system: .
o 375
+9 760
o 135
'l'he 9in the leftmost pOsition of the second tepresents a minllS, and 9760 is the
complement o( 0240. The two numbers are ,added and tbe end carry is discarded to '
+13S.Ofcourse, the decimal ntml.bers tile computer, includingthe sign digits,
'in BCD. The addition isdone with BCDOigits as described previously. '
Sectionl ..7 Binary Codes .. ,21
.. The suQtr8ction of decimalliUJ1lbet's. either unsigned or .in
.systetn, is the sameu in the binary case: Taketbe 10's ootnplementof the subtrahend and add
. to Manyoo.D,'lputerslU,LvespeciaJ: hardware to perform arithmetic.calculations
directly withdecilnal oumbers in. can specify programliled
Wtnlctions.to J?Odonn the aDtiuJletiP oPmwoowith.deQmal having
to convel'l them to binary. .
.Binaf'y codes for decimal digits require.a minimum of four bits per digit. Many different codes
can be formulated four bits into IQ distinct combinations. BP) and three other
representative codes are shown in Table L5. Each code uses only 10 out ofa pOssible 16 bit
combinations that can be arranged with four bits. The other six Unused cOmbinations have no
meaning amt. should be avoided. . .
, BCD and the 2421 code are examples'ofweigbted codes. In a weigbtedcode,.each bit position
. juBsigned a weighting eaehdigitcanbe by 8dding the
. oran the l:sin the.coded combination:. The BCD code has weights of8. 4,2, and I, which cotte
spondiothe powe1'''Of-two valuesof'eaCh bit.:TbebitasSignm.eatOll:0, for example. is interpreted
by the weights to represent dedma16beCause 8. X 0 +,4xt +2 Xl +I'X 0 ;::::6;'Thebit
combination 1101, when weighted by the digits 2421. gives thedeCimal equivalent of .
2 X I +4 >.< I + 2 KO + 1 X 1 :;=. 7. Note that some digits cantle coded in lw9 possib)e
. ways in the 2421Q)(fe.FOr in.ke, decimal 4 can be asSigned to bitCombinadon 0100 or 1010,
since botbcOmbinatibns add 'up,to a total weight of4; .
...... 1.$..
Fou, Dlf(e""t Blnqry Code$ for. thtJledmol DIgits
....... IICD
DIgIt
. sal'
MZt Exeet") 8, 4,
0
1
000() ; ,
.0000
001,)1
. 0001
oem
0100
0000
0111
.2 0010 0010 0101 0110
. 3 0011 OQU' 0110 0101
4 0100 0100 0111 oroo
5 0101 lOll
1000 .
1011
6
,.
OlIO' 1100 1001 1010
7 0111 1101 1010 J001
8 1000 IUO 1011 1000
9. 1001 11U' 1100 1111
1010 . oloi 0000 0001
U:aused IOU 0110
OOOl 0010
bit 1100 0111 0010 0011
combi
.nations
nOl
,1110
lOW
. 1001
HOI
1110
1100
1101
1111 IOU) ! 1111 1110;
22 ,Chaptf!rliDfgltalSystemsaod Btoary Numbers'
. . , .
. .
''I1:te 2421 rind the
,
are exampks Of self-complementing codes. Such codes
. , of a deCimal nfunberig.obtairted directly by chang- .
ing 1'$ to finO, tYSCfb'1 eaCh bit in the pattem).For example, dec
fu tbeexcess..3:code as 01101100 1000; The 9's 604
isobiainc(himply by complementing each bit of the
" code. (as with the, 1 's ' . ' ,
has been used in some oldel coritputers because of its ,
, ing property. Excess-3 is an unweighted code inwhich each coded,combinationis obtained-fJ:Qm
the corresPonQing bin3ry'value.plus 3. Note that the BCD code self-complementing.
. "TheS, 4, ,'.;,;; I' code isan example of assigning both positive and negative weights to
decimalcode.In,this case, the bit combiDation as oecimal2 and is calcu- .
,la:tedfrom8XO+4:X 1 + (";'2) X 1 + (",",:1}XO=2. "
. .
Cra, Code
_,' _ J
'l1:te output data Qf:maJlf,pbYsicai $)'ShmlS are quantities that are continuous. These data
.betonverted they art applied toaliigital system. Contfuuous or ,
bymeans of an rumlog.. It is
,times to.usethe Gray code sl\own inTable 1.6torepreseht digiuU data that have
fMn8D8l08 ,dasa.The,advantage of th( Gray cOOeover thesll:aigbt binary
. hit in the code,group changeS'in going from ,one number to the
For exampl.in-goingfrom 1 to 8,dleGray code cblngesfrom 0100 to 1100.'Only the fu"st
changes,from,Oto the I;)its mnaintbe'same. By contrast, With binary numbers
change from 7 to 8.wrube from 0111 to lOOO,which causes allfciur 'bits to change valUes.
TabielAi '
" GtPyCode
01.,
Decl....
COde Equivalent
, : .
0000
0001"
0011
OOlG
011Q
Olll :'
OlO}
0100
1100; ,
11m
1111
1110
lOlQ .
1011 .
lOOt
,: i .
1000
o
1

'3
4
5
6
7
8
9'
10.
'. 11
12
13
14
15
SectIOnl.7 23
The Gray code is used in applications in which the normal sequenceOrbiruuy may
produce an error .orambiguity during ,the t:ransitionfrom, 'ODeDWDber to the next. If binary
numbersareusec:1. acbange, forexaJIlple, nom 0111 to 1000 may produce anintermediateer
roneous number, 1001 if the value' ofthe rigb,tmost bit takes longer to -change than dothe val
ues of the other three bits. The Graycode elimb1ates this problem, since only one bit changes
its val'v.e dU,rlng aily transition two numbers. . I,
Atypical appli-cation ofthe Gray code is the representation of analog data by a Continu':'
ous change in the angUlar position. of a shaft., The .sQaft is partitioned into segments, ana
each segment is assigned a number.' If adJacent segments are made to correspond with the
Qray-'Codesequence, ambiguity is eliminated between the angle of thesbaft and the value
encoded by the sensor. .'
,Character Code
. .
Many applications of digital computers require the handling not only ofnumberS. but also of
other characterS or symbols, such as the letters of the alphabet. For mstance,' an insurance com
pany with .thousands of policyholders will use a computeX' to process its files. To represent the
names and other pertinent information, it is necessary to fonnulate binary code for the let
ters ofthe alphabet. In additiQt1, the same binary qode must represent numerals and special
Characters (such as $), An a1phanumeric character setis a set ofeiements that inclUdes the 10
decimal digits. the 26leuersofthealp1;iabe!. and a nu.tnbe{of a set con
tains .between 36' 64 elements if'onIy capital letters areincltided, or between 64. and 128
e1eJD.ents ifboth uppercase and lowercll{le \etters are inclUded. In the first case: we need a bi- ,
nary code of six bits, and in the second, we need a binary cooe'O(seVM bits. .
The standaM binary code for the alphanumeric cha.r8.cters is the American Stahdard Code
for Information InterCbange which uses seven bitS to code 128 characters. asshoWn
in Table 1.7. The seven bits. of the code are desipted by h,. With h, the mostsig
nificant bit. leUer A. for example, is represented inASCn as l(l()()()Ol (column
0001). The Ascn ()()de also contains 94 graphic characters that can be printed and 34 non
printing characters used for variQUS control functions: The graphic characters consist of the 26
uppercase letters (A through Z), the 26 lowercase letters (a through z), the 10 numerals (0
through 9), and 32 special printable characters, such,aS %,.*, andS.. "
The 34 control characters are designated in the ASCTItable With abbreviated nalne8. They
are listed again below the table with their functional names. The control characters are used fQr
routing data and arranging the printed text into a prescribed There are three types of
control characters: format effectors, information separatOrs,
IlCters. Format effectors are characters .that control the layout of printing. They inciude the fa
miliar word pr6cessorand typewriter controlssucb 8$ (BS). horizontal tabulation
(HT), and carriage return (CR). Information separators are used to separatetbe data into.
sions such as paragraphs and pages. Theyinclude characters such as (RS)and
file separator (FS).The cODlID.unication-control characters are uSefulduriDg"the transmission
of text between remote tenninals. EXllll;1plesof are. STX
(start oftext)-and ETX (end of text), whicb are used to;frame a text mesaagetnQlSlnitted through
telephone wires,' .'
24, 1 'Diglt8l Systems and Binary Numbers
r.blel.7
, Amerkcm5tandard Code for Information (nterclHlnge(ASCII)
' ,000
001,
'010 on 100 101' no '111
0000 NUL )jLP SP
() @ p
P
0001 SOH OC1 1 A Q a
q
' R;
0010 STX OC2 2 B b r
0011 ETX DC3 # 3 C S Ii: S
0100' ,EDT 0C4 '$ 4 T d t
0101 'ENQ NAK % 5, E iU e
u'
OUO ,ACK SYN & 6 F V f v
0111
'BEL '
ETB 7 0 ,W g w
1000 B8 CAN ( S H
K
h x
1001 HT EM ) 9 I Y
Y
1010 LF 1,
Z'
j z
'"
lOll' VT ESC + ,1<: r
k {
UOO FF ,PS, <', L \ I
I
1101 Cit OS
== ,.- ,M
1 m' }
1110 SO '::;. 'N
1\ n
'
-0
PIt st' ,US f '1. 0 0 DEL
,
,r-,
Control 'characten
NUL NlI]l
Dl.E
Data-}inkescape
SOH Start 'of DC1
' Device cOntrol,l' ,
STX Start of text DC2 DevIce
ETX; End (,Jftex,t i", DC3 Device corUl'ri1 3
OOT End oftraIlsmission DeVicecoQtrol4
,ENQ
&qwry ,
NAK Negati,veackilowledge,
ACK
:
Acknowledge SV,N idle
Btl.: Bell
ETB' End-of-tmnsnussionblOck
.sS," Backspace 'CAN CanCel
HT Horizontal tab EM End of mediUrlt
LF Lintifeed SUB ' Substitute
VT Vertical tab ' ESC escape
FF 'fo.rm feed ,
FS,
File separator
CR Carrii!geretum GS Group separator
SO shift Ollt RS , Reoord sepuator
SI Shlftin US Unit separator
SF DEL Delete
: ,ASCII is a seven-bit code,butrnostcompUters manipulate anejght-bit quantity asa
unit called 'a byte. Therefore, ASCII characters most often are' stored per byte. ,The
I forot}lef purposes. depending example,
, printet:S recognize eightbit AScn chaiacterS with themost sigoificaot bit O. An atkJlitlo.
Section 1.8 ,Binary Storage and Registers . 2S
\ 128 eight-bit characters with the most significant bit set tol are used for other symbols, such
as the Greek alpbabet or italic ty}:Ie font.
Error-D.tectlng Code
To detect errors in data communication and processing; aneigbth bit is sometimes added to the
ASCll cbaracter to indicate its Panty. Aparitybit is an extra hit included with a message to make
the total of l's either even or odd. Consider the fo119wing two cbaracters and their
even and,odd parity: '
With even parity With ,odd parity,
Ascn A = 1000061 ,
01000001 '
11000001
ASCI( T == 101100
\ 11010100 . 01010100 .
1
\" - .
Ineacb case,we insert an extra bit in the leftmost position of the code to produce an even
number of 1 's intQe. cbaraeter for even parity .or an odd number of 1 's in the character for
odd parity. In generlll. one or tbe parity adopted, with even parity being more
common.
The parity biqsbelpful in detecting errors during the transmission ofinformation from one
, location to another. nis'fuJictiOD is bandIed by generating an even parity bit at the sending end
for character. The eight-bit characters that include parity bits are transmitted to their des
tination.. The parity ofeachebaracter is thetichecked at the If the parity of the
received cbaracter is Dot even. then at.1east bit has changed value dUring the trmlsmission.
This method detects one, three, or any odd combination of errors in each character tb.8.t is trans
mitted. An even combination of errors, however, goes undetected, and additioDaterror deti:c-
tion codes may be needed to take care of that possibility. " .
What is done after an errQl is detected depends on the application. One possi
bilityis to request of the message on the that tbeeni>r was ran
d()m and'will not occur again. Thus, if thereeeiver"detects a parityerror,it sends the
ASCII NAK (negative acknowledge) control cnaracter consisting ofail even-parity eight
bits lOOlOl01.H no error is detected,the back anACK con
trol character, namely, 0000011 O. The sending end will respond to an NAK by tranSmitting
the message again until the correct panty, is received. If, after a number of attempts, the
transmission is still in error, a message can be sent to the Operatai' to check for malfunctions
in the transmission path.
'BINARY STORAGE ANORECiISTEIlS
The binary infonnation ina,digitalcomputermust have a physical some medium
for storing individual bits. A binary cell is a device that possesses two stable st.tes and is ca
pable of storing pne bit (0 or 1) oflnfot;lllation. The input to tb.e 'cell receives ex;ciJation sig
nals that set it to one of the two states. The output of the cell isa pbysicalquantity that
distinguishes between the two states. The irtformation,stored in Ii cell is' 1when the cell is in
,one stable state and when the Cell is in the other stable state. "
26 Chapter 1 Digital Systems and BtnaryNumbers
Registers
A register is a group of binary cells. A register with n cells can store any discrete quantity of
information thatcontains n bits. The state ofa registeris an n-tuple ofl's and O's\ with each
bit designating the state of one cell in the register. The C()ntent ofaregister is a function of the
given to tbeinformation stored in it. Consider, fQf a 16-bitregister'
with the following binary content: '
11 00001111001001
with 16 cells can be in one of 2
16
possible sta.tes,If one asstimesthat the content
cif the register represents a binary.'integer, then the register can store any' binary: dumber from
Oto 2
16
- 1. For the patticularexample shown. the content ofthe register is the binary equiv
alent.(lftbe decimal number 50,121. If one assumes instead that the register stores alpbanu
meric characters of an eight-bit cooe, then the content of the register is any two meaningful
characters; For tht; ASCII code with' aneven'plirityplaced in the eighth. most significant bit,'
position, the register contains the.two charactersC (the lefunosteightbits) and I (the
most eight bits). If, however; one the content of the register to be four decimal dig- ,
its represented by a four-bitcode, tnen'the content of the register is a four-digit decimal
number. In the,excess-3 code, the register holqs the decimal nutriber 9,096. The content of the .
meaningless in BCD, the bit combinatiOn ltob is 110t assfgned to any dec
imal digit. From this example, it is clear 'that a' register; can store discrete elements of infor
mation and that the same bit configuration Inay beinte'rpreted dlffe(ently for different types
of data. .
"
t
Reglster.Trail.,.,
Adigitalsysten:l.is characteriZed by its registers and the components thatpetfolin data pro
digital a r!gister tra1'lsfer operation is abasi,';; operation that consists of
a transftr of hiJ:Wy hUormation from one of registers :into ano$er set of registers.
transfer may be one toan<)ther, or may pass througb dataprocessing
circuits to petforma.D. operation. Figure L 1 illus.trate!l the transfer ofiidOr:nuttion among reg
.isters anddemonstrates.pictorlallY [the of.binary.information from a.keyboard
a register in the memQryullit. assumed. to have a keyboard,.1 control
cuit, and an.input register. Each time a key is. strock, the control circuit enters an I"mnV$'_,
lent eight-bit alphanumeric character coqe into the input register. We shall assume that
code used is the ASCII code with an odd-parity bit. The information from the input regis
ter is transferred into the eight-least significa.nt cells Qf a proeess'Or register. After
transfer, theinpui register is cleared to enable the control to insert a new eight-bit
when the keyboard is struck again. Each eight-bit character transferred to the pro1c.4ess("
register is preceded by a shift of the previous character to the next eight cens on its
a transfer -of four characters is completed, the processor registeris full, and its contents
transferred into a memory register. The content stored in die memOry register shown in Fig.l
came from the transfer of the characters "J," "0," "H," "N" aftet: the four ap):lroJ)riatt;
keys were struck. . .
Section 1:8 Binary Storage and Registers 27
,
, .
FIGURE 1.1'
Transfer of information among registers
To process discrete quantities of infoiniatiori in binary form., a computer be pro
vided with devices that hold the (lata to be processed and with circuit elements that. manip
ulate individual bits of irifonnation. The device most commonly used for holding data is a
register. Binary manipulated by means of digital logic circuits .. Figure 1.2
luslrates the process of adding two l()"bit binary. iUlmbers; Themeniory unit, which no[
. mally consists of millions' of registers. is shown with only three ofits registers. Thepait of
the processor unit showncoDsistsofthree registers-RI. R2, and digital
logic circuits that manipulate the bits of RI and R2 and transfer into R3 a binary number
equal to their. arithmetic sum. Memory registers store information and are incapable of pr0
cessing th.e two. operands. However. information store.d in meDij)i:ybanbetransferred to
processor registers. and the resUlts obtainedin processor tegisters can be transferred back into
register for storage Untill)ec;ded again. The diagram of two
,operands transferred from twoJDemoryregisters into RI imd R2. The digital logic circuits
,produce the sum, which is. transfened to register R3. The contents of R3 can now be 1:riUls
ferredback to one of thetnemory registers. :".
The last two, examples demonstrated the infonn.cion-flow capabilit.ieS'ofa digital system
in a simple manner. The registets of the are the basic for Noring and holding
the binary circuits process the binary ihfonaation stored in the
28 Chapter 1 DigIt Systems and Binary Numbers
Sum
FIGURE 1.2
Eumple of processing
,registers. Digitallogiccirctii:ts and registers are covered InChQpteB 2 throQgh 6. The metlilOlY
unit is ill 9aptet 7. descriptton of register opetJtions at the register
level and the design of digital systems are covexed in Chapter 8. " ,
1.9 BIN'ARY LOGIC
, '
, Binary logic deals with variables take on two, discrete valueund with'operations that ' '
'The two the variableussume may,be
(true and/alse, yel and no, etc.), ,but for ourp1ll'pQSe; it is cpqVenienttotbink in terms of
and assign the values llUld O. The binary logic intr0duced.in this section is equivalent to
algebra oalledBoolean algebra. The fannal presentation ofBoolean algebra is covered in "
detail in Chapter 2. 'The purpose ofthis seCtion is to introduce Boo..algebra ina
matmerand",late it to digitallogic'circuits andbinarY\signals.' , '
Section 1.9 :Sinary logic 29
.Itkltn of IInary logic
Binary.logic consists of binary and 'a. set of logica1operatiQDS. The variables are desig
,. by lettel'l! of su,ch as.A. B, C. x, y,z. etc., with eaCh variable baving two and oniy
two distinct posSible valueS: 1and O. There are three basic logical operations: AND,' OR,and NOT.
1. AN],): This is represented by adotor:by the absence an oPerator. For.
example, x y, ='z or xy = "x ANDy is equalto AND
is interpreted to mean that z == 1 ifand ,only la:n.d y = 1; otherwise z = O.
that x, y, andza,re binary v8r,iablesand canbe equal either to 1 or O,and .
nothing eise.) , , , '
2. OR: This operation IS represented by a plus sign. For example, x + y =z is read "x OR
y is equal to z:' meaning that z;:: .1 if x = i"orif y = lorifbothx'= 1 and y = 1. If
bqth X ,""- 0 and,Y, :: O.meo z= O. . .
3. NOT: This operation is repf6sented by a prime (sometimes by an overbar). For
x' =Z '=z) is read "not:dsequalto 1,," meiming that z iswkatx isnot. In other
. words, ifx = 1, then z == ..0, but if x == 0, tnen,z = L The.NOT operationisals(1 re
ferred tolls the complement operation, since it changes 1 toO'and a O. to 1.
< ,
. .
Binary logic resembles binary arithmetic; and the9peratioos ANDahd OR have similari
ties to multiplication and addition; respectively. In the symbols used for AND and OR are
the same as those used for multiplication and addition. However. binary lOgic should not be con
'fused with.binaryarithIrietic. One should realize that.an arithmetic v.ariable designates a num
ber that may consist of many digits. A logic variable is always. either 1 or O. For example, in
binary arithmetic, we ha.v.e I +"1 . plus ()fie is equal to 2"), whereas in binary
logic,we have 1 + 1 .1 (read "one OR onds equal to one").' ,
For each combination of the values oix and y .there isa value of $pecifiedby the defini
tion of the logical operation. of maybe listed in a compacHorm
called truth tables. A truth table is atable of anpbssible combinations of.the variables, $how
ing the relation between the values that the variables may take and the resultof the operation. '
The truth tables for operations AN.D,and OR with variables x and y are obtained by
, all possible values that the variables may have when combined in pairs . For each. com.bination..
the resUlt of die operation 1.8 theillistedin a separate row. The truth tables for AND,OR,and
, NOT are given in Table La. These tables clearly demonstrate the definition;,f the opera:tibns.
Table 1.8
'Truth TcibJts of Logical Operations
AND OR NOT
x y , xy ,x, y x+y
0 0 0 0 0 0
1 0 0 1
'.
1 0
1 0 d 1 0 1
. I 1 1 1 1 1
,.......
m
"
30 Chapter 1
.Logk Gates
Digital Systems and Binary Numbers
Logic gates' are electronic cirellit., that operate on
variable.
,
or m.pre mput tignals to produce an
output signal. Electrical signals. sUch as voltages orrutrents exist as analog signals having. '
values over a given taDge .saY,Ot03 V, but in a digital system are interpreted to be: either of '
two recognizable values, 0 or 1. logic Circuits respond to, two separate volt
age levels that represent a binary varjable equal to logic I bt logic O. For example, a partic- '
ular digital system may define 10gicO,as a signal equal to 0 volts lind logic 1 asa signal
equal to 3 volts. In practice, ,each voltage level'h!iS an acceptable range,as shown in Fig. 1.3.
. The input of digital cikuits accePt binary signals within the allowable range and' ,
respond at the output terininals with' binary signals that fall within the specified range. The
intermediate region between the aJl()wed regions is crossed only during. aState transition. Any .
desired information: for computing or control can be operated t;m by passing binary signals,
through variQUS combinatioDsof logic gates, with each signal represebting a particular binary
' '
The graphic symbols used to deSignate thethree types of gates are Mown in Fig. 1.4. The
gates are ,blocks of hardware that prooocc tbeequiv..alent 1 orlogic..() output signals. '
Volts
-"
F,GURl1.3
x
y
Example, of binary slgnaJs
Signal
ratlge for
logieO
AND gate
FIGURE 1.4
SymbOls for digital logic circuits
(c)NOT gate or
Problems 31 '
x-lU ,1 11 P 0
y 0 0 11, 1
AND:x'y 0: 0 "rTl'" 0,0

NOT: x' "'11, 0, 0 I 1 1, ' ,
FIGURE 1.5
Input-output 5Ig"als for gates'
FIGURE 1.'
A
B
C,
Gates WIth m\lltlple JnpUU
A
B
C
lJ
. . " " . '
, .
, . \
if inPllt logic are satisfied. The:input 'signals x:aDd y inthe.;NDaad\QR gates may
exist in oHow-possible states: 00, 10. 11, or, 01. 'Il1ese shown inFig; l.Sto
getber with the corresponding output signal fore.ach PfC., the re
sponse ofeaclt gate to the four input
represents time, and the vertical axis it volt
, age levels. The low level represents logic O. tJ:te high level. l.1lteAND _. responds With
, a logic sipl both input l'IieO,R with a logic 1
outpUt signal ifanylnput sigrudis lOgic 1. to BUll invedet.
The reason froJn the signal.msponae intbe timitt8 diagram.whicbsbows
that the' oUtputsignal inverts the logic sense of tbeiDpUtsigll8l;: , "
AND and OR gates may bavei)lQte tbantwQ'inputs. M
OR gate with foU)," inputs are shown in Fig. 1.6. The three-inPllt AND gate responds With logic
1 output if all tbreeinputs arelogic 1.1jleoutp:utproduces lOgic Oifanymput is logic O.-The
, four-input OR gate responds withlogic 1 if any input is logic 1; its clu1:ptltllCCoines logic oonly
when all inputs are logic O. '
Answers to prvblems marked with appearaHbe ClOd of,the
1.1 ,'lJltthe octal and, beXadecimalliurilbers trom16ui 32.UdngA. B,1l1ld C
d,igits. Usttbe numbers' from 8 to 28 in base'13.
", ' '" ' ' I, '
1.2t' ,What is the exact D\1Jllbcr of bytes in a system that contains <a) 32Kbytoe.' (b)64.M
(e) 6.40 byte$? .,..,'.7. ,:'. t... .
32 Chapter 1 Digital Syste:msand Binary Numbers
1.3 Convert the following with the indicated bases to decimal:
(a)* (4310)s (b)* (198hz
(c) (735)8' (d) (525)6"
1.4 Whllt is the largest binary number that can be expressed with 14 bits? WhlI.t are the equivaleD.t
iinal and hexadecimal numbei-s? " , . ,
, '.-- .. : ,
1.5* Detemrine the base of thl1 numbers in each case for the following to be correct:
(a) 14/2 = 5, .' (b) 5.414 = 13,
(C) 24+ 17 == 40.
1.6* The solution$to the, xl - Ux +22 ;; oare l1'"" 3 arid x =6. What is the
base of the numbers?
, 1.7*, Convert'thehexadecimal ntmIher 68BE to bitiary, and then convert it to octal.
1.8 I Convert the decirpal number 431 to binary in tWo ways: (a) to binary; (b) con
vert .first to hexadecinla1 and then from wbinary. Which method is faster? .
1,9 &press the following nqrnbersin decinud:
(a)* {IQ11O:0101)z '. . (b)* (l6.5his
(c)*(26.24)8 (d) (FAFA) 16
(e) (1010.1010)2
1.10 Convert the following binary numbers tobexadeoimal and todecitnal: (a) UOOlO, (b) 110.010.
Explain why the deCimal answer in (b).is 4 times that in (a),' .' , . ,
1.11 Perform the followingdiviskmin binary: 11 Ion ,+ l()t
.1.12* A:dd IlniImultiply tfle following numberswiihout converting them to decimal.
(a) Binary nuniberilOll aiIdlOh" , .' '.
(b) 2E aDd 34.
'.1. Do thefoHowing
(a) Corivert'Ciecimal27.31S to binary.
(b) 'CakUlate the binary eqUivalent (}f 213 out,to eight Convert from: binary to
imal,How:gJose istbe result to 2131 "
(c) ,Convert the binary resukin (b) into to decimal. Is
, answer tbesame?
1.14 Obtain the i's 8nd 2's complementsofthe foUowing binary,Dumbrs:
(aj l{)()()(J()OO , (b) OOOOOOOO '
(c) 11011010 (d)01l10110
(e) 10000101 ,(0' 11111111.
". " . ,
1.15 Find the 9's and the 10's complement of the following detimal numbers:'
(a) 52,734.630 \ (b) 63,325,600
(c) 25,000,009 (d) 00,000,000 .
. ,1.16 (a) Find the 16's complement of B2FA.
(b) Convert B2FA to binary. .
(c) Find the 2'scomplem.ent ofthe 'result.in (b)., '
(d) Convert the, answer in (c)to with ihe in (a).
Problems 33
1.17 Perform subtraction on the given unsigned numbers using the lO's complement of the
bend; ;Where the result should be negative, find its 10's and affix a minus sign. Ver
ify your answers.
(a) '6,428:"" 3,409 (b) 1,25 - i,800
(c) 2,043 -'6,152
18 Perform $ubtraCtion on the given unsigned bipary numbers usiIigthe 2's complement of the SlJh
, trahend. Where the result should be negative, find its 2's complement and a minus sign.
(a) iOOll. - 10001 ' (b) 100010 100011
(c) 1001 101000 (d) 110000 - 10101
1.1 The following decimal numbers are shown in sign-magnitude forin: +9,286 and +801. Convert
, them to fonn and perfomHhe following Operations (note that the sum
, is + 10,627 and requires digits and a sign).
, (a) (+9;286) + (+801) (b) (+9,286)+ (-80l)
(c) (-9,286) + (+801) (d) (.,...9,286)+ (-80l)
1.20 Conven: decimal +46 and +29 to binlll)', the signed-2's-complementrepresentation and
eRough digits'to aceommod,ate the numbetll. Then perfonn,the binary of
(+29) + (-49), (":"29) + (1'49), andJ -29) + (-49). Convert the answers back to decitnal
and verify that they are correct. ,
1.21 If the numbers { +9;742)10 and (+641ho are in signe4;imagnitude fonnllt, their sum is
(+10,383)10 and requires digits aad a sign. CO!;\vert th\l numbers to signed-l0's-compIe
ment form aad find the following sums: '
(8) (+9,742) +(+641) (b) (+9,742) + (-641)
(c) (-!-9.742) + (+641) (d) (....9,742) + (-641)
1.22 Conven: decimalS.723 to bOth BCD and ASCII codes,. For AScn, an even parity bit is ,to be ap
pended at the left.
1.23 Represent the unsigned decimal numbers 842 and 537 in BcD, and then show the steps neces
$8l)' to form their sum;
, '
1.24 Formulate a weighted binary code for thedeclmal digits, using weights
(a)'" 6,3, I, 1
(b) 6,4,2,1
1.25 RepreselJt the decinud number 5,137 in (a) BCD, (b) excess-3 code, (c) 2421 code, and (d) a
63p code.
1.26 Fmd the 9's complement of decima15,137 and express it in 2421 code. Show that'the result is
the l's complement oft&e answer to (c) .in J'roblem 1.25. nis demonstrates that the 2421 code
is self-complementing. . .
1.27 Assign a binary code in some 'Orderly manper.tothe 52 playing cards. Use the minimum number
Gfbits.
1.28 Write the expression uO.Boole" in ASCD. using an code. Include the period and the
space. Treat the leftmost bit of each character as a parity bit" Each eight-bit code should have
. even parity. (George was a 19ttt century nip.thematiciaa. Boolean algebra, introduced in
.the next chapter, bears his name.) .
34 C:hapter 1 ,Digital Blnary.Numbers
1.29* 'Decode,the following ASCn code:,
l00tXnO 11010011101100 1101100 lOOO1111100(>011nOl00 1100101 1110011.
1.30, The following in sma; of ASCII bjt l,)e.en CQBVerted into bexa
decimal for CQmpactness: 73 F4 135 76 BS' 4ASF 62 73. Of theeightbjts in each pair of digits,
the leftmost is a parity bit The remainfug' bits afe'the ASCI( code. '
(a) Convert the $tiinjtO bit fann and decode the AScn.:
, (b),Pctermine the parity U$ed: odd or even? '
1.31* Howmanypriniing characters afe there 1n ASCII? How U18fly of them are specialcharacteJs
(not 1ettenor nl1Jl)ef8ls)? " , , " ,
1-32" What bit to cbange8D ASCII letlert'rOm capital to lowercase and vice,
versa?' ' " ' ,
1.U* Thestateofa12-bit i:egister is l()()()10010111. Wbatis its content if it represents
(a) thtee decinlal digits in BCD? '
,(I ,t:hreedecimal digi!'Sin the eXCess-3 code?
(c)thtee4ecimal digits in theM-2-1 code?
(d)'abinalynumber?
. . ' . .
1.34\ List the ASCII code for tile 10 declmaldlaitswith anodd'paritybit in the leftmost position.

, asfw:tctkllls Qf the thtee jnputs a,b, and c. Use aIleigJlt pos$iblecombiDations of a, b, and c.
abc
f
----,g
RGU. Pl.U '
1.NBy means of atUnin,gdilgnun to'Fig. 1..5, the signals oftbeQ.Utputs f and g in
, P1.36 as functions of the twQillpUtfa b. Use all (our possiQle and b.
a' b
f
g
fiGURE Pl.U
References 3S
1. J. J.'19&4.Di$ital epmp,.iIer NeW York:' MQGtaw.mD: . . .
MANo. M. M. 1988. Computer Erigmeering: Han:lwareJJesign. Englewood Cliffs, NJ: PrentiCe.:
Hall. . .
NELSON, V. P., H. T. NAOLE, J. 0: IRWIN, and B. D. CARROLL. 1997; Digital Logic Circuit Analy- .
sis and Upper River. NJ: Han. .
SCHMID, H.. 1974. Decimal New York: John Wiley.

You might also like