Chapter 1
Digital Systems and Binary Numbers
1.1
DIGITAL S Y S T E M S
Digiul systems haw mob a pnominmt role in everyday life !bat wc &lo fcre pwcnttC& nological puiod as the digital age. Digital system ur used in mmmuniEatio%business masdons. m d k muul. smidam. medical uedmen wcaIhcf monifoimthc InmnQ and tcleph, dip&y n b c r c o m m r c ~in&soid. a& scimLilic cnlq. wc haw iml ulcviaioo. digiul v d discs. digiul camcnn,handheld &vice& and, of wunr, digiIrlccmnmten.T h c m t n r i l.d.a a. m.o f the digital mmpuferisits gwmdity.It can follow a &ofhmnions. called a m o m ih.L &ram & dven d&. The vaor can specify and odbaoge tk prom or tk da&ac&&g lo I& s p i r i c ictd ~ecauscof this IlGbiliG, gedplrpwe digitel compulua can @am n vrriefy of infomMimpmassinp laGu that noge over a wide s p m u m of a p p l i i a t i ~ ~ ~ s ~ Onc charaneriotic of digital sysums is mcir ability lo m p m t and msnipvllD diacma clrmmts of information. Any wr that is rrshicted to a &iu numbcr of elements ronuins dirmete infomatino. Examples of disacu sets ur the 10 decimal digits. the 26 lcths of tho alph.bet, thc 52 playing card%and the 64 aqof a chessboard. Early digital compuDrs werc used fornumnic compuwim. In this case, tk d i m e elemem rverr the digita Rom this mlicaiiw. ~ = =  ~ the tmn dinitalcomoutw wncncd. D i a w e elemcns of infomationur rcPmcmd in a &ml sysum by phy&d quan$cp called sipnalr. Bleetnd signals such k whagesand cummarc tho mm comma. Bleeaonic &vices called ~ i s u n ~ in tk circuitry that implemnu tbuc
[email protected] The
[email protected] in mom ruescatday eloermoic digiul s r n s w just & d i m t e values and ur herefom add to be blnnq A A digit d c d a bit. has k o values: 0 and I. Discme elemcnb of information arc r r p ~ c a l e dwilh .pups of bib called binary d s . FW example, the decimal digits 0 khmugb9 kc nprucncd in a digital system with a code of tow bits (e.g., the number 7 is represented by 0111).
Through various techniques, groups of bits can be made to represent discrete symbols, whch are then used to develop the system in a digital format. Thus,a digital system is a system that manipulates discrete eIements of information represented internally in binary form. Discrete quantities of information either emerge h m the nature of the data being processed or may be quantized from a continuous process. On the one hand, a payroll schedule is an inherently discrete process that contains employee names,social security numbers, weekly salaries, income taxes, and so on. An employee's paycheck is processed by means of discrete data values such as letters of the alphabet (names), digits (salary), and special symbols (such as $1. On the other hand, a research scientist may observe a continuous pmess, but record only specific quantities in tabular form. The scientist is thus quantizing continuous data, making each number in his or her table a discrete quantity, In many cases, the quantization of a process can be performed automatically by an analogtodigital converter. The generalpurpose digital computer is the bestknown example of a digital system.The major parts of a computer are a memory unit, a cened processing unit, and inputoutput units. The memory unit stores programs as well as input, output, and intermediate data. The central processing unit performs arithmetic and other dataprocessing operations as specified by the program. The program and data prepared by a user are transferred 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 presented to the user, A digital computer can accommodate many input and output devices. One very useful device is a communication unit that provides interaction with other users through the Internet. A digital computer is a powerful instrument that can perform not only arithmetic computations. but also logical operations. In addition, it can be programmed to make decisionsbased on internal and external conditions. There are fundamental reasons that commwcial products are made with digital circuits. Like a digital computer, most digital devices are programmable, By changing the program in a programmable device, the same underlying hardware can be used for many different applications.Dramatic cost reductions in digital devices have come about because of advances in digital integrated circuit technology. As the number of transistors that can be put on a piece of silicon increases to produce complex functions,the cost per unit decreases and digital devices can be bought at an increasingly reduced price. Equipment built with digital integrated circuits can perform at a speed of hundreds of millions of operations per second. Digital systems can be made to operate with extreme reliability by using errorcorrecting codes. An example of this strategy is the digital versatile disk (DVD), in which hgital information representing video, audio, and other data is recorded without the loss of a single item. Digital information on a DVD is recorded in such a way that, by examining the ccde in each digital sample before it is played back, any error can be automatically identified and corrected. A digital system is an interconnection of digital modules. To understand the operation of each digital module, it is necessary to have a basic knowledge of digitd circuits and their lugical function.The first seven chapters of this book present the basic tools of digital design, such as logic gate structures,combinational and sequential circuits, and programmable logic devices. Chapter 8 introduces digital design at the register transfer level (RTL).Chapters 9 and 10 deal with asynchronous sequentialcircuits and the various integrated digital logic families. Chapters 1 1 and 12 introduce commercial integrated circuits and show how they can be connected in the laboratory to perform experiments with digital circuits.
A major trend in digital design mahodology is the use of a hardware description language (HDL) mdnrnbe and sirnuhe thc functionalityof a digital circuil. An HDLrrscmbles .pro
  
&nulate a digilal system to verify its operation k i r e hardwarc is built in. It IS also used in mnjmclion with logic synthesis tools to automale the design proeew. Because it is impman1 lhat students bccamc familiar with an HDLbawd design methodology. HDL desctiptmna of dieiral circuiuaretmsented thmuehout ihe bwk.~ h i l e t h e s examvie; e helo illustrate the fen. ums of an HDI they also demonstrate the hest practicer used by industry to exploit HDLs. Ignorance of the* partices will kad tocute. but w m h h s . HDL &Is that may dmulm a ~henomcnon,but that carnot be s y n t h d by design tools, or to models th.l w m e silicon


.
As &viouslv stsled..dieitd ~ svstems m&ioukte discrete ouantities ofinfomation that are repreinad in dinary form. w a n d s used for caloulations 'may be expressed in the binary number system. Other discrete elements, including the decimal digits, are represented in b i codes. Digital circuits. also refund m as loeic  c&uits. m e s s data by means ofbinary. loeic elements (logic gwa) ustng binary signals. Quantiuer arc s t u d lo btnary (twovalued) warage e k m n t s (flipflops). The purport of this chapter is to inmrlun the various binary mceps as a frsmeofr e f m for ~ funher smdy in thc succeeding chaptern. ~~~~

1.2
BINARY NUMBERS A decimal number such as 7.392 remsents a auantilv mual to 7 thousands. ~ l u 3s hundnds, plus 9 lens. plus 2 unou. lh thourdods. hundids, c.; powers of 10 ivied by thc psinon of the coeff~nenlsin the number. Tu be moreexact. 7.392 e a shonband notswn for what should be written as
ie
7 x 1 d + 3 x 1 d + 9 x 1 0 ~ + 2 ~ 1 0 ~ However, the convention is lo write only the coefficientsand, fmm their position, deduce the necessary powers of 10. In general, a number with a decimal point is represented by a series of EQfkicienIs:
.
lhcoetficicnts aj are any ofthc 10 digits (O,1,2, .. .9). andthc subssrip~valuejgives the place value and,hence. the power of 10by which the cocffcient must be multiplied. Thus, the preceding decimal number can be expressed as lda,
+ lO%q+ l d a J + idol + lo'al + loOao+ IO'Q~ + 10~az +
Ihe decimal number svslem is said to be of base. or rodir. I0 because it uses 10 dicits and the ieflicients arc multiilied by powers of 10. The binmy ~ y s n mis a diiTaent numi& sysm.The cocfficiem of the binary nmnbe~system have only Wo poslible valuer: 0 and I. Each coefficient a i is multiolied bv 2j. and the nsults are sdded lo obtain the decimal equivalent of the numbe; The radix porn; (e g.. the decimal p i n t when 10 ir the radix) d ~ s t i n g ~ h u positive pu.crs of I0 from ncgati\e p o u m of 10. For example, the decunal equ~valentof the
4
Chapter 1 ~ l f y s h m s a n ~N~ d
binary number llO10.11 k 26.75, as shown from the multiplication of thc c&6cicmts by powem of 2:
In general, a number expressed in a baser system has coefficients muhiplied by powers of r:

The coefficients a] range in value from 0to r ent bases, we enclose the e c i e o t s in
 1. To distinguish between numbers of differ
and write a M p t equal to fhe base used (exospt sometifor decimal mmbers, where the content makes it obvious that the base i s decimal). An example of a b a s 5 nnmbes is
The cotfficient values for base 5 can be only 0, 1,2,3, and 4. The octal number system is a base8 system that has eight digits: 0, 1,2,3,4,5,6,7. An example of an octal numkr is 127.4. To determine its equivalent decimal value, we expand the number in a power series with abaseof&
Note that the digits 8 and 9 cannot appear in an octal number. It is customary to borrow the needed r digits for the coefficients from the decimal system when the h e of the number is I a s than 10. The1 of the alphabet am wed to supplement the 10 decimal digits when the base ofthe number is gmter than 10. For example, in the
[email protected]&cW @ase16) number system, the furst 10 digits am bwrowed from the decimal system. Tbe lecttts A,B, C, D,E,aod F musedfortbcdigits 10,11,12,13,14, a d 15, respectively. An example of a hex&chal number is
Asnotedbefmthedigibinab'mnlrmberareabits. Whtllabitisequalto0,itdm.s not~butetotheslrmd~gtheMmversion.~~theaoovtrsion~binmrrytode i d can bc obtained by adding only ttae numbers wiib powers of lwo oomqmdhg to the bits that am equal to 1. For example,
There are four 1's in the binary number. The corresponding decimal number i s the sum of the four powers of two. The first 24 n u m h obtained from 2 to the power of n are lhted in Table 1.1. In computer work, 2'' is referred to as K (kilo), 220 as M (mega), 2m as G 1, and 240 as T (tera). Thus, 4K = 2'' = 4,096 and 16M = Zz4 = 16,n7,216. Computer capacity is usually given in bytes. A byte is equal to eight bits and can accommadate (i.e., represent the code of)one keyboard character.Acomputer hard disk with four gigabm of storage has a capacity of 4G = 232bytes (approximstely 4 billion bytes).
Section 1.3 NumberBase Converslonr
5
Table 1.1 POWPI or Tvo I
2"
It
2"
"
0 I 2
1 2 4 8 16 32 64 128
8 9 10 I1 12 13 14 IS
256 512 1.024 2,048 4.096 8,192 16.384 32,768
I6 17 18 19 20 21 22 23
3
4 5 6 7
f 65536 131.072 262.144 524.288 1.C48.576 2,097,152 4,194,304 8.388.608
Arithmetic o~erationrwith n u m k in base r fallow the same rules an for decimal numbers.When a bkeotherthan the familiar base 10 is used, one must be careful louse only the rallowable digits. Examples of addition. subnaction, and multiplication of two binary numbers are m follows:
augend: addend: sum:
101101
minuad: subtrahend: 10101OO difference:
101101
100111 WOllO
multiplicand: multiplier:
1011 1011 WM)
Thc sum of two b l n q oumben 15 ~alruialcdb) the wme rule5 a ~n dcc~mal.except that the Wts of me rum m any rrgmliuficant partoon cao be oal) 0 or I Any rarr) a b t u e d m s given
uenoficaa pc>*tlnunI\ u\rul hy thc patr dlpllr unr. wgrufieant povson h~ghurSuhlnuuon ir slightly more complicated m e rules are still the same as io decimal, except that the barmw in a given significant position adds 2 to a minuend digit. (A borrow in the decimal system adds 10 ton minuenddigit.) Multiplication is simple: m e multiplier digits are always 1 or0:there. fore, lhe panial pmducts are equal either to the multiplicand or to 0.
1.3
NUMBERBASE CONVERSIONS The conversion of a n u m k r i n base r to decimal is done by expanding the number in a power series and adding all the terms as shown previously. We now present a general procedure for the reverse operation of convening a decimal number to a number in bax ,:If the n u m k i n cludes a radix point, it is necessary to reparate the n u m k into an integer p m and a fraction pan, skeeachpartmust be canveneddifferently. The convexxion of adecimalinteger to a m ber in base r is done by dividing the number and all sucewsivc quotimrs by r and accumulating the remainders. This procedure is best illusvated by example.
6
Chapter 1 Digltal Systems and B f ~ r Numbers y
Convert decimaT 41 to binary, First, 41 is divided by 2 to give an integer quotient of 20 and a remainder of Then the quotient is again divided by 2 to give a new quotient and The process is continued until the integer quotient becomes 0.The coeficie#s of the desired binary number are obtained from the remainders as follows:
4.
Integer Quotient
4112= 20/2 =
20 10
,
..
Therefore, the answer is (41)10= (aga4a3a2alaO)2 = (101001)2. The arithmetic process can be manipulated more conveniently ar3 fobws: Integer 41
Remainder
20
I
10
0
0 1 0
1 101001 = answer Conversion from decimal integers to any baser system is similar ta this example, except l h t division is done by r instead of 2. 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 dividsd by 8 to give an integer quotient of 2 and a remainder of 3. Finally, 2 ia divided by 8 to give a quotient of 0 and o remainder of 2. This process can be conveniently manipulated as follows:
The con~err~on of r decimal fmoron m binaq IV rccompl~rhedb) r methud .#rnllar m IBI a c d for lntrgcn Hnur\cr. mulupl,rat~onis "red inread of d~vlrion.and lnvgen inntad of ~malnderrarc srcumulated hgam. the method is best cxpliuned b) c r m p l r
Convcn (0.6875)10 to binary.Firs< 0.6875 ia multipiied by 2 to give an integer and a fraction. Thctl the new fraction is multiplied by 2 to gives new integer and a new freetion. The pmcers is continued mtii the fraction becomes 0 or until the number of dipits have sufficient accuracy. The cafficicntr of the binary number are obtained fmm the hregers as follows:
Therefore,the answer is (0.6875)10 = (0.0lo20304)2 = (O.lO1l)l. To conven a decimal fraction lo a number cnprcrwd in baw r, a similar procedure is used. However, mulliplication is by r instead of 2. and the coefficients found fmm the intsgm may range in value fmm 0 ro r  I instead of 0 and I
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 The answer. w seven significant figures, is obtained from the integer pan of the products:
(0.513)10

(0.406517...)8
8
Chapter 1 Digital Systems and Elnary Plumbers The conversion of decimal numbers with both integer and fraction parts is done by c m verting the integer and the fraction separately and then combining the two answers. Using the results of Examples 1.1 and 1.3, we obtain (41.6875)10 = (101001.1011)2 From Examples 1.2 and 1.4, we have (153.513)10 = (231.406517)g
1.4
OCTAL AND HEXADECIMAL N U M B E R S The conversion from and to binary, mtal, and hexadecimal plays an impartant role in digital computers. Since = 8 and z4 = 16,each octal digit corresponds to three binary digits and each hexadecimal digit corresponds to four binary digits. The first 16 numbers in the decimal, binary, octal, and hexadecimal number systems are listed in Table 12. The conversion from binary to octaI is easiIy accomplished by partitioning the binary number into groups of three digits each, starting born the binary point and proceahng to the left and to the right. The corresponding octal digit is then assigned to each group. The following exampIe illustrates the procedure: (10 110 001 101 011 111 100 000 110)2 = (26153,7406)8 2
6
1
5
3
7
4
0
6
Table 1.2 Numbers with DiiYerent Bases Decimal
Blnay
(base 10)
(base 2 )
Octal
(base 81
Hexadecimal (base 161
Section 1.5 Complements
9
Conversion h m binary lo huadaclmal is similar.ucept thu the binary number isdivided into gmups of&, digits (10 2
11OO 0110 C 6
1011 B
.
1111 OO1O)r = (2C6B.R)16 F 2
The conesponding hexadecimal (or octal) digit for each group of binary digits is earily nmembered from the valves Usled in Table 1.2. Convenion fmm wlnl or hcudecimrl lo b~llaryis done by revetsing the preccdin~porr d m . Each octal digit is mnvmed lo i o W g i t binary equivalent. Sirmlarly. each hemdacdmal digit is convened lo nr fou~digilb i a q equiralcnl. 7 % p ~ &. is illunwral ia the following examples: (673.3.124)s = (110 6
111 011 7 3
.
001 1
010
2
lW)z 4
and (306.D)t6 = (0011 3
MOO
0
0110 6
.
i101)2
D
Binary numbers are difSeull m warl; with because they q u i r e Uuee or four tias many digits as W i daclmal equivalents. Panample. the binary n u m k 111111111111is equiv.lmt lo decimal 4095. Howeva, digital computm UM binary numbers, aod it h sometimcr nsessary forthe humanoprstormus~tommmvoicatedi~ftlywiththehehine bym~ansofswhnumben. Orr scheme that rains the b i i systemin the computer, but reduces the numbaafdigits the h u ~ must n caasider, "utilizes the relationship b e e n the b i number ryrrem .Ildlk d or Mxdccimnl r m m . 87 this mnhd ibc humam thinks in lumsof ostalabu&mal nvmbers and prfthe q u i d rrmwrsion by i n s w o n whsn direct mmmoniFdm with the machins is necessary.Thus the b i i number 111111111111 bas 12 digits and is uprrssed in octal as 7777 (4 dig~ts)or in hexadecimal as EFF (3 digits). During mmmtmication behvecn H e (aboutbbq numbur in the computed. the octal or hexadecimalsentltion h mne deshbk because it can be expeared mare mmpscdy with a third or a qvafer of the n v m k of d ' i t s q u i r e d for tbe equivalent binary numbrr. n u s , m m corngum murls use citba arml or hexadecimal n u m k to specify b i i quanlities. The choice between &em is arbitrary. although hsiladecimaltendr to win out, since it can represent a byte wah
[email protected]
1.5
COMPLEMENTS Complements are used in digital romputemlo simplify the submaion oprraton and for logical maoipulation. S i m p w g openuions leads lo simpler. less erpnsive c h i t s foimplnneot the operations. mere are hvo types of complements for each base.? system: the radir complement and the diminished radix mplemeot. The fust is ref& to an the 9 s m p l e m m t and the s d as the (r  1)'s canplemeat. When the value of the base r i s suMuued in the namc.thcrarotypesarercfmedroastbeZ'scomplnncntvld I ' s c o m p l n n c n t f a b i i n m k and the IO's complemenl and 9's complement for M m a l numbem.
10
Chapter 1 Mgital Systems and Binwy Numbers
Dlmlnlshed Radix Complement: Given a number N in base r having n digits, the (r  1)'s complement of N is defined as ( r n  1)  N. For decimal numbers, r = 10 and r  1 = 9, so the 9's complement of N i s (lon  1)  N. In this case, 1W represents a number that consists of a single 1 followed by n 0's. 10"  1is a number represented by n 9's. For exarnpIe, if n = 4,we have lo4 = 10,000 and lo4  1 = 9999. It follows that the 9's compIement of a decimal number is obtained by rmbtracting each digit from 9.Here ~ I Zsome numerical examples: The 9's complement of 546700 is 999999  546700
=
453288.
The 9's cornplement of 012398 is 95999  012398 = 987601. For binary numbers, r = 2 and r  1 = 1, so the 1's complement of N is (2"  1 )  N, Again, 2" is represented by a binary number that consists of a 1 followed by n O's, 2"  1 is a binary number represented by n 1 's. For example, if n = 4, we have z4 = (10000)2and z4  1 = ( 1 1 1 1 )2. Thus, the 1's complement of a binary n u m k is obtained by subtracting e a ~ hdigit from 1. However, when subtractiag binary digits from 1, we can have either 1  0 = 1 or 1  1 = 0,which causes the bit to change from 0 to 1 or from 1 to 0, respectively. Therefore, the 1's complement of a binary number is formed by changing 1's to 0's and 0's to 1's. The following are some numerical examples:
The 1's complement of 1011000 is 0100111.
The 1's complement of 0101101 is 1010010. The ( r  1)'s complement of octal or hexadecimal numbers is obtained by subtracting each digit from 7 or F (decimal 15), respectively.
The r's complement of an ndigit number N in base r is defined as r"  N for N # 0 and as 0 for N = 0. Comparing with the (r  1)'s complement, we note that the r's complement is obtained by adding 1 to the ( r  1)'s complement, since r"  iV = [(rn  1)  N] + 1. Thus,the 10's complement of decimal 2389 is 76 10 + 1 = 7611 and is obtained by adding 1 to the 9'scomplement value. The 2's complement of binary 1011OO is 0 10011 1 = 010100 and is obtained by adding 1 to the 1'scomplement value. Since 10 is a number represented by a 1followed by n O's, 10"  N,which is the 10's cornpiemeat of N, can be formed also by leaving a l l least significant 0's unchanged, subtracting the first nonzero least significant digit from 10,and subtracting dl higher significant digits fiom 9. Thus,
+
the 10's complement of 012398 is 987602 and
the 1O's complement of 246700 is 753300
Sectlon 1.5 Complements
11
The iO'scomplrmcnt nf the Srn number s ohlniacd by suboaeting 8 horn 10 in the least sig~ n c a position a m d submaclingall ulherd~gitrfmm 9. The IO'r eompkmcu of ibr Dd ovrobn ir obtained by leaving the tuo leas signnfieanlO'r uochanged. rubIrafling 7 fmm 10. awl subtracting the othcr t h m digits bom 9 Similerl), Ihe TI complement ran be formed b) lea, ~ n all g least sigmfifirant O'r and the tint I unchanged and replacing 1's ui!h 0'. and 0'1 wtth I'r in all othcr hgher signlfi~antdiglb. Por PIC. theTsmmplemcntof IlOlIMisOOlOlW and the Z'rcomplementof01101il is lWiOD1
The 2's complementof the 6m number is oMained by leaving the tuo least signifcant 0's and Ihe fusr I unchanged and than replacing 1's with 0's and O's with 1's in the o l b u faur m a significant digiu. The 2's complement of the second number is obtained by leaving the least rig. niticattt I unchanged and complementing all other digiu. In the p v i a u s definitions. it was asrumd that the numberr did n a have a radix pin. If theoriginal number Nmntains 8 radix point. the p i n t should k removed tcmpanrily in order w bmt the r's or ( r  1)'s complement.The radix p i n t is then &red to &e coiplnnentEd number in the m e relative position. It is also wonh mentioning lhatthcmmplemcnt ofthc complcment restorer the number to its original value. To see this relationship. note that the r's complement of N is r" N, so that the complcment of the complement is r" (r" N) = Nand is equal to the niginal number.



Subtraction wlth Complements The direct method of rubtraction taught inelementary sehwlsuses the borrow concept. In lhis mehod. we b a r n a I fmm a higher si&eant position when the minuend digit is r& than thesubtrahend digit. The method works well w k n pople performsubtranianw i t h w r andpencil. However. when subaction is implemented with digilal hardware, Ihe mahod is lcrs efficient than the method that uses complemcnls. The subtrsction of two ndigit unsigned numbers M  N in base r can be done aa follows: 1. Add the minuend M to the r's complement of the suhtrshend N. Mathcmuically. M + (r' N ) = M N + #"'


2. If M m N. the sum will produce anmd carry r". Mich can be discardsd. what is left is the msult M  N.


3. If M c N. the sum does not pmduce an end carry and is equal m r" (N M). whichis Iher'smmplementof ( N  M).Toobraiotheansmr ioafimiBarfotm,takc the r's mmplement of the sum and place a negative sign in h t .
12
Chapter 1 Digltal Systems and Binary Numbers
The following examples illustratethe procedure:
Using 10's complement, subtract 72532  3250.
+
10' s complement of N = 96750 Sum = 169282 Discard end carry lo5 =  100000 Answer = 69282 Note that M has five digits and N has only four digits, Both numbers must have the same number of digits, so we write N as 03250.Taking the 10's complement of N produces a 9 in the most significant position,The occurrence of the end carry signifies that M 2 N and that the result
is therefore positive.
rn
Using 10's complement, subtract 3250  72532. 10's complement of N = +27468 S u m = 30718
There is no end carry. Therefore,the answer is (lo's complement of 30718) = 69282. Note that since 3250 < 72532, the result is negative. Because we are &ding with unsigned numbers, there is really no way to get an unsigned result for this case. When subtracting with complements, we recognize the negative answer from the absence of the end carry and the complemented result. When working with papa and pencil, we can change the answer to a dgmd negative number in order to put it in a familiar form. Subtraction with complements is done with binary numbers in a similar manner, using the procedure outlined previously.
Given the two binary numbers X = 10101M3 and Y = 1000011, perform the subtraction (a) X  Y and @) Y  X by using 2's complements.
Sectl0nl.S Comp!mkmu (a)
x= 2's complement of Y = Sam = Discard end carry 2' = An,: X Y =

(b)
Y =
2's complemmt of X = Sum=
+
13
IOIOIW IOOlDOOl
10000000 WlODOl
+
1WM)lI 1101111
n K ~ i s m e n d c s r r y . T h n c f m , t b e ~ r i rYX WIwoI.
=
(2'acmnplenwtofl101111) =
SubcRnion of unsigned numbcls cso also be done by means of the ( r  1)'s complement. Remember Ihu the ( r  1)'s complement is one l e s lban the heomplemeat. Because of this, the result of addiog tlle minuend to the romplement of the sukmhmdpmducssa sum &at is one less lhm the c a t diffmnce when an end carry occun. Removing the end carry aod adding I to the sum is r e f d to as so andomundca~.
Repat Example 1.7, but this rime using 1's complement. (a)
X
 Y = IOIOIW  1WM)II
 +
X 10101w 1's complement of Y = sumlWlWM) 1 Edamund carry = +Anm'er: X  Y = WIODOI
(b) Y
 x = 1000011  1010100 Y =
1's com lement of X
P
= +
Sum =
l
~
l
l
1101110

T h n c i s n o m d c a r r y . ~ ~ . b e s o m r w e r i s Y X = (l'nmmplencnfof1101110) =
W1~1. Notethat thenegative myltir obrsincd by taking ihc I'n complementof the sum, since Ibis is the t y p of eomplmvnt used. T k @urc with endamund csrry is alw applicsbhto subvaning unsigned decimal numbers wilh 9's complement.
1.6
SIGNED B I N A R Y NUMBERS Positive integers (including zero) can be represented as unsigned numbers. However, to represent negative integers, we need a notation for negative values. In ordinary arithmetic, a a g ative n u m b is indicated by a minus sign and a positive nmker by a plus sign. Because of hardwm limitations, computers must represent everything with binary digits. It is customary to represent the sign with a bit placed in the leftmost pition of the number. The convention is to make the sign bit 0 for positive and 1 for nemve. It is important to re& that both signed and unsigned binary numbers consist of a string of bits when represented in a computer. The user determines whether the number is ~ignedor unsigned, If the binary n u m k is signed, then the leftmost bit represents the sign and the rest of the bits represent ?henumber. If the binary number is assumed to be unsigned,then the leftmost bit is the most simcant bit of the number. For example, the string of bits OlOO1 can be considered as 9 (unsigned binary) or as 49{signed binary) because the leftmast bit is 0. Tbe string of bits 1 1001 represents the binary equivalent of 25 when consided as au unsigned number and the binary equivalent of 9 when considered as a signed number. This is because the 1 that is in the leftmost position designates a negative and the other four bits represent binary 9. Urnally, there is no confusion in identifyingthe bits if the type of representationfor the
number is known in advance. The representation of the signed numbers in the 1 s t example is referred to as the signedmagnit& convention. In this notation, the number consists of a magnitude and a symbol (+ or ) or a bit (0 or 1) indicating the sign. This is the representationof signed ntunbers used in o r d i n q arithmetic. When dthmetic operations are implemented in a computer, it is more convenient to use a different system, referred to as the signedcomplemnr system, for rep= senting negative numbers. In this system, a negative number is indicated by its complement. Whereas the signedmagnitudesystem negates a number by changing its sign, the signedcornplement system negates a number by taking its complement. Since positive numbers always start with 0 (plus) in the bftmost position, the complement will always start with a 1, indicating a negative number.The signedcomplementsystem can use either the 1's or the 2's complement, but the 2's complement is the mast common, As an example. consider the number 9, represenmi in binary with eight bits. +9 is represented with a sign bit of 0 in the leftmost @tion, followed by the binary equivalent of 9, which gives 00001001. Node that all eight bits must have a * , therefore,0's are hmkd following the sign bit up to the first 1. Although there is only one way to q r a e n f +9, the= are three different ways to repsent 9 with eight bits:
signedmagnitude representation: signed1'scomplement repsentation:
In signedmagnitude,9 is obtainedh m $9 by changing the sign bit in &e leftmost position from 0 to 1. In signed1's complement, 9 is obtained by complementing alI the bits of +9, including the sign bit. The signed2'scomplementrepresentationof 9 is obtained by taking the 2's complement of the positive number, including the sign bit.
Table 1.3 g n r d Wm'y Numbnr Slgmd2's Decimal
+7 +6 +5
+4 +3
+Z +I +O 0 I 2 3 4 5
Sbmd1's
S1gn.d
Compkment
Magnkudm
0111 0110 0101 OIW WII 0010 WOI
0111 0110 0101 OlW W11 W10 WOI
0111 0110 0101 OlW Wll W10 WOI
MW
MW
MW

1111 1110 1101 1100 1011 LO10 IWI LWO
IWO LWI 1010 loll 1100 1101 1110 Ill1
Complnt
7
1111 1110 LIOl IIW 1011 1010 IWl
8
lODO
6


Tuhle I ? Il.!r all powble fourbll .tgncd htnary numhcrs I" the lhrrr rcprescnlalronr The equtvalcnl dee~malnumhcr 8 dl50 ~ h u u nfor rcfcrcnce Nolc that the po,llh\e numberr ~nall three repre.entauonr s e idcnu;al and hair Ora lhc lcflmorl porltlon The slgocd2'scomplement system has only one representation for 0, which is always positive. The other two ryrremr have either a positive 0 or a negative 0,something not encountered in ordinary arithmetic. Nolc t h a all negative numbers have a 1 in the leflmort bit position: lhat ia the way we disrineuish them from the oositive n u m b . Wilh faur biu. we can remesent 16 binary numben. In the stgnedmlgn81ude and #he I'rcomplement repre,entauon,. Ihere are eight posltne numbers and clght negatlvc number,. ~ncludtnglwo zero,. In the l',.cornplement rcprerentallon, rherr are rnght po~nrncnumber,. tncluding unr xru. and eight negative numbers. The signedmagnitude system is used in ordinary arithmetic, but is awkward when employed in cornpuler arithmetic b e c u e of the separatehandling afthe sign and the mapniNde. Therefm. the signedcomplementsystemis normally used. The 1's complement i m p % some diffcullics and is seldom used for arithmetic ooerations. It is useful as s lopical  owration. . stnee lhe change of I roOorO la I IS cqunalcnt to a l o g ~ acomplement l opreuon, ar MU be shown in the nekl chapter The direurrion of rlgnrd bnnary anlhmatc that follows deals exclustvely u ~ l !he h ngned2'scomplement represenlation of neganve numben. Iiu lhc prccedures can be applied to lhe rignedl'rsomplement ryslem by including the endamundcsny as is done with unsigned numben.

The addition of two numbers in the signedmagnitude system follows the rules of oPdinary arithmetic. If the signs are the same, we add the two magnitudes and give the sum the common sign. If the signs are different, we subtract the smaller magnitudefrom the Iarger and give the difference the sign of the larger magnitude. For example, (+25) + (37) = (37  25) = 12 and is done by subtracting the smaller magnitude, 25, fram the larger magnitude. 37. and appending the sign of 37 to the result. This is a process that requires a comparison of the signs and magnitudes and then performingeither addition or subtraction. The same procedure applies to binary numbers in signedmagnitude representation. In contrast, the rule for adding numbers in the signedcomplement system dms not require a comparison or subtraction, but only addition. The procedure is very simple and can be stated as follows for binary numbers: The addition of two signed binary n u m h with negative n u m h represented in signed2'scomplement form is obtained from tfie addition of the two n u m k including heir sign bits. A carry out of the signbit position is discarded. Numerical examples for addition follow:
.T>:/
negarive numb must be initially in 2'scumplement form and hat if the sum obtained after the addition is negative, it is in 2'scomplement form. In each of the four cases, the operation p e r f w is addition with the sip bit included. Any carry o& of the gignbitposition is discadd, md negative redts are automatically in 2'scomplement form. In order to obtain a correct answer, we must ensure that the result has a sufficient number af bits to accommodate the sum. If we start with two nbit numbers and the sum occupies n f bits, we say that an werflow occurs. When one performs the add&ion with paper and pencil, an overflow is not a problem, because we are not limited by the width of the page. We just add another 0 to a positive number or another 1 ta a negative n u m k in the most siflcant position to extend the number to n + 1 bits and then perform the addition. Ovefflow is a problem in computers because the numbr of bits that hold a number is finite, and a result that exceeds the fmite value by 1 cannot be accommodated The complement form of representing negative numbers is unfamiliar to those used to the signedmagnitudesystem,To determine the value of a negative number in signed2's complement, it is necessary to convert the number to a positive number to place it k a more W a r form. For example, the signed binary n u m k 11111001 is negative the leftmost bit is 1. Its 2's complement is 00000111, which is the binary equivalent of +7. We thefore m g nize the original negative number to be equal to 7.
Note
+
Scction 1.7 Blnary Codes
17
Subtraction of two signed binary numkrr when negative numbor are in 2'scomplement farm is simple and can be stated as follows:
Take me 2k somplemml of the subVahcnd (ioeludimg the sign bit) md add it la tk minuend (including tbe sign hit). A c m y o r dthe hcrlgnbit puatron is discarded.
This pmeedun is adopted because a subtraction operation can be changed to an addition o p t i o n if the sign of the subtrahend is changed, as is demonstrated by the following relationship:
But changing a pasitive n u m b to a oegative number is easily d m by taking the 2's complement ofthe posi!ive n u m k The reveae is also true, because the cmnplement of a negative number in complement form pmduces the equivalent positive number. To see this, consider the subasction (6) (13) = +7. In binary witb eight bits, this opmtion is written as (1 1111010  11I I W I I ) , The s u M m is cbsnged toaddition by taking t k 2's complement of~subWhend(l3),giving(+I3).hbin~.~isli111010 + W001101 = iOMMOiIi. Rem~~theeodcarrv.weobrain~mnea~w~r:OWOOlIl 1+71. It is mhag binuy numbm in tk
[email protected]&nt ristem are added and ab rracvd by ihc same basic addition snd r u b c t i o o rulci as unstgned ~ u m k r rThnefurc, . camputen need only one commun hardware cnrcuit to handle bath types of mthmcnc. The u u r o r pmgrammcr must i n t e r n the results of such addition or subtraction dh%ently, depnding on whether it is mumd that the r~umbnsare signed M unsigned

ormb
1.7
B I N A R Y CODES Digital rystemsose signals that have twodininet values andcircuit clementsthat have twortable states. Thm is a direct analom amone binan, sieoals. binarv circuit elements. and binarv dig&. A biiary number of n b g z . for example, may be reprcknted by n b i circuit el=: mmts. each having an omput signnl quivaknt to 0 u I. Digital systems rent m d manipvlalc n n onl) binary numkrr, but also many other discmte ~lcmentrof i a f o m t i m . Any dirnete element of information that is distinct among a gmup of quantities can be npnsented with a binary code (it.. a pmm of O's and 1's). The codes must be in b i w y k a u s c , in today's technology, only c h i t s h t mpmcnl and manipulate panems of O's and 1's can be manufactured economically for use in computers. Hawever. it must be realized that b i i codes mrely change the s y n h h , not the meaning of the dements of information that they r e p resent. If we inspect the bin of a computer at mr&m we will fmd thPt m t of tk 6m they m w n t samc Noc of& infamuion mtherthao binarv nnmbns. An nbll b~aar)code IS a group of n bola that assumes up to 2" dstmn combmat~onrof 1's and O'r, utth each combtnaltoa reprercnuap o m clement of the set that s betng coded. A net of four ekmcnts can be &with two bits, with each ekment assigndone of the foUowing bit combinations: W. 01.10.11. A set of tight e l e m n u requires a h e  b i t code and a set of

..
. 
I8
Chapef 1 Digltal Systems and Binary Numbers
16 elements requires a fourbit code. The bit combination of an nbit code is de&mhed h m the count in binary from 0 to 2"  1. Each element must be assigned a unique binary bit combina~on,and no two elements can have the same value; otherwise. the c d e assignment will be ambiguous, Although the minimum number of bits required to code 2" distinct quantities is n, thm is no maximum number of bits that may be used for a binary code. For example, tbe 10 decimal digits can be coded with 10 bits, and each decimal digit can be assigned a bit combination of nine 0's and a 1. In t h i s particular binary code, the digit 6 is assigned the bit combination 0001000000.
Although the binary number system is the most natural system for a computer, most people are more accustomed to the decimal system. One way to resolve tbis difference is to convert decimal numkrs to binary, perform all arithmetic calculatims in binary, and then convert the binary results back to decimal. This method requires that we store decimal numbers in the computer so that they can l x converted to binary. Since the computer can accept only binary values, we must represent the decimal digits by means of a code that contains 1's and 0's. It is also possible to perform the arithmetic operations directly on dwimal numbers when they are stored in the computer in coded form. A binary code will have some unassigned bit combinations if the number of elements in the set is not a multiple power of 2. The 10 decimal digits form such a set. A binary code that distinguishes among 10 elements must contain at least four bits, but 6 out of the 16 possible combinations remain unassigned. Different binary codes can be obtained by arranging four bits into 10 distinct combinations. The code most c o m o d y used for the decimal digits is the straight binary assignment listed in Table 1.4.This scheme is called binarycoded &chul and is commonly referred to as BCD.Other decimal codes are possible and a few of them are pre sented later in this section. Table 1.4 #naryC&
CkrfmaI (1KD)
Declmal Symbol
D m
0
0000
1 2
m 1
3
0011
4 5
0100
6 7
0110 0111
8
loo0
9
1001
BCD
0010 0101
Section 1.7 Binary Codes
19
Table 1 4givt3thc fourn~turlc k,r uncdecimal h g i t A number with k dcomal dlglt~will 4t bu c.~i,~,.~ 3% ir rrplrhnlmncr, d W . I I . 1 2 hlar ill N,II I(YII 1 ~ 1 i n . Y ith each e r u u.~uf 4 btlb re~rrssntcneone decimal dlell. A dccnmal number in RCD 15 lllr whso the nvmbsr is k h s n 0 and 9.ABCD numsame rr irr equivalent b i n y oumbcr ber greater Ulan lolooks different from its equivalent binary n u m b s even though both contain 1's and O'r. Moreover, the b i n q combinations 1010 thmugh 1111 are not used and have no meaning in BCD. Consider decimal 185 and its corresponding value h BCD and b i n q :


(185)10 = (0001 l000OIOl)aco = (IOl1IWL)~ 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 h t the reprereotatian of a BCD number needs more bits than its equivalent binary value. However. t h e is an advantage in the me of decimal numbers, because computer input and output dam am generated by people who use thedeci d system. It is imporrant to realize that BCD numbers are decimal numbers and not binary numbers, although they me bits in theirrepresentation. 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 the binary code 0000. W01.0010. ... 1001. Ihe decimal value is exactly the same. Decimal LO is represented in BCD with eight bits a 0001 0000 and deeimal I5 as W0I 0101. The caresponding b' values are 1010 and 1111 and have only four bi.
.
BCO Addltlon Consider Ihe addition of nu0 decimal digits in BCD. togctha with a possible carry fmm a previous less significant pair of digits. Since each digit doer not exceed 9. the sum cannot be grearcrthan9 9 + I = 19, withthe I being apnviouscarry. Suppose wesddtheBCDdigiu as if they were binary numbers. Then the binary rum will produce a result in the range from 0 to 19. In binary, this mnge will be fmm 0000 LO 10011, but in BCD, it is from 0000 to I 1001. with the first (i.e.. leftmost) 1 k i n g s e q and the next four bitrbeingtheBCD sum. When the hioary sum is equal to or less than 1001 (without a carry), the comsponding BCD digit ir correct. However,when the binary sum is p a r e r rhan or equal to 1010, the result is an invalid BCD digit. The additionof 6 = (0110)2 to Ule binary sumconvertsit to the comctdigit and alro produces a carry as required. This is becaurc a c a y in the most significant bit p o b tion of the binary rum and a decimal carry differ by 16  10 = 6. Consider the following three BCD additions:
+
4 +59
0100
+= 1001
4
+s I2
0100
8
1100 +OLIO lWl0
17
+m +9
IW0 1001 10001 +0110 IOlll
In each care, the two BCD digits arc added as if they were two binary numbers. If lhe binmy rum is greater than or equal la 1010. we add 01 10 to obtain the comet BCD sum and s carry. In the fint example, the sum is equal to 9 and is the correct BCD sum. In the second example.
20
Chapter 1 Digital Systems and Binary Numbers
the binary sum produces an invalid BCD digit. The addition of 0110 produces the correct BCD sum,OO1O he., the number 21, and a carry. In the third example, the b i i sum pdwes a carry. This condition occurs when the sum is greater than or equal to 16.AIthough the other four bits are less than 1001, the binary sum requires a correction because of the carry, Adding 0110, we obtain the required BCD sum 0111 (i.e.,the number 7) and a BCD carry, The addition of two ndigit unsigned BCD n u m b follows the same prwdure. Consider the addition of 184 t 576 = 760 in BCD:
BCD
Binarysum Add 6 BCD sum
1 184 1000 0100 0111 0110 +576 10000 1010 0110 0110  0111 0110 0000 760
'1 0b01 +0101 0111

The fmt, least significant pair of BCD digits produces a BCD digit sum of 0000 and a carry for the next pair of digits.The second pair of BCD digits plus a previous carry pruducm a digit sum of 0110 and a cany for the next pair of digits. The third pair of digits plus a carry p d u e s a binary sum of 0111 and does not require a corntion.
The representation of signed decimal numbers in BCD is similar to the repreamtation of signed numbers in binary. We can use either the familiar signedmagnitude system or the signedcomplement system.The sign of a decimal number is usually represented with four bits to conform to the fourbit code of the d w b d digits. It is customary to designate a plus with four 0's and a minus with the BCD equivalent of 9, which is 1001. The signdmagnitudesystem is seldom used in computers.The signedcomplement system can be either the 9's or the 10's complement, but the 10's complement is the one most often used. To obtain the 10's complement of a BCD number, we first take the 9's complement and then add 1to the least significant digit. The 9's complement is calculated from the subtraction of each digit born 9. The procedures developed for the signed2'scomplement system in the previous section also apply to the gigmd10'scomplementsystem for decimal numbers. Addition is done by summing all digits, including the sign digit, and discarthe end carry. This operation assumes that all negative numbers are in 10'scomplement form. Consider the addition (+375) (240) = 135, done in the signedcomplementsystem:
+
+
The 9 in the lehost position of the second number represents a minus,and 9760is the 10's complement of 0244.The two numbers are added and the end carry is discarded to obtain +135. Of course,the decimal numbers inside the computer, including the sign digits, must be in BCD. The addition is done with BCD digits as described previously.
Section 1.7 Binary Codes
21
The subtraction of decimal numbers, either unsigned or in the signed10'scomplement svstem. is the same as in the binarv care: W e the 10's comnlement of the subtrahend and add rlto the m r n d Many cornpunk have s p 8 . d bardware ;o perform anUunelie ualeulatloos dimUy with decimal n u m b in HCl, lk user of the computer can specify plwogrammed iosmrtims to prfam the arilhnvtie opratinn witb d e c i d numberr dimly. without having to convert them to binary.
Other Decimal C o d a Binary codes for decimal digits q t t i l r a minimum of four bitspdigit. Many different codes can be formulated by arranging four bits into 10 distinct combinatlona. BCD and thme other repressntative codes sle shown in Table 1.5. Each code uses only 10 out of a possible I6 bit eombmations that can be arranged with four bib. The other six unused combinations have no meaning and should be avoided BCD and hc 2421 code an examplesof weighted e d s . In a weigh&&, each bh pmiti'an h a s s i g n e d a w i ~ g ~ i n a u h a w a y t h a t e a ckwaluncdby.ddiihcweights h~t~ of an hc 1's in the ccded combilmim. The BCD mdc bar.wights of 8.4.2. and I, which coatapandtohcpaver.of(~~valuerofeach bit.% bit arsigomentOll0, foruample, is luaprrced bythewei&torrpnMlt&cimal6keau~8 X 0 4 X 1 2 X 1 + 1 X 0 = 6.Thcbit mmhinatian 1101, whol weighed by the mpctive digits 2421, giws h d e e i d equivalent of 2 X 1 + 4 X 1 + 2 X 0 + 1 X 1 = 7. Note that nome digits can be coded in hvo p r i b l e ways in the 2421 code. For instance. d s i 4 can be assigned to hit combination OlW or 1010, sim bMh combinationsadd up LO a total weight of4.
+
+
Table 1.5 FourD~UnqCods(brhr~D!gIU
0 I 2
3 4 5 6
7 8 9
unuwd bit mmbi
nalianr
WOO WOI MIO 0011 0100 0101 0110 0111 IWO IWI
mm
1010 1011 IIM 1101 1110 1111
ml0 0011 OIW loll 1100 11oi Ill0 1111
MI1 OIM 0101 0110 0111 lMYl IW1 1010 1011 llM
ow0 0111 0110 0101 0100 1011 1010 IWI IWO
0101 0110 0111 1WO IW1 1010
WOO WO1 WIO 1101 1110 1111
WO1 MI0 Dolt IIM 1101 1110
WOl
llll
22
Chapter 1 Dlgkal Sgrstems and Bkrary Numbers
&.
The 2421 and the excess3 codes are examples of selfcomplemmhg Such & have tbe property that the 9's complement of a d e c b d number is OM directly by changing 1's to 0's and 0's to 1's (i.e,,by komp1emenlh.g each bit in the pattern). For example, decimal 395 is represented in the excess3 code as 0110 1D l O Im.The 9's complement of 6M is represented as 1001 00110111, which is obtained h p 1 y by complemmhgeach bit of h e code (as with the 1's complement of binary numbers). The excess3 code has been used in some older computers because of its selfcomplementing proprty. Excess3 is an unweighted code in which each coded cumbid011is obtained from the correspondingbinary value plus 3. Note that BCD code is not selfcomplemeflting. The 8,4, 2, 1c& is an exmple of assignin# both positive md negative weights to a decimal code, h this case, the bit combination 0110 is interpreted as k i m d 2 and is calculatedfrom$XO+4Xl+(2)X1+(1)XO=2.
Gray Coda The output data of many physical systems are quantities that are continuous. These data m t be converted into digital forrn before they are applied to a digital system. Coatiwousor analog hfonmtiw is convertedinto digital form by meam ofan a n a l o g  W t a l ~oflverter.It is smnetimes convenient to use the Gray d e shown inTable 1.6to represent digital data that have been converted from analog data. The advantage of tbe Gray code over the stmight binary number sequence is that only we bit in the code group changes in going R.om one n u m b to the next. For example, in going from 7 to 8, the Gray code changes from O1OO to 1100. M y the first bit changes, from 0to 1: the other b e bits mmain the sama By contrast, with biaary numbers the change from 7 to 8 will be from 0111 to 1000, which causes dl four bits to change values. Table 1.6 Gray Code Grqlr
Code 0000 OOO1 0011 0010 0110 0111 0101
0100 1100
Decllrral
Equhahm 0 1 2 3 4 5
6 7
8
1101 1111 1110 1010 1011 1001
9 10 11 12 13 14
loo0
IS
S d o n 1.7 Binary Codes
23
The Gray code is uxdin applications in which the normal sequence of binary numbns may pmducc an error or ambiguity during the transition fmm one number to the next. If binary numbers are used. achanee. for cxamnle. from 01 11 to IWO mav d u c e an inlwwdiate ermr number 1W1 il ;he value o f & righumst bit taker longe; to c h a n r than do the Val. ucs of the a k three bits. 7he Gray ccdc cltm~nrterthis problem. s t m only o w bit changes its value during any tramition between two numben. A typical application of the Oray code is the representation of analog data by a continuouo change in the angular position of s rhafi. The shaft is partitioned into segments, and each segment is assigned a number. If adjacent segments are made to cornspond with the Graycode squence, ambiguily is eliminated belween the angle of the shah and the value encaded by the senror.
ASCII Character Code Many applications of digital computers require the handling not only of numbers, but also of other characters or symbols. such as the leners of the alphatxt. For instance. an inuvance comm v with thousands of oolicvholders will use acomDutcr lo omcen its files. To reorewe the , names and aher pmnnrnt m f m u o n . ,I I\ necessary to fomwlate a bmry code f u the letten of lhe alphabet In dd~tton.the same baary code must reprevnt numerals and qpclal charaners (such as S). An alphanumeric character set is a set of elements that includes the 10 d a d digis, the 26letvrr of the alphabet, and a numberof special characm. Such a act conlains between 36 and 64 elements if only capilal letan arc included, or between 64 and 128 elements if both uppercase and lowercase letters are included. In the first case, we need a binary code of six bits. andin the second, we need a binary code of seven bits. The standard binary code for the alphanvmwic characten is the American Standad Code fw lnfwmation Interchange (ASCII). which uses seven bits to code 128 chsracters. as shown in Table 1.7. Tlu seven birr of the d c ux designated by bl through b. with b the most significant bit. The leuer A. for exsmplc. is repwnted in ASCII a\ IMOOOl (column IW. mw WOI). The ASCII c d r also contains 94 grdphic characm Ihat can be printed and 34 "an. printing characters usedfor various conval funcdons.The graphic Characters consist of the 26 uppercase letten (A through Z), the 26 lowercase letten (a through 1). the 10 numerals (0 Ihrovzh 9). and 32 soecial mintable characters. such iu W.. *. and S. . ~ ~ TI; 3 i k n u o l cdaraclcn are &signaled i n k c ASCII tahle with abbreviated nams. They are listed again below the lable with their boctional names. Thcmnml characten are used for muting dam and arranging the printed text into a pscribd formu. There are three types of contmlcharacters: fonnaeffecmn. information m r a t o n . andcommunicationcanuolcharaclen. Format cffccton arc charscm that control the layout of printing. They include the familiar ward processor and rypewrttcr eonuols such as backspace (BS), horhonul tabulatian (HT), and carriage reurn (CR). Informtion reparalorn ere u x d to wpmte the datainto divisions such as paragraphsandpages. They include characlerssuch iu recordxpmmr (RS)and file smamUU IF%. The communicationmud c b m a m me useful donine the uansmisnim of lext beween remote termanals. Exmplu of commumcauomcoml characters am STX tslan of lext) and ETX (end of lextl. whrh arc uscd to ham a text message transmud though
.
.
.

24
Chapter I
Digital Systems and B l n q Numb Table 1.7 Amertcm Standard C&? hf I
*I
(ASCII)
bad5 b4b3bdl 000 
 ‘
001
0000 OOO1 010 0011 0100 0101
NLn,
D
SOH STX
DC1 DC2
Em
DC3
EOT
ENQ
DC4 NAK
0110
ACK
SYN
0111 1000
BEL BS
CAN
1001 1010 1011
LP
EM SUB
VT
ESC
1100 1101
En
FF CR SO SI
1110
11'11
010
011
100
101
110
SP
0 1 2 3
@
A 3
P Q R
a
9
b
C
s
C
r s
4 5
T
d.
U
e
6
D E F
V
f
11 v
7
0
W
8 9
H
X
I h
w x
1
I U
# $
5% &
ETB
I
1
FS
z
i
Y z
K
[
L
\
j k 1
1
m
>
M N
A
n
h.
7
0
0
DBL
<

;

 
 t
Y
9

0s Rs US
P
J
1
+
Ill
I1.
Control ctsarrcterr . 
NUL SOH
.
STX '
EI'X
: m ENQ ACK
"
. BEL
BS HT
Null S m o f hsading Startoftext Endof text
Endoffransmhsiw Enquiry Acknowledge Bell Backspaet Horizontal tab
LF YT FP CR
Line f a d V M tab Form feed
SO
Shift out Shift in
SI SP
qSW
DLE DC1 DC2 DC3 DC4
NAK SYN 6TB
CAN EM I
SUB ESC
FS GS RS
US DEL
Datalink escape Device conml f
Dtvlcacontm12 Devioe control 3 Dcvloeoon1rol4 * NepiivcachowMge Synchmmsidle Bndof~ssiwbloelr Cancel Endofmedium . :  . Substitute Escape File separator < .
UP
Unit s q a a m Delete

ASQI is a sevenbit code, but most computers rnanipulm an eiatbit quantity as a single unit called a byte. Therefore, ASCII characters most often are stored one per byte. The extra bit is sometimes used for other purposes, depending on the a p p l i c a h For example, wnae printersrecognize eightbit ASCII chapdcters with the most sipi6caflt bit s& to 0. An ~~
Section 1.8 B l n a y Storage and Registers
25
128 eightbit characterr withthe most significant bit set to 1 arr used for othersymbols, such as the Greek alphabet or italic type font
EnorDetMlng Code To detect e m n in data communication and processing, an eighth bit is sometimes added to the ASCU character to indicate i b padry. Aparily bir is an exw bit included with a message lo make the total number of 1's either even or odd. Consider the following two characters and their even and odd parity:
ASCII A = IWOOOl ASCII T = 1 0 1 0 1 ~
With even parity OlDwML 11010iOO
With odd parity 1IWOOOL OiOlOlOO
In each care, we inserr an extra bit in the leftmort position of the code to produce an even number of 1's in the character for even parity or an odd number of 1's in the character for odd parity. In general, one or the other parity is adapted, with even parity being mare common. The parit) bnt is helpful in dcvctinp crron duringthe tr~nsmiss~onoiinfomation fmmone laauon to another. This function I, handed by grneral~ngan cvco pant) brt at the soding cod for each character. The eightbit chamten that include parity bits are transmitted to theirdestinanon. The parity of each character is then checked at the receiving end. If Ule parihi of the received ch&cteris not even. then at least one bit has chaneedvalu~dudaethe ~ m k s r i a n . Thrr method detects one. three. or any odd cumb~nat~on ufenorr in each character that I, mnrmaned An e>mcombrnat~onof e m n . huuebcr. gw\ undutc~rud.md dduldl~cmde m dctection coder may be needed to take care of that possibility. What is done after an error is detected depends on the particular application. One porribility is to request retransmission of the message on the assumption that the error was random and will not occur aeain. Thus. if the receiver detects a aarihr , error. it sends back the ASCU NAK (negati,e acknouledge) control character conrirllng of an crcnpanty wght bits 10010101. If nc, unur i r dctr.ctcd. the mccivur \und\ hack an ACK (ackno~lzdgu) tunIml character, namely. OW001 10 The rending end uill rrrpood to an NAK by uanrmtung the message again until the correct parity isreceived, lf,ifier a number of attempts, the transmission is still in ertor, a message can be sent to the operator to check for malfunctions in the uansmissiaa path.
.
1.8
BINARY STORAGE A N D REGISTERS The binary information in a digital computer must haves physical existence in same medium ~ yis a device that possesses two stable states and is cafor storing individual bits. A b i ~ CCN pable of storing one bit (0 or I) of information. The input to the cell receives cxcifatian rignals that set a to one of the two states. The output of the cell is a physical quantity thst distinguishes between the two states. The information stored in a cell is 1 when the cell is in one slabie state and 0 when the cell is in the otbn stable state.
26
Chapter 1 Digital 5
and Sinmy Numbtn
Registerr A register is a group of binary cells.A register with n cells can store any discrete q h t y of information that contains n bits. The state of a register is an ntuple of 1's and O's, with each bit designating the state of one cell in the registet. The content of a regism is a Punctionofthe interpretation given to the information stored in it. Consider, for example, a 16bitregister with the following binary cormtent:
A register with 16 cells can be in one of 216possible states. If one assumes that the content of h e register represents a binary integer, then the register can store any binary number from 0 to 216  1. For the particular example shown, the content of the register is the binmy equivalent of the decimal n u m h 50,12 1. If one assumes instead that the register stores alphanumeric characters of an eightbit code, then the content of the register is any two meaningful characters. For the ASClI code with an even parity placed in the eighth most significant bit position. the register contains the two characten C (the h o s t eight bits) and I (the rightmost eight bits), If, however, one interprets the'content of the register to be four decimal digits represented by a fourbit code, then the content of the register is a fourdigit decimal number. In the excess3 code, the register holds the decimal number 9,096.The content of the register is meaningless in BCD, because the bit combination 1100 is not assigned to any decimal digit. From this example, it is clear that a register can store discrete elements of information and that the same bit configuration may be interpreted differently for different types of data. ..
A digital system is characterized by its registers and the components that perform data processing. In digital sy stems, a register transfer operation is a basic operation that consists of a transfer of binary information h m one set of regbters into another set of registers. The transfer may be direct, from one register to another, or may pass through dataprocessing circuits to perform an operation. Figure 1.1 illustrates the transfer of infomation among registers and demonstrates pictorialIy the transfer of binary information from a keyboard into a register in the memory unit. The input unit is assumed to have a keyboard, a control circuit, and an input register. Each time a key is struck, the control circuit enters an equivalent eightbit alphanumeric character code into the input register. We shall assume that the code used is the ASCII code with an oddparity bit. The information b m the input register is transferred into the eight least significant ce1Is of a processor register. After every transfer, the input register is cleared to enable tbe control to insert a new eightbit cade when the keyboard is struck again. Each eightbit character transferred to the processor register is preceded by a shift of the previous character to the next eight cells on its left.When a transfer of four characters is completed, the processor register is W1,and its contents are transferred into a memory register.The content stored in the memory register shown in Fig. 1.1 came from the transfer of the characters "J," "0.'" "H," and " N after the f a n appropriate keys were struck  ,I
ACUa 1.1
Transfer d lnformatlon m n g r e g l a e n
To pprocess discrete quantities of information in binary form, a compurer must be provided with devices that hold the data to be processed and with circuil elements that manipulate individual bits of information. The device most commonlv used for holdins data is a register. Htnary rar~ablerare rnan~pulatedby means of dlgitll logic C I R . U I ~ S Fbgure I.? 11. luarates the process of adding two 10bit b~narynumben. The memor) ulut. whtch normally consists of millions of registers. is shown with only three of its registers. The Dart of and ~3torether with the processor unit shown consisis of three registersRI.,?~. logic cmuit, that manip~latethe blrs 01~ i a n R2 d and transisr nnlo ~ j b a! n q number equal to thew arithmetic Gum. M c m o ~rcgl\terr rtorc infc,nnatlun and *re incapable of processing the two operands. However, the information stared in memory can be transferred to processor registen, and the naults obtained in m e s s o r reeisten can be transferred back into a memo? reglsler for storage untd needed aeatn The dlaprdm shows the content, of two operands tranrfemd from two memoq regtntcn nnlo R l and R2 The dlgntal logrc elrcultr produce the sum. u hlch IS translemd to reglrter R3 The content* of R j can nau be tran,ferred back to one of the memmy registers, The la51 two examples demvnitralcd the iniurmatlonnuw capabrltl~esut a drg~mlr ) r u m In a rlmple manner Thc xylslcr\ ofths ,y,tcm arc thr. bauu ~ 1 r . r n r . for a ~ stu"ng and holding D~yivallc,g~cccn.utt* Ilrc,ue.\ thc b l n a ~informatlon stored in rhe the hlnary inf#~matwn. ~
~~

~
..registem, Digital logic circuits and registers are cavered in Chapters 2 6. The m a m y unit is explained in Chapter 7. The description of register opedons at the register tramfer level and the design of digital systems are covered in Chapter 8. . 1
1.9
B I N A R Y LOGIC Binary logic deals with variables that take on two discrete values and with o p d o n a hat assume logical meaning. The two values the variables assume may be called by Merent name (true andfalse, yes and no,etc.), but far our p v , it is convenient to thiak in k m s of bits and assign the values 1 and 0.The binary logic introduced in this sation is equivalent to an algebra called Boolean algebra. The formal presentation of Bwlem algebra is cwered in more detail in Chapter 2. The purpose of this section is to i n d u c e Baolean algebra in a heuristic manner and relate it to digital logic circuits and binary signals.
S e a i o n 1.9 Binary Logic
29
B i i logic consists of binary vsriables and a set of logical operatiom. The variables are designated by leners of thealpha&, such as A, 6. C.x.y, i,etc., with each variable having moaodonly twodistinnpossibievalues:1 and0,Them are three bariclogicalaperafionr:AND. O R andNOT 1. AND: This owration is reureseated by a dot or by the absence of an operator. For
.. .
.
.
.
" .
is interpreted to mean t b a r = L if and only if x = 1 and y = 1: otherwise := 0. (Remember that x, y, and z are binary variables and can be equal either to I or 0, and nothing clse.) 2. OR: l t k operationis r e p e n t e d by aplur sign. For example. x + y = ;is read? OR y i s e q u a l t o z , " m e a n i n g ~ t r= l i f x = I o r i f g = l o r i f b o t h x = land). = ].If bothx = Oandv = 0,thcnz = 0. 3. NOT: This operation is represented by a prime (sometimesby an overbar). For example. z' = r (or ? = r ) is read "not x is equal to 1." meaning that :is what x ir not. In other words. if x = 1. then r~.= 0.but if x = 0.Ulen = I. The NOT oDerat~anis also refmcdto as the Eomp~cmentoperation, since it chsages a I to 0 and o to 1. ~
.
a
Binary logic resembles binary arithmetic, and the operations AND and OR have similarties to multi~licationand addition.resaeetivelv.In fact. the svmbols usedfor AND and OR are the same as those uud for muluphcauon and adhtton. Houever. b l n q loge should not be mnf u , d wtth binary mthmeuc. Ooc AuulJ reahra thdt an mthmcuc vmablc deugndar a num ber that may consist of maay digits. A logic variable is alwsys either 1 or 0.For example, in binsrv atilhmetic. we have 1 + 1 = 10 (read "one olus one is eaual to 2"). whereas in binaw logic, we have 1 I = I (read "one OR one is equal to one", Fur each r'xnh~natrunof the \alms of randy, thcrc IS a saluc ol :rpeclficd b) the defimlnonof the lnglcul operaiun. Defin8tiunr of lapcal upcratlunr ma) k I!\tcd in il cumpact form called tmrh ,able$. A truth able is s [able of all possible combinations of the variables. showine the relation between the valuer that the variables mav take and the result of the owration. 'lhc lruth tablcr f ~ the r uperaltont AND and OR uilh \ariahlc\ .I and ).are ubtalned hy Ilamg all po


Table 1.8
Truth Toblrr of logic01Operations AN0
OR
NOT
30
Chapter 1 Mgtlhl Systems and lkrary N u m h
Logic gates are electronic circuits that operate on one or more input signals to produce an output signal. Electrical signals such as voltages or currents exist as analog signals having values over a given range, say, 0 to 3 V,but in a digital system are interpreted to be either of two recognizable values, 0 or 1. Voltageoperatedlogic circuits respond to two separate voltage levels that represent a binary variable equal to logic I or logic 0. For example, a particular digital system may define logic 0 as a signal equal to 0 volts and logic 1 as a signal equal to 3 volts. In practice, each voltage level has au acceptable range, as shown in Fig. 1.3. The input terrninds of digital circuits accept binary signals within the allowable range and respond at the output terminals with binary signals that fall within the specified range. The intermediate region between the allowed regions is crossed only during a state transition. Any desired information for computing or c o n h l can be operated on by passing binary signals through various combinations of logic gates, with each signal represeflting a particular binary variable. The graphlc symbols used to designate the b e e types of gates are shown in Fig. 1.4. The gates are blocks of hardware that produce the equivalent of logic1 or logic0 output signals
I
3
(a) Twoinput AND gate
FIGURE 1.4 Symbols fw dll
Signal range for logic 1
@) Twoinput OR gate
bgic d d t s
(c) NOT gate or inverter
d
"
l 0
f i m . ~ ~0 OR:r+y
7
j,cyrr.
1 1 0
0 1 1
0
l
k
o r n o I
I
0
0
0
1
I
I
1
RCWE 1.5
I n p u t a t p u t rlgnals for gates
(a) T%ree.input AND p t
(b) FourInput ORgrte
MUIT 1.6 Gates wlth r n u l t l p Inputs
,
The i n p ssgnalr x and m the AND and OR gates may curt m am of fow pasthk n m s W. 10.11, or01 Thev mpul ~ ~ g n aarc l s ,houo in Fig 1 5 tog& with & &sponding oulput signal for w h g*. The liming d&mm i l l u k the rer m o s e o f c s c h e a u l o ~ f w r ~sirmalmmbinalim.Theh~2ontalaxisofktiminediam t rqrecmts ttme. and tk vmcal mi^ shows the signal as it cnsnges benrnn ihe tropasr~blevoltrp levels. Ihe l w level nlr lopre 0. the high level l ~ 1. The c AND gate rerpnds wtth a *lu 1 a u w t signal when bath input signals arc logic I. The OR gnu responds uirh a logic I o & u t s k d if MY . input . signal  is l&c I. Ihe NOT& is commonly referred toas an inveer. '&reas& for this nis a~~ &Ithe oimal rermnre in Uw &x diaeram. which shows lhal rhc outplt , ~ g dmvms thc Iupc scmr of the Input s~enal AND and OR gates may hate more than two inputs. An AND gau wlth t h e lnpuls and an OR gatc with four inputs arr shown in R g 1.6 The threeinput AND gate mrpoodr with logic I oubut if all three inputs uc logic 1. The output pmduces logic 0 if MYinput is logic 0.The fowinput OR gaususpmds with logic 1 if any input [email protected] I: itsoutput bemmcs logic 0 only when eU inputs uc logic 0. 11 i n p a logic q u i r n r r n t s are saorficd

.
..



.
 
PROBLEMS to p b h r marked wiU1. l p p e a~t the end of the bmk. List the octal sod hexadecimal numben fmm 16 to 32. Using A, 8. and C for the last Ihree digits. list tk nurnben fmm 8 lo 28 in base 13. 1.F What is the exact number of bytes in a system lhal conrains (a) 32K byler. Ib)64M bytes. and (E) 6.4G bytes? Anr
1.1
32
Chaptor 1 Dig'rtal Systems and Blnary Numbers 1.3
Convert the following mlmbers with the indicated bases to decimal: (a)*
(4310)s
@I*
(198)12
(d) (52516 1A What is the largeat binary n m k that can be expressed with 14 bits? What are the equivalentdecimal and hexadecimal nudnm? 1J* Determine the base of the numbers in each case for the following o p t i o n s to be correct: (c) (73518
(a) 1412
= 5,
+
(b) 5 4 4 = 13.
24 17 = 40. 1.6* The solutions to the quadratic equatiun x2  11x 22 = 0 are x = 3 and x = 6.What is the base of the numbers? 1.I* Convert the hexadecimal number 68BE to b h q , and then convert it from binary to mtd. 15 Convert the deem number 431 to binary in two ways: (a) Convert W y to binary; @) convert fist to hexadecimal and then from hemkciml to binary.Which methd is hkr? 1.9 Express the following numbers in decimal: (c)
(a)*
{10110.0101)2
(c)* (26.24)* (e)
+
Ibl* (l65116 Id) (FAFA)16
. (1010.1010)2
1.I 8 Convert the fouowing binary numbers to h e x a c k h d and to dccimak (a) 1.10010,@) 110.010. Explain why the decimal mwer in (b) is 4 times that in (a), 1.1F Add and multiply the following numb without [email protected] them to decimal. (a) Binary numbers 1011 and 101. (b) Hexadecimal numbers 2E aad 34. 1.13 Do the following conversion probIems: (a) Convert decimal 27.315 to binary. @) Cdcculate the binary equivalent of 1 3 out to eight places. llm convert &om binary to decimal. How close is the resuIt ta 2/31 (c) Convert the binary result in (b) into hexadecimal. Then convert the dto decimal. Is the answer the same?

1.14 Obtah the 1 's and 2's complements of the following binary numbers: Ia) l([email protected] @) (c) 11011010 Id) OlllOllO (e) lOOOO101 (f) 11111111. 1.I5 Emd the 9'8 mi3 the 10's complement of tbe following decimal numbers: (a) 52,784,630 (c) aooO,oa()
0)63,325,MW)
Id) 00,ooo,ooo. '! \ 1.1 6 (a) Find the 16's complement of BZFA. . (b) Convert B2FA to binary. (c) Find the 2's complement of the result in 0). (d) Convert the answer in (c) to hexadecimal and compare with the answer in (a).
Problems
33
1.17 Perform sublnelion on the given uodgned numben using the 10's cdmpiemmnt of the s u b hold. Where thehcresvlt should benegative. fiod its 1O'~complemenrand affix aminus sign. Ver. ify yarranswen. (a) 6,428  3.409 15) 2.043  6.152
(b) 125  1.800 (d) 1,631  745 1.18 Perfomsuhrractiononthsgivc. unsignedbinarynvmbenuringihe2'rcomplcmcntofh mh. I h c n d . Where the result shouldbe negative, find its 2's complcwnt and affix a minus sign. (b) 1MX)IO IWOII la) iW11 iWOl lc) IMI IOIWO ld) 110000  10101 1.19 The follov~ngdeclmlnumhrrare shown m r~gn.mngrutudrform 9.286 and 801 Convcn !hem to sxped.10 5complcmml lam md Worm the foliog operatloor lnolc tha the sum n 10.627 and inlmre, h e dmts ad a samt. (a) (+9,286) + (+801) (b) (19,286) + (801) le) (9.286) + ( + s o l ) (d) (9,286) + (801) 1.20 Conwn decimal +46 and +29 to binary. using the signed2'acomplemnc rspvnfation and enough digits to accommodate the numbera. Then perform the binary equivalent of (+29) + (49). (29) + (+49),and(29) + (49).Converrhanswersbacktodecirml and venfy Ular they an correct.


~~
1.21 ifthe numbera (c9.742110 and (+641)m arc in signed mapirudc format. t h e i ~sum is (+10.383)~0and requires five digits and a rign. Convcn the numbers to signcd.10'6complcmen1 f o m d find the followinc sums: (a) (+9.742) + ( + M I ) (b) (+9.742) + (641) (c) (9.742) + ( + M i ) (dl (9.742) + (641)
1.22 Convcn decimal 8.723 lo both BCD and ASCII ecdedes.For ASCII, an even psrily bit is lobe apprided at the kfl. 1.23 Reprevst the unsigned decimal numbm 842 and 537 in BCD. and then show the steps neeeb wy to form their sum. 1.24 Fmulatc a weighled binary code for tbe decimal digits. using weights la)*6.3. 1. I lb) 6.4.2, I 1.25 Repsen1 the decimal number 5.137 in la) BCD. (b) crccnJ code. lc) 2421 code. and ld) s 6311 rode.
1.26 End lhc 9's eomplsmcnt of decimal 5.137 and express il in 2421 code. Show thsl h e nsull is the 1's complement of Ihe answer lo (e) in Pmbicm 1.25. This demonstrates that the 2421 mie is selfcomplementing.
1.n Auigr a b i n q c o d e in someorderly manner lo the 52 pisying 4 s . U% the mulimum number of bits. 1.26 Wnw the erprraon 'G.B.ulc" ~n ASCII. "rang an c~ghlh,lLC&. lnclvdc the p o d and the >pare Trral ihc lcftmurl hhl sf each character a. r pmly hir 1h;h clghrhl! code should hale even . I)YII~ c w e a 1% ucntun. malhcmauctan Uwlcan alrebra !omxluced m . ~ ( ~ F o NBWIL the next chapter, bean his n n n . )

0
.*
1
Decode the following ASCII code:
:;, t
1 m 1 0 1101001 1101100 1101100 1000111 1100001 11101M) 1100101 1110011.
.30_ The following is a string of ASCII characters whose bit pattems have k e n converted into h a decimal for cornpachess: 73 F4 E5 76 E5 4A EF 62 73. Of the eight bits in each pair of digits, the leftmost is a parity bit, The remaining bits are the ASCU code. (a) Convert the smng to bit form and decode the ASCIL fi) Determine the parity used: odd or even?
it1 L r
1.31* How many printing characters are there in ASCII? How many of them are special cbmcters (notletters or numerals)? 'C( v 13P What bit must be complemented to change an A & letter from capi'tal to hercase and vice versa? 1 3 p The state of a 12bitregister is 100010010111. What is its content if it represents (a) three decimal digits in BCD? (b) t h e decimal digits in the excess3 code? {p, ! (c) three decimal digits in the 8421c&? (d) a binary number? 1 List the ASCII code for the 10 decimal digits with an odd parity bit in the l e h t pition. 1.35 By means of a timing diagram similar to Fig.1.5, show the signah [email protected] f and g mFig. P1.35 as functiom of the tbree inputg a, b, and c. U%edl eight psible ambidions of a, b. and c. abc
4
I:, t
mcum P 1 3 I I
1.36 By means ofatimingdiagram sirnilat.toFig. 1.5, showthed~afsofkoutputsfarsdghFig. P1.36 as functions of the two inputs a and b. Use all four possible combinationsof a and b.
References
35
REFERENCES 1. 2.
3. 4.
CAV~WW~R. 1. J. 1984. Digit01 CornpwrrArifhrnnic. New Ymk:McCrawHill. NO, M. M. 1988. Cornpurer Engineeea8i.gHotdworeDedgn. EnglewwdCliSs. NJ: PmticeHall. NELSON. V P, H. T NAGLE. I. D.I R W ~ and . 8. D. CARROLL. 1997. Diginrllogic Circuit Anobsis ondDesi8n. L ' p r Saddle River, NI: Rentice Hall. SCHMID. K 1974. Decimal Cornpxlnfhn.New York:lohn Wilcy.